forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#127325 - Oneirical:gothic-testhetic, r=jieyouxu Migrate `target-cpu-native`, `target-specs` and `target-without-atomic-cas` `run-make` tests to rmake Part of rust-lang#121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). Please test on i686-msvc. try-job: i686-msvc
- Loading branch information
Showing
7 changed files
with
101 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// target-cpu is a codegen flag that generates code for the processor of the host machine | ||
// running the compilation. This test is a sanity test that this flag does not cause any | ||
// warnings when used, and that binaries produced by it can also be successfully executed. | ||
// See https://github.com/rust-lang/rust/pull/23238 | ||
|
||
use run_make_support::{run, rustc}; | ||
|
||
fn main() { | ||
let out = rustc().input("foo.rs").arg("-Ctarget-cpu=native").run().stderr_utf8(); | ||
run("foo"); | ||
// There should be zero warnings emitted - the bug would cause "unknown CPU `native`" | ||
// to be printed out. | ||
assert!(out.is_empty()); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// 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 #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 | ||
|
||
use run_make_support::{diff, fs_wrapper, rustc}; | ||
|
||
fn main() { | ||
rustc().input("foo.rs").target("my-awesome-platform.json").crate_type("lib").emit("asm").run(); | ||
assert!(!fs_wrapper::read_to_string("foo.s").contains("morestack")); | ||
rustc() | ||
.input("foo.rs") | ||
.target("my-invalid-platform.json") | ||
.run_fail() | ||
.assert_stderr_contains("Error loading target specification"); | ||
rustc() | ||
.input("foo.rs") | ||
.target("my-incomplete-platform.json") | ||
.run_fail() | ||
.assert_stderr_contains("Field llvm-target"); | ||
rustc() | ||
.env("RUST_TARGET_PATH", ".") | ||
.input("foo.rs") | ||
.target("my-awesome-platform") | ||
.crate_type("lib") | ||
.emit("asm") | ||
.run(); | ||
rustc() | ||
.env("RUST_TARGET_PATH", ".") | ||
.input("foo.rs") | ||
.target("my-x86_64-unknown-linux-gnu-platform") | ||
.crate_type("lib") | ||
.emit("asm") | ||
.run(); | ||
let test_platform = rustc() | ||
.arg("-Zunstable-options") | ||
.target("my-awesome-platform.json") | ||
.print("target-spec-json") | ||
.run() | ||
.stdout_utf8(); | ||
fs_wrapper::create_file("test-platform.json"); | ||
fs_wrapper::write("test-platform.json", test_platform.as_bytes()); | ||
let test_platform_2 = rustc() | ||
.arg("-Zunstable-options") | ||
.target("test-platform.json") | ||
.print("target-spec-json") | ||
.run() | ||
.stdout_utf8(); | ||
diff() | ||
.expected_file("test-platform.json") | ||
.actual_text("test-platform-2", test_platform_2) | ||
.run(); | ||
rustc() | ||
.input("foo.rs") | ||
.target("definitely-not-builtin-target") | ||
.run_fail() | ||
.assert_stderr_contains("may not set is_builtin"); | ||
rustc() | ||
.input("foo.rs") | ||
.target("endianness-mismatch") | ||
.run_fail() | ||
.assert_stderr_contains(r#""data-layout" claims architecture is little-endian"#); | ||
rustc() | ||
.input("foo.rs") | ||
.target("mismatching-data-layout") | ||
.crate_type("lib") | ||
.run_fail() | ||
.assert_stderr_contains("data-layout for target"); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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""#); | ||
} |