Skip to content

run tests on mips-unknown-linux-gnu #4333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions ci/ci.sh
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also added MANY_SEEDS=16 so we have some coverage of those tests on our better-supported tier 2 targets. Let's see what that does to CI times... the macOS runner often is the first runner to finish, but sometimes it is the last to finish.

Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,12 @@ case $HOST_TARGET in
MANY_SEEDS=64 TEST_TARGET=i686-pc-windows-gnu run_tests
MANY_SEEDS=64 TEST_TARGET=x86_64-pc-windows-msvc CARGO_MIRI_ENV=1 run_tests
# Extra tier 2
TEST_TARGET=arm-unknown-linux-gnueabi run_tests
TEST_TARGET=s390x-unknown-linux-gnu run_tests # big-endian architecture of choice
MANY_SEEDS=16 TEST_TARGET=arm-unknown-linux-gnueabi run_tests
MANY_SEEDS=16 TEST_TARGET=s390x-unknown-linux-gnu run_tests # big-endian architecture of choice
# Not officially supported tier 2
TEST_TARGET=x86_64-unknown-illumos run_tests
TEST_TARGET=x86_64-pc-solaris run_tests
MANY_SEEDS=16 TEST_TARGET=mips-unknown-linux-gnu run_tests # a 32bit big-endian target, and also a target without 64bit atomics
MANY_SEEDS=16 TEST_TARGET=x86_64-unknown-illumos run_tests
MANY_SEEDS=16 TEST_TARGET=x86_64-pc-solaris run_tests
# Partially supported targets (tier 2)
BASIC="empty_main integer heap_alloc libc-mem vec string btreemap" # ensures we have the basics: pre-main code, system allocator
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
Expand Down
1 change: 1 addition & 0 deletions tests/fail/concurrency/read_only_atomic_load_large.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//@compile-flags: -Zmiri-disable-stacked-borrows
// Needs atomic accesses larger than the pointer size
//@ignore-bitwidth: 64
//@ignore-target: mips-

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

Expand Down
2 changes: 2 additions & 0 deletions tests/panic/transmute_fat2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ fn main() {
let bad = unsafe { std::mem::transmute::<u128, &[u8]>(42 << 64) };
#[cfg(all(target_endian = "little", target_pointer_width = "32"))]
let bad = unsafe { std::mem::transmute::<u64, &[u8]>(42) };
#[cfg(all(target_endian = "big", target_pointer_width = "32"))]
let bad = unsafe { std::mem::transmute::<u64, &[u8]>(42 << 32) };
// This created a slice with length 0, so the following will fail the bounds check.
bad[0];
}
40 changes: 22 additions & 18 deletions tests/pass/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
#![allow(static_mut_refs)]

use std::sync::atomic::Ordering::*;
use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicPtr, AtomicU64, compiler_fence, fence};
use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicPtr, AtomicUsize, compiler_fence, fence};

fn main() {
atomic_bool();
atomic_all_ops();
atomic_u64();
atomic_fences();
atomic_ptr();
weak_sometimes_fails();

#[cfg(target_has_atomic = "64")]
atomic_u64();
}

fn atomic_bool() {
Expand All @@ -36,25 +38,10 @@ fn atomic_bool() {
}
}

// There isn't a trait to use to make this generic, so just use a macro
macro_rules! compare_exchange_weak_loop {
($atom:expr, $from:expr, $to:expr, $succ_order:expr, $fail_order:expr) => {
loop {
match $atom.compare_exchange_weak($from, $to, $succ_order, $fail_order) {
Ok(n) => {
assert_eq!(n, $from);
break;
}
Err(n) => assert_eq!(n, $from),
}
}
};
}

/// Make sure we can handle all the intrinsics
fn atomic_all_ops() {
static ATOMIC: AtomicIsize = AtomicIsize::new(0);
static ATOMIC_UNSIGNED: AtomicU64 = AtomicU64::new(0);
static ATOMIC_UNSIGNED: AtomicUsize = AtomicUsize::new(0);

let load_orders = [Relaxed, Acquire, SeqCst];
let stored_orders = [Relaxed, Release, SeqCst];
Expand Down Expand Up @@ -94,9 +81,26 @@ fn atomic_all_ops() {
}
}

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

// There isn't a trait to use to make this generic, so just use a macro
macro_rules! compare_exchange_weak_loop {
($atom:expr, $from:expr, $to:expr, $succ_order:expr, $fail_order:expr) => {
loop {
match $atom.compare_exchange_weak($from, $to, $succ_order, $fail_order) {
Ok(n) => {
assert_eq!(n, $from);
break;
}
Err(n) => assert_eq!(n, $from),
}
}
};
}

ATOMIC.store(1, SeqCst);
assert_eq!(ATOMIC.compare_exchange(0, 0x100, AcqRel, Acquire), Err(1));
assert_eq!(ATOMIC.compare_exchange(0, 1, Release, Relaxed), Err(1));
Expand Down