summaryrefslogtreecommitdiffstats
path: root/src/tools/compiletest/src
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/compiletest/src')
-rw-r--r--src/tools/compiletest/src/common.rs6
-rw-r--r--src/tools/compiletest/src/errors.rs8
-rw-r--r--src/tools/compiletest/src/header.rs87
-rw-r--r--src/tools/compiletest/src/main.rs57
-rw-r--r--src/tools/compiletest/src/runtest.rs87
-rw-r--r--src/tools/compiletest/src/util.rs37
6 files changed, 197 insertions, 85 deletions
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs
index a5f5eb447..7fe2e6257 100644
--- a/src/tools/compiletest/src/common.rs
+++ b/src/tools/compiletest/src/common.rs
@@ -123,6 +123,7 @@ pub enum FailMode {
pub enum CompareMode {
Polonius,
Chalk,
+ NextSolver,
SplitDwarf,
SplitDwarfSingle,
}
@@ -132,6 +133,7 @@ impl CompareMode {
match *self {
CompareMode::Polonius => "polonius",
CompareMode::Chalk => "chalk",
+ CompareMode::NextSolver => "next-solver",
CompareMode::SplitDwarf => "split-dwarf",
CompareMode::SplitDwarfSingle => "split-dwarf-single",
}
@@ -141,6 +143,7 @@ impl CompareMode {
match s.as_str() {
"polonius" => CompareMode::Polonius,
"chalk" => CompareMode::Chalk,
+ "next-solver" => CompareMode::NextSolver,
"split-dwarf" => CompareMode::SplitDwarf,
"split-dwarf-single" => CompareMode::SplitDwarfSingle,
x => panic!("unknown --compare-mode option: {}", x),
@@ -377,6 +380,9 @@ pub struct Config {
/// Whether to rerun tests even if the inputs are unchanged.
pub force_rerun: bool,
+ /// Only rerun the tests that result has been modified accoring to Git status
+ pub only_modified: bool,
+
pub target_cfg: LazyCell<TargetCfg>,
}
diff --git a/src/tools/compiletest/src/errors.rs b/src/tools/compiletest/src/errors.rs
index 054235ec1..c33e66e02 100644
--- a/src/tools/compiletest/src/errors.rs
+++ b/src/tools/compiletest/src/errors.rs
@@ -7,7 +7,7 @@ use std::io::BufReader;
use std::path::Path;
use std::str::FromStr;
-use lazy_static::lazy_static;
+use once_cell::sync::Lazy;
use regex::Regex;
use tracing::*;
@@ -117,10 +117,8 @@ fn parse_expected(
// //~^^^^^
// //[cfg1]~
// //[cfg1,cfg2]~^^
- lazy_static! {
- static ref RE: Regex =
- Regex::new(r"//(?:\[(?P<cfgs>[\w,]+)])?~(?P<adjust>\||\^*)").unwrap();
- }
+ static RE: Lazy<Regex> =
+ Lazy::new(|| Regex::new(r"//(?:\[(?P<cfgs>[\w,]+)])?~(?P<adjust>\||\^*)").unwrap());
let captures = RE.captures(line)?;
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index 423299495..d9b39927c 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -710,6 +710,7 @@ impl Config {
match self.compare_mode {
Some(CompareMode::Polonius) => name == "compare-mode-polonius",
Some(CompareMode::Chalk) => name == "compare-mode-chalk",
+ Some(CompareMode::NextSolver) => name == "compare-mode-next-solver",
Some(CompareMode::SplitDwarf) => name == "compare-mode-split-dwarf",
Some(CompareMode::SplitDwarfSingle) => name == "compare-mode-split-dwarf-single",
None => false,
@@ -925,7 +926,7 @@ pub fn make_test_description<R: Read>(
cfg: Option<&str>,
) -> test::TestDesc {
let mut ignore = false;
- let ignore_message = None;
+ let mut ignore_message = None;
let mut should_fail = false;
let rustc_has_profiler_support = env::var_os("RUSTC_PROFILER_SUPPORT").is_some();
@@ -934,12 +935,14 @@ pub fn make_test_description<R: Read>(
let has_asan = util::ASAN_SUPPORTED_TARGETS.contains(&&*config.target);
let has_cfi = util::CFI_SUPPORTED_TARGETS.contains(&&*config.target);
let has_kcfi = util::KCFI_SUPPORTED_TARGETS.contains(&&*config.target);
+ let has_kasan = util::KASAN_SUPPORTED_TARGETS.contains(&&*config.target);
let has_lsan = util::LSAN_SUPPORTED_TARGETS.contains(&&*config.target);
let has_msan = util::MSAN_SUPPORTED_TARGETS.contains(&&*config.target);
let has_tsan = util::TSAN_SUPPORTED_TARGETS.contains(&&*config.target);
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);
+ let has_xray = util::XRAY_SUPPORTED_TARGETS.contains(&&*config.target);
// 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.
@@ -965,41 +968,69 @@ pub fn make_test_description<R: Read>(
if revision.is_some() && revision != cfg {
return;
}
+ macro_rules! reason {
+ ($e:expr) => {
+ ignore |= match $e {
+ true => {
+ ignore_message = Some(stringify!($e));
+ true
+ }
+ false => ignore,
+ }
+ };
+ }
ignore = match config.parse_cfg_name_directive(ln, "ignore") {
- ParsedNameDirective::Match => true,
+ ParsedNameDirective::Match => {
+ ignore_message = Some("cfg -> ignore => Match");
+ true
+ }
ParsedNameDirective::NoMatch => ignore,
};
+
if config.has_cfg_prefix(ln, "only") {
ignore = match config.parse_cfg_name_directive(ln, "only") {
ParsedNameDirective::Match => ignore,
- ParsedNameDirective::NoMatch => true,
+ ParsedNameDirective::NoMatch => {
+ ignore_message = Some("cfg -> only => NoMatch");
+ true
+ }
};
}
- ignore |= ignore_llvm(config, ln);
- ignore |=
- config.run_clang_based_tests_with.is_none() && config.parse_needs_matching_clang(ln);
- ignore |= !has_asm_support && config.parse_name_directive(ln, "needs-asm-support");
- ignore |= !rustc_has_profiler_support && config.parse_needs_profiler_support(ln);
- ignore |= !config.run_enabled() && config.parse_name_directive(ln, "needs-run-enabled");
- ignore |= !rustc_has_sanitizer_support
- && config.parse_name_directive(ln, "needs-sanitizer-support");
- ignore |= !has_asan && config.parse_name_directive(ln, "needs-sanitizer-address");
- ignore |= !has_cfi && config.parse_name_directive(ln, "needs-sanitizer-cfi");
- ignore |= !has_kcfi && config.parse_name_directive(ln, "needs-sanitizer-kcfi");
- ignore |= !has_lsan && config.parse_name_directive(ln, "needs-sanitizer-leak");
- ignore |= !has_msan && config.parse_name_directive(ln, "needs-sanitizer-memory");
- ignore |= !has_tsan && config.parse_name_directive(ln, "needs-sanitizer-thread");
- ignore |= !has_hwasan && config.parse_name_directive(ln, "needs-sanitizer-hwaddress");
- ignore |= !has_memtag && config.parse_name_directive(ln, "needs-sanitizer-memtag");
- ignore |= !has_shadow_call_stack
- && config.parse_name_directive(ln, "needs-sanitizer-shadow-call-stack");
- ignore |= !config.can_unwind() && config.parse_name_directive(ln, "needs-unwind");
- ignore |= config.target == "wasm32-unknown-unknown"
- && config.parse_name_directive(ln, directives::CHECK_RUN_RESULTS);
- ignore |= config.debugger == Some(Debugger::Cdb) && ignore_cdb(config, ln);
- ignore |= config.debugger == Some(Debugger::Gdb) && ignore_gdb(config, ln);
- ignore |= config.debugger == Some(Debugger::Lldb) && ignore_lldb(config, ln);
- ignore |= !has_rust_lld && config.parse_name_directive(ln, "needs-rust-lld");
+
+ reason!(ignore_llvm(config, ln));
+ reason!(
+ config.run_clang_based_tests_with.is_none() && config.parse_needs_matching_clang(ln)
+ );
+ reason!(!has_asm_support && config.parse_name_directive(ln, "needs-asm-support"));
+ reason!(!rustc_has_profiler_support && config.parse_needs_profiler_support(ln));
+ reason!(!config.run_enabled() && config.parse_name_directive(ln, "needs-run-enabled"));
+ reason!(
+ !rustc_has_sanitizer_support
+ && config.parse_name_directive(ln, "needs-sanitizer-support")
+ );
+ reason!(!has_asan && config.parse_name_directive(ln, "needs-sanitizer-address"));
+ reason!(!has_cfi && config.parse_name_directive(ln, "needs-sanitizer-cfi"));
+ reason!(!has_kcfi && config.parse_name_directive(ln, "needs-sanitizer-kcfi"));
+ reason!(!has_kasan && config.parse_name_directive(ln, "needs-sanitizer-kasan"));
+ reason!(!has_lsan && config.parse_name_directive(ln, "needs-sanitizer-leak"));
+ reason!(!has_msan && config.parse_name_directive(ln, "needs-sanitizer-memory"));
+ reason!(!has_tsan && config.parse_name_directive(ln, "needs-sanitizer-thread"));
+ reason!(!has_hwasan && config.parse_name_directive(ln, "needs-sanitizer-hwaddress"));
+ reason!(!has_memtag && config.parse_name_directive(ln, "needs-sanitizer-memtag"));
+ reason!(
+ !has_shadow_call_stack
+ && config.parse_name_directive(ln, "needs-sanitizer-shadow-call-stack")
+ );
+ reason!(!config.can_unwind() && config.parse_name_directive(ln, "needs-unwind"));
+ reason!(!has_xray && config.parse_name_directive(ln, "needs-xray"));
+ reason!(
+ config.target == "wasm32-unknown-unknown"
+ && config.parse_name_directive(ln, directives::CHECK_RUN_RESULTS)
+ );
+ reason!(config.debugger == Some(Debugger::Cdb) && ignore_cdb(config, ln));
+ reason!(config.debugger == Some(Debugger::Gdb) && ignore_gdb(config, ln));
+ reason!(config.debugger == Some(Debugger::Lldb) && ignore_lldb(config, ln));
+ reason!(!has_rust_lld && config.parse_name_directive(ln, "needs-rust-lld"));
should_fail |= config.parse_name_directive(ln, "should-fail");
});
diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs
index 3092c656c..1760c29ec 100644
--- a/src/tools/compiletest/src/main.rs
+++ b/src/tools/compiletest/src/main.rs
@@ -8,15 +8,17 @@ extern crate test;
use crate::common::{expected_output_path, output_base_dir, output_relative_path, UI_EXTENSIONS};
use crate::common::{CompareMode, Config, Debugger, Mode, PassMode, TestPaths};
use crate::util::logv;
+use build_helper::git::{get_git_modified_files, get_git_untracked_files};
+use core::panic;
use getopts::Options;
use lazycell::LazyCell;
-use std::env;
use std::ffi::OsString;
use std::fs;
use std::io::{self, ErrorKind};
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
use std::time::SystemTime;
+use std::{env, vec};
use test::ColorConfig;
use tracing::*;
use walkdir::WalkDir;
@@ -145,9 +147,10 @@ pub fn parse_config(args: Vec<String>) -> Config {
"",
"rustfix-coverage",
"enable this to generate a Rustfix coverage file, which is saved in \
- `./<build_base>/rustfix_missing_coverage.txt`",
+ `./<build_base>/rustfix_missing_coverage.txt`",
)
.optflag("", "force-rerun", "rerun tests even if the inputs are unchanged")
+ .optflag("", "only-modified", "only run tests that result been modified")
.optflag("h", "help", "show this message")
.reqopt("", "channel", "current Rust channel", "CHANNEL")
.optopt("", "edition", "default Rust edition", "EDITION");
@@ -279,6 +282,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
lldb_python_dir: matches.opt_str("lldb-python-dir"),
verbose: matches.opt_present("verbose"),
quiet: matches.opt_present("quiet"),
+ only_modified: matches.opt_present("only-modified"),
color,
remote_test_client: matches.opt_str("remote-test-client").map(PathBuf::from),
compare_mode: matches.opt_str("compare-mode").map(CompareMode::parse),
@@ -521,8 +525,18 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
pub fn make_tests(config: &Config, tests: &mut Vec<test::TestDescAndFn>) {
debug!("making tests from {:?}", config.src_base.display());
let inputs = common_inputs_stamp(config);
- collect_tests_from_dir(config, &config.src_base, &PathBuf::new(), &inputs, tests)
- .unwrap_or_else(|_| panic!("Could not read tests from {}", config.src_base.display()));
+ let modified_tests = modified_tests(config, &config.src_base).unwrap_or_else(|err| {
+ panic!("modified_tests got error from dir: {}, error: {}", config.src_base.display(), err)
+ });
+ collect_tests_from_dir(
+ config,
+ &config.src_base,
+ &PathBuf::new(),
+ &inputs,
+ tests,
+ &modified_tests,
+ )
+ .unwrap_or_else(|_| panic!("Could not read tests from {}", config.src_base.display()));
}
/// Returns a stamp constructed from input files common to all test cases.
@@ -561,12 +575,36 @@ fn common_inputs_stamp(config: &Config) -> Stamp {
stamp
}
+fn modified_tests(config: &Config, dir: &Path) -> Result<Vec<PathBuf>, String> {
+ if !config.only_modified {
+ return Ok(vec![]);
+ }
+ let files =
+ get_git_modified_files(Some(dir), &vec!["rs", "stderr", "fixed"])?.unwrap_or(vec![]);
+ // Add new test cases to the list, it will be convenient in daily development.
+ let untracked_files = get_git_untracked_files(None)?.unwrap_or(vec![]);
+
+ let all_paths = [&files[..], &untracked_files[..]].concat();
+ let full_paths = {
+ let mut full_paths: Vec<PathBuf> = all_paths
+ .into_iter()
+ .map(|f| PathBuf::from(f).with_extension("").with_extension("rs"))
+ .filter_map(|f| if Path::new(&f).exists() { f.canonicalize().ok() } else { None })
+ .collect();
+ full_paths.dedup();
+ full_paths.sort_unstable();
+ full_paths
+ };
+ Ok(full_paths)
+}
+
fn collect_tests_from_dir(
config: &Config,
dir: &Path,
relative_dir_path: &Path,
inputs: &Stamp,
tests: &mut Vec<test::TestDescAndFn>,
+ modified_tests: &Vec<PathBuf>,
) -> io::Result<()> {
// Ignore directories that contain a file named `compiletest-ignore-dir`.
if dir.join("compiletest-ignore-dir").exists() {
@@ -597,7 +635,7 @@ fn collect_tests_from_dir(
let file = file?;
let file_path = file.path();
let file_name = file.file_name();
- if is_test(&file_name) {
+ if is_test(&file_name) && (!config.only_modified || modified_tests.contains(&file_path)) {
debug!("found test file: {:?}", file_path.display());
let paths =
TestPaths { file: file_path, relative_dir: relative_dir_path.to_path_buf() };
@@ -607,7 +645,14 @@ fn collect_tests_from_dir(
let relative_file_path = relative_dir_path.join(file.file_name());
if &file_name != "auxiliary" {
debug!("found directory: {:?}", file_path.display());
- collect_tests_from_dir(config, &file_path, &relative_file_path, inputs, tests)?;
+ collect_tests_from_dir(
+ config,
+ &file_path,
+ &relative_file_path,
+ inputs,
+ tests,
+ modified_tests,
+ )?;
}
} else {
debug!("found other file/directory: {:?}", file_path.display());
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 859c0f1da..41c23ff86 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -32,7 +32,7 @@ use std::process::{Child, Command, ExitStatus, Output, Stdio};
use std::str;
use glob::glob;
-use lazy_static::lazy_static;
+use once_cell::sync::Lazy;
use tracing::*;
use crate::extract_gdb_version;
@@ -52,9 +52,8 @@ fn disable_error_reporting<F: FnOnce() -> R, R>(f: F) -> R {
use winapi::um::errhandlingapi::SetErrorMode;
use winapi::um::winbase::SEM_NOGPFAULTERRORBOX;
- lazy_static! {
- static ref LOCK: Mutex<()> = Mutex::new(());
- }
+ static LOCK: Mutex<()> = Mutex::new(());
+
// Error mode is a global variable, so lock it so only one thread will change it
let _lock = LOCK.lock().unwrap();
@@ -1433,12 +1432,13 @@ impl<'test> TestCx<'test> {
expect_help: bool,
expect_note: bool,
) -> bool {
- match actual_error.kind {
- Some(ErrorKind::Help) => expect_help,
- Some(ErrorKind::Note) => expect_note,
- Some(ErrorKind::Error) | Some(ErrorKind::Warning) => true,
- Some(ErrorKind::Suggestion) | None => false,
- }
+ !actual_error.msg.is_empty()
+ && match actual_error.kind {
+ Some(ErrorKind::Help) => expect_help,
+ Some(ErrorKind::Note) => expect_note,
+ Some(ErrorKind::Error) | Some(ErrorKind::Warning) => true,
+ Some(ErrorKind::Suggestion) | None => false,
+ }
}
fn should_emit_metadata(&self, pm: Option<PassMode>) -> Emit {
@@ -2030,6 +2030,9 @@ impl<'test> TestCx<'test> {
Some(CompareMode::Chalk) => {
rustc.args(&["-Ztrait-solver=chalk"]);
}
+ Some(CompareMode::NextSolver) => {
+ rustc.args(&["-Ztrait-solver=next"]);
+ }
Some(CompareMode::SplitDwarf) if self.config.target.contains("windows") => {
rustc.args(&["-Csplit-debuginfo=unpacked", "-Zunstable-options"]);
}
@@ -2845,11 +2848,10 @@ impl<'test> TestCx<'test> {
// the form <crate-name1>.<crate-disambiguator1>-in-<crate-name2>.<crate-disambiguator2>,
// remove all crate-disambiguators.
fn remove_crate_disambiguator_from_cgu(cgu: &str) -> String {
- lazy_static! {
- static ref RE: Regex =
- Regex::new(r"^[^\.]+(?P<d1>\.[[:alnum:]]+)(-in-[^\.]+(?P<d2>\.[[:alnum:]]+))?")
- .unwrap();
- }
+ static RE: Lazy<Regex> = Lazy::new(|| {
+ Regex::new(r"^[^\.]+(?P<d1>\.[[:alnum:]]+)(-in-[^\.]+(?P<d2>\.[[:alnum:]]+))?")
+ .unwrap()
+ });
let captures =
RE.captures(cgu).unwrap_or_else(|| panic!("invalid cgu name encountered: {}", cgu));
@@ -3167,12 +3169,12 @@ impl<'test> TestCx<'test> {
// 'uploaded "$TEST_BUILD_DIR/<test_executable>, waiting for result"'
// is printed to stdout by the client and then captured in the ProcRes,
// so it needs to be removed when comparing the run-pass test execution output
- lazy_static! {
- static ref REMOTE_TEST_RE: Regex = Regex::new(
+ static REMOTE_TEST_RE: Lazy<Regex> = Lazy::new(|| {
+ Regex::new(
"^uploaded \"\\$TEST_BUILD_DIR(/[[:alnum:]_\\-.]+)+\", waiting for result\n"
)
- .unwrap();
- }
+ .unwrap()
+ });
REMOTE_TEST_RE
.replace(
&self.normalize_output(&proc_res.stdout, &self.props.normalize_stdout),
@@ -3617,10 +3619,8 @@ impl<'test> TestCx<'test> {
// with placeholders as we do not want tests needing updated when compiler source code
// changes.
// eg. $SRC_DIR/libcore/mem.rs:323:14 becomes $SRC_DIR/libcore/mem.rs:LL:COL
- lazy_static! {
- static ref SRC_DIR_RE: Regex =
- Regex::new("SRC_DIR(.+):\\d+:\\d+(: \\d+:\\d+)?").unwrap();
- }
+ static SRC_DIR_RE: Lazy<Regex> =
+ Lazy::new(|| Regex::new("SRC_DIR(.+):\\d+:\\d+(: \\d+:\\d+)?").unwrap());
normalized = SRC_DIR_RE.replace_all(&normalized, "SRC_DIR$1:LL:COL").into_owned();
@@ -3631,19 +3631,17 @@ impl<'test> TestCx<'test> {
// since they duplicate actual errors and make the output hard to read.
// This mirrors the regex in src/tools/tidy/src/style.rs, please update
// both if either are changed.
- lazy_static! {
- static ref ANNOTATION_RE: Regex = Regex::new("\\s*//(\\[.*\\])?~.*").unwrap();
- }
+ static ANNOTATION_RE: Lazy<Regex> =
+ Lazy::new(|| Regex::new("\\s*//(\\[.*\\])?~.*").unwrap());
normalized = ANNOTATION_RE.replace_all(&normalized, "").into_owned();
// This code normalizes various hashes in v0 symbol mangling that is
// emitted in the ui and mir-opt tests.
- lazy_static! {
- static ref V0_CRATE_HASH_PREFIX_RE: Regex =
- Regex::new(r"_R.*?Cs[0-9a-zA-Z]+_").unwrap();
- static ref V0_CRATE_HASH_RE: Regex = Regex::new(r"Cs[0-9a-zA-Z]+_").unwrap();
- }
+ static V0_CRATE_HASH_PREFIX_RE: Lazy<Regex> =
+ Lazy::new(|| Regex::new(r"_R.*?Cs[0-9a-zA-Z]+_").unwrap());
+ static V0_CRATE_HASH_RE: Lazy<Regex> =
+ Lazy::new(|| Regex::new(r"Cs[0-9a-zA-Z]+_").unwrap());
const V0_CRATE_HASH_PLACEHOLDER: &str = r"CsCRATE_HASH_";
if V0_CRATE_HASH_PREFIX_RE.is_match(&normalized) {
@@ -3652,10 +3650,9 @@ impl<'test> TestCx<'test> {
V0_CRATE_HASH_RE.replace_all(&normalized, V0_CRATE_HASH_PLACEHOLDER).into_owned();
}
- lazy_static! {
- static ref V0_BACK_REF_PREFIX_RE: Regex = Regex::new(r"\(_R.*?B[0-9a-zA-Z]_").unwrap();
- static ref V0_BACK_REF_RE: Regex = Regex::new(r"B[0-9a-zA-Z]_").unwrap();
- }
+ static V0_BACK_REF_PREFIX_RE: Lazy<Regex> =
+ Lazy::new(|| Regex::new(r"\(_R.*?B[0-9a-zA-Z]_").unwrap());
+ static V0_BACK_REF_RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"B[0-9a-zA-Z]_").unwrap());
const V0_BACK_REF_PLACEHOLDER: &str = r"B<REF>_";
if V0_BACK_REF_PREFIX_RE.is_match(&normalized) {
@@ -3678,21 +3675,23 @@ impl<'test> TestCx<'test> {
/// Replaces backslashes in paths with forward slashes, and replaces CRLF line endings
/// with LF.
fn normalize_platform_differences(output: &str) -> String {
- lazy_static! {
- /// Used to find Windows paths.
- ///
- /// It's not possible to detect paths in the error messages generally, but this is a
- /// decent enough heuristic.
- static ref PATH_BACKSLASH_RE: Regex = Regex::new(r#"(?x)
+ /// Used to find Windows paths.
+ ///
+ /// It's not possible to detect paths in the error messages generally, but this is a
+ /// decent enough heuristic.
+ static PATH_BACKSLASH_RE: Lazy<Regex> = Lazy::new(|| {
+ Regex::new(
+ r#"(?x)
(?:
# Match paths that don't include spaces.
(?:\\[\pL\pN\.\-_']+)+\.\pL+
|
# If the path starts with a well-known root, then allow spaces.
\$(?:DIR|SRC_DIR|TEST_BUILD_DIR|BUILD_DIR|LIB_DIR)(?:\\[\pL\pN\.\-_' ]+)+
- )"#
- ).unwrap();
- }
+ )"#,
+ )
+ .unwrap()
+ });
let output = output.replace(r"\\", r"\");
diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs
index 6c63b760f..5f6a27e53 100644
--- a/src/tools/compiletest/src/util.rs
+++ b/src/tools/compiletest/src/util.rs
@@ -11,6 +11,8 @@ mod tests;
pub const ASAN_SUPPORTED_TARGETS: &[&str] = &[
"aarch64-apple-darwin",
+ "aarch64-apple-ios",
+ "aarch64-apple-ios-sim",
"aarch64-unknown-fuchsia",
"aarch64-linux-android",
"aarch64-unknown-linux-gnu",
@@ -19,10 +21,12 @@ pub const ASAN_SUPPORTED_TARGETS: &[&str] = &[
"i686-linux-android",
"i686-unknown-linux-gnu",
"x86_64-apple-darwin",
+ "x86_64-apple-ios",
"x86_64-unknown-fuchsia",
"x86_64-linux-android",
"x86_64-unknown-freebsd",
"x86_64-unknown-linux-gnu",
+ "s390x-unknown-linux-gnu",
];
// FIXME(rcvalle): More targets are likely supported.
@@ -44,23 +48,39 @@ pub const CFI_SUPPORTED_TARGETS: &[&str] = &[
pub const KCFI_SUPPORTED_TARGETS: &[&str] = &["aarch64-linux-none", "x86_64-linux-none"];
+pub const KASAN_SUPPORTED_TARGETS: &[&str] = &[
+ "aarch64-unknown-none",
+ "riscv64gc-unknown-none-elf",
+ "riscv64imac-unknown-none-elf",
+ "x86_64-unknown-none",
+];
+
pub const LSAN_SUPPORTED_TARGETS: &[&str] = &[
// FIXME: currently broken, see #88132
// "aarch64-apple-darwin",
"aarch64-unknown-linux-gnu",
"x86_64-apple-darwin",
"x86_64-unknown-linux-gnu",
+ "s390x-unknown-linux-gnu",
];
-pub const MSAN_SUPPORTED_TARGETS: &[&str] =
- &["aarch64-unknown-linux-gnu", "x86_64-unknown-freebsd", "x86_64-unknown-linux-gnu"];
+pub const MSAN_SUPPORTED_TARGETS: &[&str] = &[
+ "aarch64-unknown-linux-gnu",
+ "x86_64-unknown-freebsd",
+ "x86_64-unknown-linux-gnu",
+ "s390x-unknown-linux-gnu",
+];
pub const TSAN_SUPPORTED_TARGETS: &[&str] = &[
"aarch64-apple-darwin",
+ "aarch64-apple-ios",
+ "aarch64-apple-ios-sim",
"aarch64-unknown-linux-gnu",
"x86_64-apple-darwin",
+ "x86_64-apple-ios",
"x86_64-unknown-freebsd",
"x86_64-unknown-linux-gnu",
+ "s390x-unknown-linux-gnu",
];
pub const HWASAN_SUPPORTED_TARGETS: &[&str] =
@@ -71,6 +91,19 @@ pub const MEMTAG_SUPPORTED_TARGETS: &[&str] =
pub const SHADOWCALLSTACK_SUPPORTED_TARGETS: &[&str] = &["aarch64-linux-android"];
+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