Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run coretests and alloctests with cg_clif in CI #139213

Merged
merged 3 commits into from
Apr 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 28 additions & 21 deletions compiler/rustc_codegen_cranelift/build_system/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,34 @@ const BASE_SYSROOT_SUITE: &[TestCase] = &[
runner.run_out_command("gen_block_iterate", &[]);
}),
TestCase::build_bin_and_run("aot.raw-dylib", "example/raw-dylib.rs", &[]),
TestCase::custom("test.sysroot", &|runner| {
apply_patches(
&runner.dirs,
"sysroot_tests",
&runner.stdlib_source.join("library"),
&SYSROOT_TESTS_SRC.to_path(&runner.dirs),
);

SYSROOT_TESTS.clean(&runner.dirs);

let mut target_compiler = runner.target_compiler.clone();
// coretests and alloctests produce a bunch of warnings. When running
// in rust's CI warnings are denied, so we have to override that here.
target_compiler.rustflags.push("--cap-lints=allow".to_owned());
// The standard library may have been compiled with -Zrandomize-layout.
target_compiler.rustflags.extend(["--cfg".to_owned(), "randomized_layouts".to_owned()]);

if runner.is_native {
let mut test_cmd = SYSROOT_TESTS.test(&target_compiler, &runner.dirs);
test_cmd.args(["-p", "coretests", "-p", "alloctests", "--tests", "--", "-q"]);
spawn_and_wait(test_cmd);
} else {
eprintln!("Cross-Compiling: Not running tests");
let mut build_cmd = SYSROOT_TESTS.build(&target_compiler, &runner.dirs);
build_cmd.args(["-p", "coretests", "-p", "alloctests", "--tests"]);
spawn_and_wait(build_cmd);
}
}),
];

pub(crate) static RAND_REPO: GitRepo = GitRepo::github(
Expand Down Expand Up @@ -146,27 +174,6 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
spawn_and_wait(build_cmd);
}
}),
TestCase::custom("test.sysroot", &|runner| {
apply_patches(
&runner.dirs,
"sysroot_tests",
&runner.stdlib_source.join("library"),
&SYSROOT_TESTS_SRC.to_path(&runner.dirs),
);

SYSROOT_TESTS.clean(&runner.dirs);

if runner.is_native {
let mut test_cmd = SYSROOT_TESTS.test(&runner.target_compiler, &runner.dirs);
test_cmd.args(["-p", "coretests", "-p", "alloctests", "--", "-q"]);
spawn_and_wait(test_cmd);
} else {
eprintln!("Cross-Compiling: Not running tests");
let mut build_cmd = SYSROOT_TESTS.build(&runner.target_compiler, &runner.dirs);
build_cmd.args(["-p", "coretests", "-p", "alloctests", "--tests"]);
spawn_and_wait(build_cmd);
}
}),
TestCase::custom("test.regex", &|runner| {
REGEX_REPO.patch(&runner.dirs);

Expand Down
6 changes: 5 additions & 1 deletion compiler/rustc_codegen_cranelift/build_system/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ impl CargoProject {
.arg(self.manifest_path(dirs))
.arg("--target-dir")
.arg(self.target_dir(dirs))
.arg("--locked");
.arg("--locked")
// bootstrap sets both RUSTC and RUSTC_WRAPPER to the same wrapper. RUSTC is already
// respected by the rustc-clif wrapper, but RUSTC_WRAPPER will misinterpret rustc-clif
// as filename, so we need to unset it.
.env_remove("RUSTC_WRAPPER");

if dirs.frozen {
cmd.arg("--frozen");
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ aot.issue-59326
aot.neon
aot.gen_block_iterate
aot.raw-dylib
test.sysroot

testsuite.extended_sysroot
test.rust-random/rand
test.sysroot
test.regex
test.portable-simd
1 change: 0 additions & 1 deletion library/alloc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,4 @@ check-cfg = [
'cfg(no_global_oom_handling)',
'cfg(no_rc)',
'cfg(no_sync)',
'cfg(randomized_layouts)',
]
1 change: 1 addition & 0 deletions library/coretests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ edition = "2024"
path = "lib.rs"
test = false
bench = false
doc = false

[[test]]
name = "coretests"
Expand Down
Loading