Skip to content

Commit df9e173

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 4fbc080 commit df9e173

File tree

4 files changed

+28
-36
lines changed

4 files changed

+28
-36
lines changed

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

+13-4
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
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
11+
// ignore-musl no dylibs
1512
// aux-build:allocator-dylib.rs
13+
// aux-build:allocator1.rs
1614
// no-prefer-dynamic
1715
// error-pattern: cannot link together two allocators
1816

@@ -23,7 +21,18 @@
2321
#![feature(alloc_jemalloc)]
2422

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

2837
fn main() {
2938
allocator_dylib::foo();

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

+13-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
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
11+
// ignore-musl no dylibs
1512
// aux-build:allocator-dylib2.rs
13+
// aux-build:allocator1.rs
1614
// error-pattern: cannot link together two allocators
1715

1816
// Ensure that rust dynamic libraries use jemalloc as their allocator, verifying
@@ -21,9 +19,19 @@
2119
#![feature(alloc_system)]
2220

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

2635
fn main() {
2736
allocator_dylib2::foo();
2837
}
29-

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

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

11-
#![feature(alloc_jemalloc, alloc_system)]
11+
#![feature(alloc_jemalloc)]
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"))]
16-
extern crate alloc_system;
1715

1816
fn main() {
1917
println!("{:?}", Box::new(3));

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

-23
This file was deleted.

0 commit comments

Comments
 (0)