diff --git a/fixtures/nextest-tests-junit.xml b/fixtures/nextest-tests-junit.xml index 14b8f87ec6b..56c54d44478 100644 --- a/fixtures/nextest-tests-junit.xml +++ b/fixtures/nextest-tests-junit.xml @@ -1,16 +1,18 @@ - + - + - - thread 'test_failure_assert' panicked at 'assertion failed: `(left == right)` - left: `4`, - right: `5`: this is an assertion', tests/basic.rs:9:5 + + thread 'test_failure_assert' panicked at tests/basic.rs:19:5: +assertion `left == right` failed: this is an assertion + left: 4 + right: 5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace - thread 'test_failure_assert' panicked at 'assertion failed: `(left == right)` - left: `4`, - right: `5`: this is an assertion', tests/basic.rs:9:5 + thread 'test_failure_assert' panicked at tests/basic.rs:19:5: +assertion `left == right` failed: this is an assertion + left: 4 + right: 5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace running 1 test @@ -24,15 +26,17 @@ failures: test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 17 filtered out; finished in 0.00s - thread 'test_failure_assert' panicked at 'assertion failed: `(left == right)` - left: `4`, - right: `5`: this is an assertion', tests/basic.rs:9:5 + thread 'test_failure_assert' panicked at tests/basic.rs:19:5: +assertion `left == right` failed: this is an assertion + left: 4 + right: 5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace - thread 'test_failure_assert' panicked at 'assertion failed: `(left == right)` - left: `4`, - right: `5`: this is an assertion', tests/basic.rs:9:5 + thread 'test_failure_assert' panicked at tests/basic.rs:19:5: +assertion `left == right` failed: this is an assertion + left: 4 + right: 5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace running 1 test @@ -46,9 +50,10 @@ failures: test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 17 filtered out; finished in 0.00s - thread 'test_failure_assert' panicked at 'assertion failed: `(left == right)` - left: `4`, - right: `5`: this is an assertion', tests/basic.rs:9:5 + thread 'test_failure_assert' panicked at tests/basic.rs:19:5: +assertion `left == right` failed: this is an assertion + left: 4 + right: 5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace @@ -64,14 +69,16 @@ failures: test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 17 filtered out; finished in 0.00s - thread 'test_failure_assert' panicked at 'assertion failed: `(left == right)` - left: `4`, - right: `5`: this is an assertion', tests/basic.rs:9:5 + thread 'test_failure_assert' panicked at tests/basic.rs:19:5: +assertion `left == right` failed: this is an assertion + left: 4 + right: 5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace - - thread 'test_flaky_mod_4' panicked at 'Failed because attempt 1 % 4 != 0', tests/basic.rs:33:9 + + thread 'test_flaky_mod_4' panicked at tests/basic.rs:43:9: +Failed because attempt 1 % 4 != 0 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace running 1 test @@ -85,11 +92,13 @@ failures: test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 17 filtered out; finished in 0.00s - thread 'test_flaky_mod_4' panicked at 'Failed because attempt 1 % 4 != 0', tests/basic.rs:33:9 + thread 'test_flaky_mod_4' panicked at tests/basic.rs:43:9: +Failed because attempt 1 % 4 != 0 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace - thread 'test_flaky_mod_4' panicked at 'Failed because attempt 2 % 4 != 0', tests/basic.rs:33:9 + thread 'test_flaky_mod_4' panicked at tests/basic.rs:43:9: +Failed because attempt 2 % 4 != 0 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace running 1 test @@ -103,7 +112,28 @@ failures: test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 17 filtered out; finished in 0.00s - thread 'test_flaky_mod_4' panicked at 'Failed because attempt 2 % 4 != 0', tests/basic.rs:33:9 + thread 'test_flaky_mod_4' panicked at tests/basic.rs:43:9: +Failed because attempt 2 % 4 != 0 +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace + + + thread 'test_flaky_mod_4' panicked at tests/basic.rs:43:9: +Failed because attempt 3 % 4 != 0 +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace + +running 1 test +test test_flaky_mod_4 ... FAILED + +failures: + +failures: + test_flaky_mod_4 + +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 17 filtered out; finished in 0.00s + + + thread 'test_flaky_mod_4' panicked at tests/basic.rs:43:9: +Failed because attempt 3 % 4 != 0 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/fixtures/nextest-tests/.config/nextest.toml b/fixtures/nextest-tests/.config/nextest.toml index 352a47128eb..8065f9c81d3 100644 --- a/fixtures/nextest-tests/.config/nextest.toml +++ b/fixtures/nextest-tests/.config/nextest.toml @@ -60,6 +60,10 @@ test-group = '@global' [profile.with-junit] retries = 2 +[[profile.with-junit.overrides]] +filter = "test(test_flaky_mod_4)" +retries = 3 + [profile.with-junit.junit] path = "junit.xml" diff --git a/scripts/generate-junit-fixture.sh b/scripts/generate-junit-fixture.sh new file mode 100755 index 00000000000..e75ff8cfc24 --- /dev/null +++ b/scripts/generate-junit-fixture.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# Generates a JUnit fixture and copies it to nextest-tests-junit.xml. + +cd "$(git rev-parse --show-toplevel)" +cargo run -p cargo-nextest -- \ + nextest run --manifest-path fixtures/nextest-tests/Cargo.toml \ + --profile with-junit -E 'test(=test_cwd) + test(=test_failure_assert) + test(=test_flaky_mod_4)' || true +cp fixtures/nextest-tests/target/nextest/with-junit/junit.xml fixtures/nextest-tests-junit.xml