From ef9349db86dcbbe705aaf40a2f5dcb1dd9c9063e Mon Sep 17 00:00:00 2001 From: Jakub Beránek Date: Mon, 6 Jan 2025 17:23:28 +0100 Subject: Add test for checking used glibc symbols --- src/tools/compiletest/src/directive-list.rs | 1 + src/tools/compiletest/src/header.rs | 2 +- src/tools/compiletest/src/header/cfg.rs | 6 ++++++ src/tools/opt-dist/src/tests.rs | 7 ++++++- 4 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src/tools') diff --git a/src/tools/compiletest/src/directive-list.rs b/src/tools/compiletest/src/directive-list.rs index 01068af3e8c..5784cd83119 100644 --- a/src/tools/compiletest/src/directive-list.rs +++ b/src/tools/compiletest/src/directive-list.rs @@ -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", diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 8c96554738e..82925f54a16 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -1280,7 +1280,7 @@ pub fn llvm_has_libzstd(config: &Config) -> bool { let stderr = String::from_utf8(output.stderr).ok()?; let zstd_available = !stderr.contains("LLVM was not built with LLVM_ENABLE_ZSTD"); - // We don't particularly need to clean the link up (so the previous commands could fail + // We don't partiCOMPILETEST_ENABLE_OPT_DIST_TESTScularly need to clean the link up (so the previous commands could fail // in theory but won't in practice), but we can try. std::fs::remove_file(lld_symlink_path).ok()?; diff --git a/src/tools/compiletest/src/header/cfg.rs b/src/tools/compiletest/src/header/cfg.rs index 3f7225195ce..6e5ced17c20 100644 --- a/src/tools/compiletest/src/header/cfg.rs +++ b/src/tools/compiletest/src/header/cfg.rs @@ -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-") { diff --git a/src/tools/opt-dist/src/tests.rs b/src/tools/opt-dist/src/tests.rs index 06ed076a864..2dd116a5f86 100644 --- a/src/tools/opt-dist/src/tests.rs +++ b/src/tools/opt-dist/src/tests.rs @@ -108,7 +108,12 @@ llvm-config = "{llvm_config}" 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). -- cgit 1.4.1-3-g733a5 From 75f8cc6ab651558a37d78b45deddf6ee8f526c80 Mon Sep 17 00:00:00 2001 From: Jakub Beránek Date: Tue, 21 Jan 2025 10:19:04 +0100 Subject: Enable verbose tests in opt-dist tests --- src/tools/opt-dist/src/tests.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'src/tools') diff --git a/src/tools/opt-dist/src/tests.rs b/src/tools/opt-dist/src/tests.rs index 2dd116a5f86..00861f0c659 100644 --- a/src/tools/opt-dist/src/tests.rs +++ b/src/tools/opt-dist/src/tests.rs @@ -69,6 +69,7 @@ change-id = 115898 [rust] channel = "{channel}" +verbose-tests = true [build] rustc = "{rustc}" -- cgit 1.4.1-3-g733a5 From 7877883339e96577701344bd68a80470e1be22aa Mon Sep 17 00:00:00 2001 From: Jakub Beránek Date: Tue, 21 Jan 2025 12:36:59 +0100 Subject: Run the glibc run-make test in opt-dist --- src/tools/compiletest/src/header.rs | 2 +- src/tools/opt-dist/src/tests.rs | 1 + tests/run-make/glibc-symbols-x86_64-unknown-linux-gnu/rmake.rs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/tools') diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 82925f54a16..8c96554738e 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -1280,7 +1280,7 @@ pub fn llvm_has_libzstd(config: &Config) -> bool { let stderr = String::from_utf8(output.stderr).ok()?; let zstd_available = !stderr.contains("LLVM was not built with LLVM_ENABLE_ZSTD"); - // We don't partiCOMPILETEST_ENABLE_OPT_DIST_TESTScularly need to clean the link up (so the previous commands could fail + // We don't particularly need to clean the link up (so the previous commands could fail // in theory but won't in practice), but we can try. std::fs::remove_file(lld_symlink_path).ok()?; diff --git a/src/tools/opt-dist/src/tests.rs b/src/tools/opt-dist/src/tests.rs index 00861f0c659..8b3bd77141b 100644 --- a/src/tools/opt-dist/src/tests.rs +++ b/src/tools/opt-dist/src/tests.rs @@ -103,6 +103,7 @@ 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", ]; diff --git a/tests/run-make/glibc-symbols-x86_64-unknown-linux-gnu/rmake.rs b/tests/run-make/glibc-symbols-x86_64-unknown-linux-gnu/rmake.rs index ec693ca793c..76acf93c055 100644 --- a/tests/run-make/glibc-symbols-x86_64-unknown-linux-gnu/rmake.rs +++ b/tests/run-make/glibc-symbols-x86_64-unknown-linux-gnu/rmake.rs @@ -81,7 +81,7 @@ fn get_glibc_symbols(file: &Path) -> Vec { // Uses llvm-objdump, because implementing this using the `object` crate is quite complicated. llvm_objdump() - .arg("-T") + .arg("--dynamic-syms") .arg(file) .run() .stdout_utf8() -- cgit 1.4.1-3-g733a5