diff --git a/miri b/miri index 7b53b802db6..bb2fc5b1231 100755 --- a/miri +++ b/miri @@ -133,10 +133,9 @@ find_sysroot() { # Run command. case "$COMMAND" in install) - # "--locked" to respect the Cargo.lock file if it exists, - # "--offline" to avoid querying the registry (for yanked packages). - $CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR" --force --locked --offline "$@" - $CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR"/cargo-miri --force --locked --offline "$@" + # "--locked" to respect the Cargo.lock file if it exists. + $CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR" --force --locked "$@" + $CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR"/cargo-miri --force --locked "$@" ;; check) # Check, and let caller control flags. diff --git a/ui_test/README.md b/ui_test/README.md index 55639c9589e..4ecebcc8ddb 100644 --- a/ui_test/README.md +++ b/ui_test/README.md @@ -25,8 +25,10 @@ their command specifies, or the test will fail without even being run. * `//@ignore-XXX` avoids running the test on targets whose triple contains `XXX` * `XXX` can also be one of `64bit`, `32bit` or `16bit` + * `XXX` can also be `on-host`, which will only run the test during cross compilation testing. * `//@only-XXX` avoids running the test on targets whose triple **does not** contain `XXX` * `XXX` can also be one of `64bit`, `32bit` or `16bit` + * `XXX` can also be `on-host`, which will not run the test during cross compilation testing * `//@stderr-per-bitwidth` produces one stderr file per bitwidth, as they may differ significantly sometimes * `//@error-pattern: XXX` make sure the stderr output contains `XXX` * `//@revisions: XXX YYY` runs the test once for each space separated name in the list diff --git a/ui_test/src/lib.rs b/ui_test/src/lib.rs index 32c04290bca..16f7be30f8b 100644 --- a/ui_test/src/lib.rs +++ b/ui_test/src/lib.rs @@ -109,7 +109,7 @@ pub fn run_tests(config: Config) -> Result<()> { } let comments = Comments::parse_file(&path)?; // Ignore file if only/ignore rules do (not) apply - if !test_file_conditions(&comments, &target) { + if !test_file_conditions(&comments, &target, &config) { ignored.fetch_add(1, Ordering::Relaxed); eprintln!( "{} ... {}", @@ -499,19 +499,20 @@ fn output_path(path: &Path, comments: &Comments, kind: String, target: &str) -> path.with_extension(kind) } -fn test_condition(condition: &Condition, target: &str) -> bool { +fn test_condition(condition: &Condition, target: &str, config: &Config) -> bool { match condition { Condition::Bitwidth(bits) => get_pointer_width(target) == *bits, Condition::Target(t) => target.contains(t), + Condition::OnHost => config.target.is_none(), } } /// Returns whether according to the in-file conditions, this file should be run. -fn test_file_conditions(comments: &Comments, target: &str) -> bool { - if comments.ignore.iter().any(|c| test_condition(c, target)) { +fn test_file_conditions(comments: &Comments, target: &str, config: &Config) -> bool { + if comments.ignore.iter().any(|c| test_condition(c, target, config)) { return false; } - comments.only.iter().all(|c| test_condition(c, target)) + comments.only.iter().all(|c| test_condition(c, target, config)) } // Taken 1:1 from compiletest-rs diff --git a/ui_test/src/parser.rs b/ui_test/src/parser.rs index 7d810a95e41..e7fb484434d 100644 --- a/ui_test/src/parser.rs +++ b/ui_test/src/parser.rs @@ -43,6 +43,8 @@ pub(crate) enum Condition { Target(String), /// Tests that the bitwidth is the given one. Bitwidth(u8), + /// Tests that the target is the host. + OnHost, } #[derive(Debug, Clone)] @@ -64,7 +66,9 @@ pub(crate) struct ErrorMatch { impl Condition { fn parse(c: &str) -> Self { - if let Some(bits) = c.strip_suffix("bit") { + if c == "on-host" { + Condition::OnHost + } else if let Some(bits) = c.strip_suffix("bit") { let bits: u8 = bits.parse().expect( "ignore/only filter ending in 'bit' must be of the form 'Nbit' for some integer N", );