Skip to content

Commit

Permalink
Unrolled build for rust-lang#125215
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#125215 - Oneirical:easy-test-the-second, r=jieyouxu

Migrate `run-make/issue64319` to `rmake` and rename

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).

~~I noticed that the Makefile was not listed in `allowed-run-makefiles` in Tidy. Does this mean the test was being ignored?~~ EDIT: No, it was there, just not in its expected alphabetical order.

EDIT2: Perhaps it could be interesting to clean this test visually by looping over the `rustc` calls, like in rust-lang#125227.
  • Loading branch information
rust-timer authored May 18, 2024
2 parents 9b75a43 + 184be49 commit 6ae3612
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 41 deletions.
6 changes: 6 additions & 0 deletions src/tools/run-make-support/src/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ impl Rustc {
self
}

/// Specify a specific optimization level.
pub fn opt_level(&mut self, option: &str) -> &mut Self {
self.cmd.arg(format!("-Copt-level={option}"));
self
}

/// Specify type(s) of output files to generate.
pub fn emit(&mut self, kinds: &str) -> &mut Self {
self.cmd.arg(format!("--emit={kinds}"));
Expand Down
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ run-make/issue-85401-static-mir/Makefile
run-make/issue-85441/Makefile
run-make/issue-88756-default-output/Makefile
run-make/issue-97463-abi-param-passing/Makefile
run-make/issue64319/Makefile
run-make/jobserver-error/Makefile
run-make/libs-through-symlinks/Makefile
run-make/libtest-json/Makefile
Expand Down
40 changes: 0 additions & 40 deletions tests/run-make/issue64319/Makefile

This file was deleted.

File renamed without changes.
File renamed without changes.
45 changes: 45 additions & 0 deletions tests/run-make/share-generics-export-again/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// When crates had different optimization levels, a bug caused
// incorrect symbol name generations. -Z share-generics could
// also fail to re-export upstream generics on multiple compile
// runs of the same dynamic library.

// This test repeatedly compiles an rlib and a dylib with these flags
// to check if this bug ever returns.

// See /~https://github.com/rust-lang/rust/pull/68277
// See /~https://github.com/rust-lang/rust/issues/64319
//@ ignore-cross-compile

use run_make_support::rustc;

fn main() {
rustc().crate_type("rlib").input("foo.rs").run();
rustc().crate_type("dylib").input("bar.rs").opt_level("3").run();
rustc().crate_type("rlib").input("foo.rs").arg("-Zshare-generics=no").run();
rustc().crate_type("dylib").input("bar.rs").arg("-Zshare-generics=no").run();
rustc().crate_type("rlib").input("foo.rs").arg("-Zshare-generics=no").run();
rustc().crate_type("dylib").input("bar.rs").arg("-Zshare-generics=yes").run();
rustc().crate_type("rlib").input("foo.rs").arg("-Zshare-generics=yes").run();
rustc().crate_type("dylib").input("bar.rs").arg("-Zshare-generics=no").run();
rustc().crate_type("rlib").input("foo.rs").arg("-Zshare-generics=yes").run();
rustc().crate_type("dylib").input("bar.rs").arg("-Zshare-generics=yes").run();
rustc().crate_type("rlib").input("foo.rs").run();
rustc().crate_type("dylib").input("bar.rs").run();
rustc().crate_type("dylib").input("bar.rs").arg("-Zshare-generics=no").run();
rustc().crate_type("dylib").input("bar.rs").arg("-Zshare-generics=yes").run();
rustc().crate_type("dylib").input("bar.rs").opt_level("1").run();
rustc().crate_type("dylib").input("bar.rs").opt_level("1").arg("-Zshare-generics=no").run();
rustc().crate_type("dylib").input("bar.rs").opt_level("1").arg("-Zshare-generics=yes").run();
rustc().crate_type("dylib").input("bar.rs").opt_level("2").run();
rustc().crate_type("dylib").input("bar.rs").opt_level("2").arg("-Zshare-generics=no").run();
rustc().crate_type("dylib").input("bar.rs").opt_level("2").arg("-Zshare-generics=yes").run();
rustc().crate_type("dylib").input("bar.rs").opt_level("3").run();
rustc().crate_type("dylib").input("bar.rs").opt_level("3").arg("-Zshare-generics=no").run();
rustc().crate_type("dylib").input("bar.rs").opt_level("3").arg("-Zshare-generics=yes").run();
rustc().crate_type("dylib").input("bar.rs").opt_level("s").run();
rustc().crate_type("dylib").input("bar.rs").opt_level("s").arg("-Zshare-generics=no").run();
rustc().crate_type("dylib").input("bar.rs").opt_level("s").arg("-Zshare-generics=yes").run();
rustc().crate_type("dylib").input("bar.rs").opt_level("z").run();
rustc().crate_type("dylib").input("bar.rs").opt_level("z").arg("-Zshare-generics=no").run();
rustc().crate_type("dylib").input("bar.rs").opt_level("z").arg("-Zshare-generics=yes").run();
}

0 comments on commit 6ae3612

Please sign in to comment.