Skip to content

Commit 8d46118

Browse files
authored
Merge pull request rust-lang#4333 from RalfJung/mips-tests
run tests on mips-unknown-linux-gnu
2 parents 44d3c93 + aa4d16a commit 8d46118

File tree

4 files changed

+30
-22
lines changed

4 files changed

+30
-22
lines changed

src/tools/miri/ci/ci.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,12 @@ case $HOST_TARGET in
156156
MANY_SEEDS=64 TEST_TARGET=i686-pc-windows-gnu run_tests
157157
MANY_SEEDS=64 TEST_TARGET=x86_64-pc-windows-msvc CARGO_MIRI_ENV=1 run_tests
158158
# Extra tier 2
159-
TEST_TARGET=arm-unknown-linux-gnueabi run_tests
160-
TEST_TARGET=s390x-unknown-linux-gnu run_tests # big-endian architecture of choice
159+
MANY_SEEDS=16 TEST_TARGET=arm-unknown-linux-gnueabi run_tests
160+
MANY_SEEDS=16 TEST_TARGET=s390x-unknown-linux-gnu run_tests # big-endian architecture of choice
161161
# Not officially supported tier 2
162-
TEST_TARGET=x86_64-unknown-illumos run_tests
163-
TEST_TARGET=x86_64-pc-solaris run_tests
162+
MANY_SEEDS=16 TEST_TARGET=mips-unknown-linux-gnu run_tests # a 32bit big-endian target, and also a target without 64bit atomics
163+
MANY_SEEDS=16 TEST_TARGET=x86_64-unknown-illumos run_tests
164+
MANY_SEEDS=16 TEST_TARGET=x86_64-pc-solaris run_tests
164165
# Partially supported targets (tier 2)
165166
BASIC="empty_main integer heap_alloc libc-mem vec string btreemap" # ensures we have the basics: pre-main code, system allocator
166167
UNIX="hello panic/panic panic/unwind concurrency/simple atomic libc-mem libc-misc libc-random env num_cpus" # the things that are very similar across all Unixes, and hence easily supported there

src/tools/miri/tests/fail/concurrency/read_only_atomic_load_large.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//@compile-flags: -Zmiri-disable-stacked-borrows
33
// Needs atomic accesses larger than the pointer size
44
//@ignore-bitwidth: 64
5+
//@ignore-target: mips-
56

67
use std::sync::atomic::{AtomicI64, Ordering};
78

src/tools/miri/tests/panic/transmute_fat2.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ fn main() {
55
let bad = unsafe { std::mem::transmute::<u128, &[u8]>(42 << 64) };
66
#[cfg(all(target_endian = "little", target_pointer_width = "32"))]
77
let bad = unsafe { std::mem::transmute::<u64, &[u8]>(42) };
8+
#[cfg(all(target_endian = "big", target_pointer_width = "32"))]
9+
let bad = unsafe { std::mem::transmute::<u64, &[u8]>(42 << 32) };
810
// This created a slice with length 0, so the following will fail the bounds check.
911
bad[0];
1012
}

src/tools/miri/tests/pass/atomic.rs

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77
#![allow(static_mut_refs)]
88

99
use std::sync::atomic::Ordering::*;
10-
use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicPtr, AtomicU64, compiler_fence, fence};
10+
use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicPtr, AtomicUsize, compiler_fence, fence};
1111

1212
fn main() {
1313
atomic_bool();
1414
atomic_all_ops();
15-
atomic_u64();
1615
atomic_fences();
1716
atomic_ptr();
1817
weak_sometimes_fails();
18+
19+
#[cfg(target_has_atomic = "64")]
20+
atomic_u64();
1921
}
2022

2123
fn atomic_bool() {
@@ -36,25 +38,10 @@ fn atomic_bool() {
3638
}
3739
}
3840

39-
// There isn't a trait to use to make this generic, so just use a macro
40-
macro_rules! compare_exchange_weak_loop {
41-
($atom:expr, $from:expr, $to:expr, $succ_order:expr, $fail_order:expr) => {
42-
loop {
43-
match $atom.compare_exchange_weak($from, $to, $succ_order, $fail_order) {
44-
Ok(n) => {
45-
assert_eq!(n, $from);
46-
break;
47-
}
48-
Err(n) => assert_eq!(n, $from),
49-
}
50-
}
51-
};
52-
}
53-
5441
/// Make sure we can handle all the intrinsics
5542
fn atomic_all_ops() {
5643
static ATOMIC: AtomicIsize = AtomicIsize::new(0);
57-
static ATOMIC_UNSIGNED: AtomicU64 = AtomicU64::new(0);
44+
static ATOMIC_UNSIGNED: AtomicUsize = AtomicUsize::new(0);
5845

5946
let load_orders = [Relaxed, Acquire, SeqCst];
6047
let stored_orders = [Relaxed, Release, SeqCst];
@@ -94,9 +81,26 @@ fn atomic_all_ops() {
9481
}
9582
}
9683

84+
#[cfg(target_has_atomic = "64")]
9785
fn atomic_u64() {
86+
use std::sync::atomic::AtomicU64;
9887
static ATOMIC: AtomicU64 = AtomicU64::new(0);
9988

89+
// There isn't a trait to use to make this generic, so just use a macro
90+
macro_rules! compare_exchange_weak_loop {
91+
($atom:expr, $from:expr, $to:expr, $succ_order:expr, $fail_order:expr) => {
92+
loop {
93+
match $atom.compare_exchange_weak($from, $to, $succ_order, $fail_order) {
94+
Ok(n) => {
95+
assert_eq!(n, $from);
96+
break;
97+
}
98+
Err(n) => assert_eq!(n, $from),
99+
}
100+
}
101+
};
102+
}
103+
100104
ATOMIC.store(1, SeqCst);
101105
assert_eq!(ATOMIC.compare_exchange(0, 0x100, AcqRel, Acquire), Err(1));
102106
assert_eq!(ATOMIC.compare_exchange(0, 1, Release, Relaxed), Err(1));

0 commit comments

Comments
 (0)