From 0d85ef2857824bf6aa8727f418ee91587de04016 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Thu, 4 Jul 2024 11:37:16 -0400 Subject: [PATCH] rewrite target-without-atomic-cas to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 3 --- tests/run-make/target-cpu-native/rmake.rs | 4 +--- tests/run-make/target-specs/rmake.rs | 2 +- .../run-make/target-without-atomic-cas/Makefile | 5 ----- .../run-make/target-without-atomic-cas/rmake.rs | 16 ++++++++++++++++ 5 files changed, 18 insertions(+), 12 deletions(-) delete mode 100644 tests/run-make/target-without-atomic-cas/Makefile create mode 100644 tests/run-make/target-without-atomic-cas/rmake.rs diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 276d2d694cd..686cc2f9c43 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -162,9 +162,6 @@ run-make/symbol-mangling-hashed/Makefile run-make/symbol-visibility/Makefile run-make/symbols-include-type-name/Makefile run-make/sysroot-crates-are-unstable/Makefile -run-make/target-cpu-native/Makefile -run-make/target-specs/Makefile -run-make/target-without-atomic-cas/Makefile run-make/test-benches/Makefile run-make/test-harness/Makefile run-make/thumb-none-cortex-m/Makefile diff --git a/tests/run-make/target-cpu-native/rmake.rs b/tests/run-make/target-cpu-native/rmake.rs index c5bd0245051..fd5fb6193fe 100644 --- a/tests/run-make/target-cpu-native/rmake.rs +++ b/tests/run-make/target-cpu-native/rmake.rs @@ -3,8 +3,6 @@ // warnings when used, and that binaries produced by it can also be successfully executed. // See https://github.com/rust-lang/rust/pull/23238 -// FIXME(Oneirical): only-linux only-x86_64 - use run_make_support::{run, rustc}; fn main() { @@ -12,5 +10,5 @@ fn main() { run("foo"); // There should be zero warnings emitted - the bug would cause "unknown CPU `native`" // to be printed out. - assert_eq!(out.len(), 0); + assert!(out.is_empty()); } diff --git a/tests/run-make/target-specs/rmake.rs b/tests/run-make/target-specs/rmake.rs index 10c2fa29830..d2b5f650838 100644 --- a/tests/run-make/target-specs/rmake.rs +++ b/tests/run-make/target-specs/rmake.rs @@ -1,6 +1,6 @@ // Target-specific compilation in rustc used to have case-by-case peculiarities in 2014, // with the compiler having redundant target types and unspecific names. An overarching rework -// in #161156 changed the way the target flag functions, and this test attempts compilation +// in #16156 changed the way the target flag functions, and this test attempts compilation // with the target flag's bundle of new features to check that compilation either succeeds while // using them correctly, or fails with the right error message when using them improperly. // See https://github.com/rust-lang/rust/pull/16156 diff --git a/tests/run-make/target-without-atomic-cas/Makefile b/tests/run-make/target-without-atomic-cas/Makefile deleted file mode 100644 index 451f03d66cd..00000000000 --- a/tests/run-make/target-without-atomic-cas/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -# The target used below doesn't support atomic CAS operations. Verify that's the case -all: - $(RUSTC) --print cfg --target thumbv6m-none-eabi | $(CGREP) -v 'target_has_atomic="ptr"' diff --git a/tests/run-make/target-without-atomic-cas/rmake.rs b/tests/run-make/target-without-atomic-cas/rmake.rs new file mode 100644 index 00000000000..c8782b6d1a5 --- /dev/null +++ b/tests/run-make/target-without-atomic-cas/rmake.rs @@ -0,0 +1,16 @@ +// ARM Cortex-M are a class of processors supported by the rust compiler. However, +// they cannot support any atomic features, such as Arc. This test simply prints +// the configuration details of one Cortex target, and checks that the compiler +// does not falsely list atomic support. +// See https://github.com/rust-lang/rust/pull/36874 + +use run_make_support::rustc; + +// The target used below doesn't support atomic CAS operations. Verify that's the case +fn main() { + rustc() + .print("cfg") + .target("thumbv6m-none-eabi") + .run() + .assert_stdout_not_contains(r#"target_has_atomic="ptr""#); +}