about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2023-09-10 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2023-09-21 12:24:38 +0200
commit34c248d31f8351e33e597abcea2a3bffff653a4d (patch)
tree45ad341622e15c12b78efafac24cd28a8a883ed8
parent64e27cb4d9eb41928ca959a616e06d2e9c4c3fdb (diff)
downloadrust-34c248d31f8351e33e597abcea2a3bffff653a4d.tar.gz
rust-34c248d31f8351e33e597abcea2a3bffff653a4d.zip
compiletest: load supports-xray from target spec
-rw-r--r--src/tools/compiletest/src/common.rs2
-rw-r--r--src/tools/compiletest/src/header/needs.rs3
-rw-r--r--src/tools/compiletest/src/util.rs13
3 files changed, 3 insertions, 15 deletions
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs
index ee17953f96f..ba273489eb8 100644
--- a/src/tools/compiletest/src/common.rs
+++ b/src/tools/compiletest/src/common.rs
@@ -578,6 +578,8 @@ pub struct TargetCfg {
     pub(crate) dynamic_linking: bool,
     #[serde(rename = "supported-sanitizers", default)]
     pub(crate) sanitizers: Vec<Sanitizer>,
+    #[serde(rename = "supports-xray", default)]
+    pub(crate) xray: bool,
 }
 
 impl TargetCfg {
diff --git a/src/tools/compiletest/src/header/needs.rs b/src/tools/compiletest/src/header/needs.rs
index cb04b6f756f..1113721fff6 100644
--- a/src/tools/compiletest/src/header/needs.rs
+++ b/src/tools/compiletest/src/header/needs.rs
@@ -1,6 +1,5 @@
 use crate::common::{Config, Debugger, Sanitizer};
 use crate::header::IgnoreDecision;
-use crate::util;
 
 pub(super) fn handle_needs(
     cache: &CachedNeedsConditions,
@@ -235,7 +234,7 @@ impl CachedNeedsConditions {
             sanitizer_shadow_call_stack: sanitizers.contains(&Sanitizer::ShadowCallStack),
             sanitizer_safestack: sanitizers.contains(&Sanitizer::Safestack),
             profiler_support: std::env::var_os("RUSTC_PROFILER_SUPPORT").is_some(),
-            xray: util::XRAY_SUPPORTED_TARGETS.contains(target),
+            xray: config.target_cfg().xray,
 
             // 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.
diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs
index 7a5cab4f68b..8f9425eb071 100644
--- a/src/tools/compiletest/src/util.rs
+++ b/src/tools/compiletest/src/util.rs
@@ -9,19 +9,6 @@ use tracing::*;
 #[cfg(test)]
 mod tests;
 
-pub const XRAY_SUPPORTED_TARGETS: &[&str] = &[
-    "aarch64-linux-android",
-    "aarch64-unknown-linux-gnu",
-    "aarch64-unknown-linux-musl",
-    "x86_64-linux-android",
-    "x86_64-unknown-freebsd",
-    "x86_64-unknown-linux-gnu",
-    "x86_64-unknown-linux-musl",
-    "x86_64-unknown-netbsd",
-    "x86_64-unknown-none-linuxkernel",
-    "x86_64-unknown-openbsd",
-];
-
 pub fn make_new_path(path: &str) -> String {
     assert!(cfg!(windows));
     // Windows just uses PATH as the library search path, so we have to