forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
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 rust-lang#126208 - Oneirical:one-flew-over-the-cuckoo's…
…-test, r=jieyouxu Migrate `compiler-lookup-paths`, `dump-mono-stats` and `prune-link-args` `run-make` tests to `rmake` or `ui` format 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). try-job: x86_64-msvc try-job: aarch64-apple try-job: dist-x86_64-linux try-job: armhf-gnu
- Loading branch information
Showing
14 changed files
with
206 additions
and
91 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// Since #19941, rustc can accept specifications on its library search paths. | ||
// This test runs Rust programs with varied library dependencies, expecting them | ||
// to succeed or fail depending on the situation. | ||
// The second part of the tests also checks that libraries with an incorrect hash | ||
// fail to be used by the compiler. | ||
// See https://github.com/rust-lang/rust/pull/19941 | ||
|
||
//@ ignore-wasm32 | ||
//@ ignore-wasm64 | ||
// Reason: a C compiler is required for build_native_static_lib | ||
|
||
use run_make_support::{build_native_static_lib, fs_wrapper, rustc, static_lib_name}; | ||
|
||
fn main() { | ||
build_native_static_lib("native"); | ||
let lib_native = static_lib_name("native"); | ||
fs_wrapper::create_dir_all("crate"); | ||
fs_wrapper::create_dir_all("native"); | ||
fs_wrapper::rename(&lib_native, format!("native/{}", &lib_native)); | ||
rustc().input("a.rs").run(); | ||
fs_wrapper::rename("liba.rlib", "crate/liba.rlib"); | ||
rustc().input("b.rs").specific_library_search_path("native", "crate").run_fail(); | ||
rustc().input("b.rs").specific_library_search_path("dependency", "crate").run_fail(); | ||
rustc().input("b.rs").specific_library_search_path("crate", "crate").run(); | ||
rustc().input("b.rs").specific_library_search_path("all", "crate").run(); | ||
|
||
rustc().input("c.rs").specific_library_search_path("native", "crate").run_fail(); | ||
rustc().input("c.rs").specific_library_search_path("crate", "crate").run_fail(); | ||
rustc().input("c.rs").specific_library_search_path("dependency", "crate").run(); | ||
rustc().input("c.rs").specific_library_search_path("all", "crate").run(); | ||
|
||
rustc().input("d.rs").specific_library_search_path("dependency", "native").run_fail(); | ||
rustc().input("d.rs").specific_library_search_path("crate", "native").run_fail(); | ||
rustc().input("d.rs").specific_library_search_path("native", "native").run(); | ||
rustc().input("d.rs").specific_library_search_path("all", "native").run(); | ||
|
||
// Deduplication tests. | ||
fs_wrapper::create_dir_all("e1"); | ||
fs_wrapper::create_dir_all("e2"); | ||
|
||
rustc().input("e.rs").output("e1/libe.rlib").run(); | ||
rustc().input("e.rs").output("e2/libe.rlib").run(); | ||
// If the library hash is correct, compilation should succeed. | ||
rustc().input("f.rs").library_search_path("e1").library_search_path("e2").run(); | ||
rustc() | ||
.input("f.rs") | ||
.specific_library_search_path("crate", "e1") | ||
.library_search_path("e2") | ||
.run(); | ||
rustc() | ||
.input("f.rs") | ||
.specific_library_search_path("crate", "e1") | ||
.specific_library_search_path("crate", "e2") | ||
.run(); | ||
// If the library has a different hash, errors should occur. | ||
rustc().input("e2.rs").output("e2/libe.rlib").run(); | ||
rustc().input("f.rs").library_search_path("e1").library_search_path("e2").run_fail(); | ||
rustc() | ||
.input("f.rs") | ||
.specific_library_search_path("crate", "e1") | ||
.library_search_path("e2") | ||
.run_fail(); | ||
rustc() | ||
.input("f.rs") | ||
.specific_library_search_path("crate", "e1") | ||
.specific_library_search_path("crate", "e2") | ||
.run_fail(); | ||
// Native and dependency paths do not cause errors. | ||
rustc() | ||
.input("f.rs") | ||
.specific_library_search_path("native", "e1") | ||
.library_search_path("e2") | ||
.run(); | ||
rustc() | ||
.input("f.rs") | ||
.specific_library_search_path("dependency", "e1") | ||
.library_search_path("e2") | ||
.run(); | ||
rustc() | ||
.input("f.rs") | ||
.specific_library_search_path("dependency", "e1") | ||
.specific_library_search_path("crate", "e2") | ||
.run(); | ||
} |
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,17 @@ | ||
// A flag named dump-mono-stats was added to the compiler in 2022, which | ||
// collects stats on instantiation of items and their associated costs. | ||
// This test checks that the output stat file exists, and that it contains | ||
// a specific expected string. | ||
// See https://github.com/rust-lang/rust/pull/105481 | ||
|
||
use run_make_support::{cwd, fs_wrapper, rustc}; | ||
|
||
fn main() { | ||
rustc() | ||
.crate_type("lib") | ||
.input("foo.rs") | ||
.arg(format!("-Zdump-mono-stats={}", cwd().display())) | ||
.arg("-Zdump-mono-stats-format=json") | ||
.run(); | ||
assert!(fs_wrapper::read_to_string("foo.mono_items.json").contains(r#""name":"bar""#)); | ||
} |
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 |
---|---|---|
@@ -1,8 +1,14 @@ | ||
// When the metadata format changes, old libraries used to cause librustc to abort | ||
// when reading their metadata. The error message for this scenario was unhelpful at best. | ||
// A better error message was implemented in #12645, and this test checks that it is the | ||
// one appearing in stderr in this scenario. | ||
// See https://github.com/rust-lang/rust/pull/12645 | ||
|
||
use run_make_support::fs_wrapper::create_file; | ||
use run_make_support::{ar, rustc}; | ||
use run_make_support::{llvm_ar, rustc}; | ||
|
||
fn main() { | ||
create_file("lib.rmeta"); | ||
ar(&["lib.rmeta"], "libfoo-ffffffff-1.0.rlib"); | ||
llvm_ar().obj_to_ar().output_input("libfoo-ffffffff-1.0.rlib", "lib.rmeta").run(); | ||
rustc().input("foo.rs").run_fail().assert_stderr_contains("found invalid metadata"); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.