-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #126801 - Oneirical:seek-and-testroy, r=<try>
Migrate `remap-path-prefix`, `debug-assertions` and `emit-stack-sizes` `run-make` tests to rmake Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). Needs OSX/MSVC try jobs. try-job: aarch64-apple try-job: x86_64-msvc
- Loading branch information
Showing
12 changed files
with
167 additions
and
78 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 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 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 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 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
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,37 @@ | ||
// debug.rs contains some "debug assertion" statements which | ||
// should only be enabled in either non-optimized builds or when | ||
// `-C debug-assertions` is set to yes. These debug assertions | ||
// are guaranteed to fail, so this test checks that the run command | ||
// fails where debug assertions should be activated, and succeeds where | ||
// debug assertions should be disabled. | ||
// See https://github.com/rust-lang/rust/pull/22980 | ||
|
||
//@ ignore-cross-compile | ||
//@ needs-unwind | ||
|
||
use run_make_support::{run, run_fail, rustc}; | ||
|
||
fn main() { | ||
rustc().input("debug.rs").arg("-Cdebug-assertions=no").run(); | ||
run("debug"); | ||
rustc().input("debug.rs").opt_level("0").run(); | ||
run_fail("debug"); | ||
rustc().input("debug.rs").opt_level("1").run(); | ||
run("debug"); | ||
rustc().input("debug.rs").opt_level("2").run(); | ||
run("debug"); | ||
rustc().input("debug.rs").opt_level("3").run(); | ||
run("debug"); | ||
rustc().input("debug.rs").opt_level("s").run(); | ||
run("debug"); | ||
rustc().input("debug.rs").opt_level("z").run(); | ||
run("debug"); | ||
rustc().input("debug.rs").opt().run(); | ||
run("debug"); | ||
rustc().input("debug.rs").run(); | ||
run_fail("debug"); | ||
rustc().input("debug.rs").opt().arg("-Cdebug-assertions=yes").run(); | ||
run_fail("debug"); | ||
rustc().input("debug.rs").opt_level("1").arg("-Cdebug-assertions=yes").run(); | ||
run_fail("debug"); | ||
} |
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,23 @@ | ||
// Running rustc with the -Z emit-stack-sizes | ||
// flag enables diagnostics to seek stack overflows | ||
// at compile time. This test compiles a rust file | ||
// with this flag, then checks that the output object | ||
// file contains the section "stack_sizes", where | ||
// this diagnostics information should be located. | ||
// See https://github.com/rust-lang/rust/pull/51946 | ||
|
||
//@ ignore-windows | ||
//@ ignore-apple | ||
// Reason: this feature only works when the output object format is ELF. | ||
// This won't be the case on Windows/OSX - for example, OSX produces a Mach-O binary. | ||
|
||
use run_make_support::{llvm_readobj, rustc}; | ||
|
||
fn main() { | ||
rustc().opt_level("3").arg("-Zemit-stack-sizes").emit("obj").input("foo.rs").run(); | ||
llvm_readobj() | ||
.arg("--section-headers") | ||
.input("foo.o") | ||
.run() | ||
.assert_stdout_contains(".stack_sizes"); | ||
} |
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,89 @@ | ||
// Generating metadata alongside remap-path-prefix would fail to actually remap the path | ||
// in the metadata. After this was fixed in #85344, this test checks that "auxiliary" is being | ||
// successfully remapped to "/the/aux" in the rmeta files. | ||
// See https://github.com/rust-lang/rust/pull/85344 | ||
|
||
// FIXME(Oneirical): check if works without ignore-windows | ||
|
||
use run_make_support::bstr::ByteSlice; | ||
use run_make_support::{bstr, fs_wrapper, is_darwin, rustc}; | ||
|
||
fn main() { | ||
let mut out_simple = rustc(); | ||
let mut out_object = rustc(); | ||
let mut out_macro = rustc(); | ||
let mut out_diagobj = rustc(); | ||
out_simple | ||
.remap_path_prefix("auxiliary", "/the/aux") | ||
.crate_type("lib") | ||
.emit("metadata") | ||
.input("auxiliary/lib.rs"); | ||
out_object | ||
.remap_path_prefix("auxiliary", "/the/aux") | ||
.crate_type("lib") | ||
.emit("metadata") | ||
.input("auxiliary/lib.rs"); | ||
out_macro | ||
.remap_path_prefix("auxiliary", "/the/aux") | ||
.crate_type("lib") | ||
.emit("metadata") | ||
.input("auxiliary/lib.rs"); | ||
out_diagobj | ||
.remap_path_prefix("auxiliary", "/the/aux") | ||
.crate_type("lib") | ||
.emit("metadata") | ||
.input("auxiliary/lib.rs"); | ||
|
||
out_simple.run(); | ||
rmeta_contains("/the/aux/lib.rs"); | ||
rmeta_not_contains("auxiliary"); | ||
|
||
out_object.arg("-Zremap-path-scope=object"); | ||
out_macro.arg("-Zremap-path-scope=macro"); | ||
out_diagobj.arg("-Zremap-path-scope=diagnostics,object"); | ||
if is_darwin() { | ||
out_object.arg("-Csplit-debuginfo=off"); | ||
out_macro.arg("-Csplit-debuginfo=off"); | ||
out_diagobj.arg("-Csplit-debuginfo=off"); | ||
} | ||
|
||
out_object.run(); | ||
rmeta_contains("/the/aux/lib.rs"); | ||
rmeta_not_contains("auxiliary"); | ||
out_macro.run(); | ||
rmeta_contains("/the/aux/lib.rs"); | ||
rmeta_not_contains("auxiliary"); | ||
out_diagobj.run(); | ||
rmeta_contains("/the/aux/lib.rs"); | ||
rmeta_not_contains("auxiliary"); | ||
} | ||
|
||
//FIXME(Oneirical): These could be generalized into run_make_support | ||
// helper functions. | ||
fn rmeta_contains(expected: &str) { | ||
// Normalize to account for path differences in Windows. | ||
if !bstr::BString::from(fs_wrapper::read("liblib.rmeta")) | ||
.replace(b"\\", b"/") | ||
.contains_str(expected) | ||
{ | ||
eprintln!("=== FILE CONTENTS (LOSSY) ==="); | ||
eprintln!("{}", String::from_utf8_lossy(&fs_wrapper::read("liblib.rmeta"))); | ||
eprintln!("=== SPECIFIED TEXT ==="); | ||
eprintln!("{}", expected); | ||
panic!("specified text was not found in file"); | ||
} | ||
} | ||
|
||
fn rmeta_not_contains(expected: &str) { | ||
// Normalize to account for path differences in Windows. | ||
if bstr::BString::from(fs_wrapper::read("liblib.rmeta")) | ||
.replace(b"\\", b"/") | ||
.contains_str(expected) | ||
{ | ||
eprintln!("=== FILE CONTENTS (LOSSY) ==="); | ||
eprintln!("{}", String::from_utf8_lossy(&fs_wrapper::read("liblib.rmeta"))); | ||
eprintln!("=== SPECIFIED TEXT ==="); | ||
eprintln!("{}", expected); | ||
panic!("specified text was not found in file"); | ||
} | ||
} |