Skip to content

Commit

Permalink
Auto merge of #126709 - Oneirical:exitestial-crisis, r=<try>
Browse files Browse the repository at this point in the history
Migrate `include_bytes_deps`, `optimization-remarks-dir-pgo`, `optimization-remarks-dir`, `issue-40535` and `rmeta-preferred` `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 BSD tryjob.

try-job: dist-x86_64-freebsd
  • Loading branch information
bors committed Jun 19, 2024
2 parents 5c8459f + 61b9273 commit 617b52f
Show file tree
Hide file tree
Showing 18 changed files with 107 additions and 70 deletions.
5 changes: 0 additions & 5 deletions src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ run-make/forced-unwind-terminate-pof/Makefile
run-make/foreign-double-unwind/Makefile
run-make/foreign-exceptions/Makefile
run-make/foreign-rust-exceptions/Makefile
run-make/include_bytes_deps/Makefile
run-make/incr-add-rust-src-component/Makefile
run-make/incr-foreign-head-span/Makefile
run-make/inline-always-many-cgu/Makefile
Expand All @@ -79,7 +78,6 @@ run-make/issue-33329/Makefile
run-make/issue-35164/Makefile
run-make/issue-36710/Makefile
run-make/issue-37839/Makefile
run-make/issue-40535/Makefile
run-make/issue-47384/Makefile
run-make/issue-47551/Makefile
run-make/issue-68794-textrel-on-minimal-lib/Makefile
Expand Down Expand Up @@ -131,8 +129,6 @@ run-make/no-alloc-shim/Makefile
run-make/no-builtins-attribute/Makefile
run-make/no-duplicate-libs/Makefile
run-make/obey-crate-type-flag/Makefile
run-make/optimization-remarks-dir-pgo/Makefile
run-make/optimization-remarks-dir/Makefile
run-make/output-type-permutations/Makefile
run-make/override-aliased-flags/Makefile
run-make/overwrite-input/Makefile
Expand Down Expand Up @@ -176,7 +172,6 @@ run-make/rlib-chain/Makefile
run-make/rlib-format-packed-bundled-libs-2/Makefile
run-make/rlib-format-packed-bundled-libs-3/Makefile
run-make/rlib-format-packed-bundled-libs/Makefile
run-make/rmeta-preferred/Makefile
run-make/rustc-macro-dep-files/Makefile
run-make/rustdoc-io-error/Makefile
run-make/sanitizer-cdylib-link/Makefile
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions tests/run-make/include-bytes-deps/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// include_bytes! and include_str! in `main.rs`
// should register the included file as of #24423,
// and this test checks that this is still the case.
// See https://github.com/rust-lang/rust/pull/24423

//FIXME(Oneirical): check if works without ignore freebsd

use run_make_support::{invalid_utf8_contains, rustc};

fn main() {
rustc().emit("dep-info").input("main.rs").run();
invalid_utf8_contains("main.d", "input.txt");
invalid_utf8_contains("main.d", "input.bin");
invalid_utf8_contains("main.d", "input.md");
}
7 changes: 0 additions & 7 deletions tests/run-make/include_bytes_deps/Makefile

This file was deleted.

13 changes: 0 additions & 13 deletions tests/run-make/issue-40535/Makefile

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions tests/run-make/metadata-only-crate-no-ice/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// In a dependency hierarchy, metadata-only crates could cause an Internal
// Compiler Error (ICE) due to a compiler bug - not correctly fetching sources for
// metadata-only crates. This test is a minimal reproduction of a program that triggered
// this bug, and checks that no ICE occurs.
// See https://github.com/rust-lang/rust/issues/40535

use run_make_support::rustc;

fn main() {
rustc().input("baz.rs").emit("metadata").run();
rustc().input("bar.rs").emit("metadata").extern_("baz", "libbaz.rmeta").run();
// There should be no internal compiler error message.
rustc()
.input("foo.rs")
.emit("metadata")
.extern_("bar", "libbaz.rmeta")
.run()
.assert_stderr_not_contains("unexpectedly panicked");
}
17 changes: 0 additions & 17 deletions tests/run-make/optimization-remarks-dir-pgo/Makefile

This file was deleted.

29 changes: 29 additions & 0 deletions tests/run-make/optimization-remarks-dir-pgo/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// This test checks the -Zremark-dir flag, which writes LLVM
// optimization remarks to the YAML format. When using PGO (Profile
// Guided Optimization), the Hotness attribute should be included in
// the output remark files.
// See https://github.com/rust-lang/rust/pull/114439

//@ needs-profiler-support
//@ ignore-cross-compile

use run_make_support::{invalid_utf8_contains, llvm_profdata, run, rustc};

fn main() {
rustc().profile_generate("profdata").opt().input("foo.rs").output("foo").run();
run("foo");
llvm_profdata()
.merge()
.output("merged.profdata")
.input("profdata/default_15907418011457399462_0.profraw")
.run();
rustc()
.profile_use("merged.profdata")
.opt()
.input("foo.rs")
.arg("-Cremark=all")
.arg("-Zremark-dir=profiles")
.run();
// Check that PGO hotness is included in the remark files
invalid_utf8_contains("profiles/foo.cba44757bc0621b9-cgu.0.opt.opt.yaml", "Hotness");
}
12 changes: 0 additions & 12 deletions tests/run-make/optimization-remarks-dir/Makefile

This file was deleted.

26 changes: 26 additions & 0 deletions tests/run-make/optimization-remarks-dir/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// In this test, the function `bar` has #[inline(never)] and the function `foo`
// does not. This test outputs LLVM optimization remarks twice - first for all
// functions (including `bar`, and the `inline` mention), and then for only `foo`
// (should not have the `inline` mention).
// See https://github.com/rust-lang/rust/pull/113040

use run_make_support::{invalid_utf8_contains, invalid_utf8_not_contains, rustc};

fn main() {
rustc()
.opt()
.input("foo.rs")
.crate_type("lib")
.arg("-Cremark=all")
.arg("-Zremark-dir=profiles_all")
.run();
invalid_utf8_contains("profiles_all/foo.5be5606e1f6aa79b-cgu.0.opt.opt.yaml", "inline");
rustc()
.opt()
.input("foo.rs")
.crate_type("lib")
.arg("-Cremark=foo")
.arg("-Zremark-dir=profiles_foo")
.run();
invalid_utf8_not_contains("profiles_foo/foo.5be5606e1f6aa79b-cgu.0.opt.opt.yaml", "inline");
}
16 changes: 0 additions & 16 deletions tests/run-make/rmeta-preferred/Makefile

This file was deleted.

18 changes: 18 additions & 0 deletions tests/run-make/rmeta-preferred/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// This test compiles `lib.rs`'s dependency, `rmeta_aux.rs`, as both an rlib
// and an rmeta crate. By default, rustc should give the metadata crate (rmeta)
// precedence over the rust-lib (rlib). This test inspects the contents of the binary
// and that the correct (rmeta) crate was used.
// rlibs being preferred could indicate a resurgence of the -Zbinary-dep-depinfo bug
// seen in #68298.
// See https://github.com/rust-lang/rust/pull/37681

//@ ignore-cross-compile

use run_make_support::{invalid_utf8_contains, invalid_utf8_not_contains, rustc};

fn main() {
rustc().input("rmeta_aux.rs").crate_type("rlib").emit("link,metadata").run();
rustc().input("lib.rs").crate_type("rlib").emit("dep-info").arg("-Zbinary-dep-depinfo").run();
invalid_utf8_contains("lib.d", "librmeta_aux.rmeta");
invalid_utf8_not_contains("lib.d", "librmeta_aux.rlib");
}

0 comments on commit 617b52f

Please sign in to comment.