From 43100f5f4b8b8c0b437bfe8b380198cb99e62cc3 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Sun, 17 Jul 2022 07:46:02 +0000 Subject: [PATCH 1/3] Remove `--offline` from `./miri install` as otherwise we can't add more dependencies to miri as CI will fail. if you want this locally, pass it to your invocation. --- miri | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/miri b/miri index 7b53b802db62..bb2fc5b12318 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. From 444841bba9c31f1fe5b7b419ee82eb27e37a344e Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Sun, 17 Jul 2022 07:56:57 +0000 Subject: [PATCH 2/3] Add test flag for running a test only on the host --- ui_test/README.md | 2 ++ ui_test/src/lib.rs | 11 ++++++----- ui_test/src/parser.rs | 6 ++++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ui_test/README.md b/ui_test/README.md index 55639c9589e1..4ecebcc8ddb2 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 32c04290bca2..16f7be30f8b2 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 7d810a95e412..994c0800fcc1 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,6 +66,10 @@ pub(crate) struct ErrorMatch { impl Condition { fn parse(c: &str) -> Self { + match c { + "on-host" => return Condition::OnHost, + _ => {} + } 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", From 8527bfc63b8c6eb9451e1adb08c39cc4d54c1bc5 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Sun, 17 Jul 2022 08:07:26 +0000 Subject: [PATCH 3/3] clippy --- ui_test/src/parser.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ui_test/src/parser.rs b/ui_test/src/parser.rs index 994c0800fcc1..e7fb484434d7 100644 --- a/ui_test/src/parser.rs +++ b/ui_test/src/parser.rs @@ -66,11 +66,9 @@ pub(crate) struct ErrorMatch { impl Condition { fn parse(c: &str) -> Self { - match c { - "on-host" => return Condition::OnHost, - _ => {} - } - 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", );