Skip to content

Commit c5fdd8d

Browse files
committed
test: Clean up alloc_jemalloc usage in tests
Right now there's just a smattering of `// ignore-foo` platforms which is ever expanding as new ones are added. Instead switch to only running these tests on Linux/OSX and then use a guaranteed-to-work but not-as-well-tested alternative on other platforms.
1 parent 0b1dc26 commit c5fdd8d

File tree

4 files changed

+26
-34
lines changed

4 files changed

+26
-34
lines changed

src/test/compile-fail/allocator-dylib-is-system.rs

+12-4
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// ignore-windows everything is the system allocator on windows
12-
// ignore-musl no dylibs on musl yet
13-
// ignore-bitrig no jemalloc on bitrig
14-
// ignore-openbsd no jemalloc on openbsd
1511
// aux-build:allocator-dylib.rs
12+
// aux-build:allocator1.rs
1613
// no-prefer-dynamic
1714
// error-pattern: cannot link together two allocators
1815

@@ -23,7 +20,18 @@
2320
#![feature(alloc_jemalloc)]
2421

2522
extern crate allocator_dylib;
23+
24+
// The main purpose of this test is to ensure that `alloc_jemalloc` **fails**
25+
// here (specifically the jemalloc allocator), but currently jemalloc is
26+
// disabled on quite a few platforms (bsds, emscripten, msvc, etc). To ensure
27+
// that this just passes on those platforms we link in some other allocator to
28+
// ensure we get the same error.
29+
//
30+
// So long as we CI linux/OSX we should be good.
31+
#[cfg(any(target_os = "linux", target_os = "macos"))]
2632
extern crate alloc_jemalloc;
33+
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
34+
extern crate allocator1;
2735

2836
fn main() {
2937
allocator_dylib::foo();

src/test/compile-fail/allocator-rust-dylib-is-jemalloc.rs

+12-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// ignore-windows everything is the system allocator on windows
12-
// ignore-musl no dylibs on musl right now
13-
// ignore-bitrig no jemalloc on bitrig
14-
// ignore-openbsd no jemalloc on openbsd
1511
// aux-build:allocator-dylib2.rs
12+
// aux-build:allocator1.rs
1613
// error-pattern: cannot link together two allocators
1714

1815
// Ensure that rust dynamic libraries use jemalloc as their allocator, verifying
@@ -21,9 +18,19 @@
2118
#![feature(alloc_system)]
2219

2320
extern crate allocator_dylib2;
21+
22+
// The main purpose of this test is to ensure that `alloc_system` **fails**
23+
// here (specifically the system allocator), but currently system is
24+
// disabled on quite a few platforms (bsds, emscripten, msvc, etc). To ensure
25+
// that this just passes on those platforms we link in some other allocator to
26+
// ensure we get the same error.
27+
//
28+
// So long as we CI linux/OSX we should be good.
29+
#[cfg(any(target_os = "linux", target_os = "macos"))]
2430
extern crate alloc_system;
31+
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
32+
extern crate allocator1;
2533

2634
fn main() {
2735
allocator_dylib2::foo();
2836
}
29-

src/test/run-pass/allocator-default.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
#![feature(alloc_jemalloc, alloc_system)]
1212

13-
#[cfg(not(any(windows, target_os = "bitrig", target_os = "openbsd", target_os="emscripten")))]
13+
#[cfg(any(target_os = "linux", target_os = "macos"))]
1414
extern crate alloc_jemalloc;
15-
#[cfg(any(windows, target_os = "bitrig", target_os = "openbsd", target_os="emscripten"))]
15+
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
1616
extern crate alloc_system;
1717

1818
fn main() {

src/test/run-pass/allocator-jemalloc.rs

-23
This file was deleted.

0 commit comments

Comments
 (0)