summaryrefslogtreecommitdiffstats
path: root/src/tools/compiletest/src/header.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tools/compiletest/src/header.rs49
1 files changed, 40 insertions, 9 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index f8f193ddf..3ff1cbf20 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -661,17 +661,36 @@ impl Config {
let name = line[prefix.len() + 1..].split(&[':', ' '][..]).next().unwrap();
+ let matches_pointer_width = || {
+ name.strip_suffix("bit")
+ .and_then(|width| width.parse::<u32>().ok())
+ .map(|width| self.get_pointer_width() == width)
+ .unwrap_or(false)
+ };
+
+ // If something is ignored for emscripten, it likely also needs to be
+ // ignored for wasm32-unknown-unknown.
+ // `wasm32-bare` is an alias to refer to just wasm32-unknown-unknown
+ // (in contrast to `wasm32` which also matches non-bare targets like
+ // asmjs-unknown-emscripten).
+ let matches_wasm32_alias = || {
+ self.target == "wasm32-unknown-unknown" && matches!(name, "emscripten" | "wasm32-bare")
+ };
+
let is_match = name == "test" ||
self.target == name || // triple
- util::matches_os(&self.target, name) || // target
- util::matches_env(&self.target, name) || // env
+ self.matches_os(name) ||
+ self.matches_env(name) ||
+ self.matches_abi(name) ||
+ self.matches_family(name) ||
self.target.ends_with(name) || // target and env
- name == util::get_arch(&self.target) || // architecture
- name == util::get_pointer_width(&self.target) || // pointer width
+ self.matches_arch(name) ||
+ matches_wasm32_alias() ||
+ matches_pointer_width() ||
name == self.stage_id.split('-').next().unwrap() || // stage
name == self.channel || // channel
(self.target != self.host && name == "cross-compile") ||
- (name == "endian-big" && util::is_big_endian(&self.target)) ||
+ (name == "endian-big" && self.is_big_endian()) ||
(self.remote_test_client.is_some() && name == "remote") ||
match self.compare_mode {
Some(CompareMode::Polonius) => name == "compare-mode-polonius",
@@ -869,7 +888,7 @@ pub fn make_test_description<R: Read>(
let rustc_has_profiler_support = env::var_os("RUSTC_PROFILER_SUPPORT").is_some();
let rustc_has_sanitizer_support = env::var_os("RUSTC_SANITIZER_SUPPORT").is_some();
- let has_asm_support = util::has_asm_support(&config.target);
+ let has_asm_support = config.has_asm_support();
let has_asan = util::ASAN_SUPPORTED_TARGETS.contains(&&*config.target);
let has_cfi = util::CFI_SUPPORTED_TARGETS.contains(&&*config.target);
let has_lsan = util::LSAN_SUPPORTED_TARGETS.contains(&&*config.target);
@@ -878,15 +897,27 @@ pub fn make_test_description<R: Read>(
let has_hwasan = util::HWASAN_SUPPORTED_TARGETS.contains(&&*config.target);
let has_memtag = util::MEMTAG_SUPPORTED_TARGETS.contains(&&*config.target);
let has_shadow_call_stack = util::SHADOWCALLSTACK_SUPPORTED_TARGETS.contains(&&*config.target);
- // for `-Z gcc-ld=lld`
+
+ // For tests using the `needs-rust-lld` directive (e.g. for `-Zgcc-ld=lld`), we need to find
+ // whether `rust-lld` is present in the compiler under test.
+ //
+ // The --compile-lib-path is the path to host shared libraries, but depends on the OS. For
+ // example:
+ // - on linux, it can be <sysroot>/lib
+ // - on windows, it can be <sysroot>/bin
+ //
+ // However, `rust-lld` is only located under the lib path, so we look for it there.
let has_rust_lld = config
.compile_lib_path
+ .parent()
+ .expect("couldn't traverse to the parent of the specified --compile-lib-path")
+ .join("lib")
.join("rustlib")
.join(&config.target)
.join("bin")
- .join("gcc-ld")
- .join(if config.host.contains("windows") { "ld.exe" } else { "ld" })
+ .join(if config.host.contains("windows") { "rust-lld.exe" } else { "rust-lld" })
.exists();
+
iter_header(path, src, &mut |revision, ln| {
if revision.is_some() && revision != cfg {
return;