Auto merge of #135164 - Kobzol:run-make-test-glibc-symbols, r=jieyouxu

Add test for checking used glibc symbols

This test checks that we do not use too new glibc symbols in the compiler on x64 GNU Linux, in order not to break our [glibc promises](https://blog.rust-lang.org/2022/08/01/Increasing-glibc-kernel-requirements.html).

One thing that isn't solved in the PR yet is to make sure that this test will only run on `dist` CI, more specifically on the `dist-x86_64-linux` runner, in the opt-dist post-optimization tests (it can fail elsewhere, that doesn't matter). Any suggestions on how to do that are welcome.

Fixes: https://github.com/rust-lang/rust/issues/134037

r? `@jieyouxu`
This commit is contained in:
bors 2025-01-23 01:03:32 +00:00
commit 3cd8fcbf87
5 changed files with 129 additions and 1 deletions

View file

@ -152,6 +152,8 @@ Some examples of `X` in `ignore-X` or `only-X`:
`compare-mode-split-dwarf`, `compare-mode-split-dwarf-single`
- The two different test modes used by coverage tests:
`ignore-coverage-map`, `ignore-coverage-run`
- When testing a dist toolchain: `dist`
- This needs to be enabled with `COMPILETEST_ENABLE_DIST_TESTS=1`
The following directives will check rustc build settings and target
settings:

View file

@ -175,6 +175,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
"only-beta",
"only-bpf",
"only-cdb",
"only-dist",
"only-gnu",
"only-i686-pc-windows-gnu",
"only-i686-pc-windows-msvc",

View file

@ -235,6 +235,12 @@ fn parse_cfg_name_directive<'a>(
message: "when the test mode is {name}",
}
condition! {
name: "dist",
condition: std::env::var("COMPILETEST_ENABLE_DIST_TESTS") == Ok("1".to_string()),
message: "when performing tests on dist toolchain"
}
if prefix == "ignore" && outcome == MatchOutcome::Invalid {
// Don't error out for ignore-tidy-* diretives, as those are not handled by compiletest.
if name.starts_with("tidy-") {

View file

@ -69,6 +69,7 @@ change-id = 115898
[rust]
channel = "{channel}"
verbose-tests = true
[build]
rustc = "{rustc}"
@ -102,13 +103,19 @@ llvm-config = "{llvm_config}"
"tests/incremental",
"tests/mir-opt",
"tests/pretty",
"tests/run-make/glibc-symbols-x86_64-unknown-linux-gnu",
"tests/ui",
"tests/crashes",
];
for test_path in env.skipped_tests() {
args.extend(["--skip", test_path]);
}
cmd(&args).env("COMPILETEST_FORCE_STAGE0", "1").run().context("Cannot execute tests")
cmd(&args)
.env("COMPILETEST_FORCE_STAGE0", "1")
// Also run dist-only tests
.env("COMPILETEST_ENABLE_DIST_TESTS", "1")
.run()
.context("Cannot execute tests")
}
/// Tries to find the version of the dist artifacts (either nightly, beta, or 1.XY.Z).