Skip to content

Commit

Permalink
Port run-make/libtest-junit to rmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Zalathar committed Aug 13, 2024
1 parent c4aa7a7 commit fc733a6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 21 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ run-make/incr-add-rust-src-component/Makefile
run-make/issue-84395-lto-embed-bitcode/Makefile
run-make/jobserver-error/Makefile
run-make/libs-through-symlinks/Makefile
run-make/libtest-junit/Makefile
run-make/libtest-thread-limit/Makefile
run-make/macos-deployment-target/Makefile
run-make/min-global-align/Makefile
Expand Down
20 changes: 0 additions & 20 deletions tests/run-make/libtest-junit/Makefile

This file was deleted.

31 changes: 31 additions & 0 deletions tests/run-make/libtest-junit/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Check libtest's JUnit (XML) output against snapshots.

//@ ignore-cross-compile
//@ needs-unwind (test file contains #[should_panic] test)

use run_make_support::{cmd, diff, python_command, rustc};

fn main() {
rustc().arg("--test").input("f.rs").run();

run_tests(&[], "output-default.xml");
run_tests(&["--show-output"], "output-stdout-success.xml");
}

#[track_caller]
fn run_tests(extra_args: &[&str], expected_file: &str) {
let cmd_out = cmd("./f")
.env("RUST_BACKTRACE", "0")
.args(&["-Zunstable-options", "--test-threads=1", "--format=junit"])
.args(extra_args)
.run_fail();
let test_stdout = &cmd_out.stdout_utf8();

python_command().arg("validate_junit.py").stdin(test_stdout).run();

diff()
.expected_file(expected_file)
.actual_text("stdout", test_stdout)
.normalize(r#"\btime="[0-9.]+""#, r#"time="$$TIME""#)
.run();
}

0 comments on commit fc733a6

Please sign in to comment.