Port run-make/libtest-junit
to rmake
This commit is contained in:
parent
c4aa7a71a9
commit
fc733a668a
@ -9,7 +9,6 @@ run-make/incr-add-rust-src-component/Makefile
|
|||||||
run-make/issue-84395-lto-embed-bitcode/Makefile
|
run-make/issue-84395-lto-embed-bitcode/Makefile
|
||||||
run-make/jobserver-error/Makefile
|
run-make/jobserver-error/Makefile
|
||||||
run-make/libs-through-symlinks/Makefile
|
run-make/libs-through-symlinks/Makefile
|
||||||
run-make/libtest-junit/Makefile
|
|
||||||
run-make/libtest-thread-limit/Makefile
|
run-make/libtest-thread-limit/Makefile
|
||||||
run-make/macos-deployment-target/Makefile
|
run-make/macos-deployment-target/Makefile
|
||||||
run-make/min-global-align/Makefile
|
run-make/min-global-align/Makefile
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
# ignore-cross-compile
|
|
||||||
# needs-unwind contains should_panic test
|
|
||||||
include ../tools.mk
|
|
||||||
|
|
||||||
# Test expected libtest's junit output
|
|
||||||
|
|
||||||
OUTPUT_FILE_DEFAULT := $(TMPDIR)/libtest-junit-output-default.xml
|
|
||||||
OUTPUT_FILE_STDOUT_SUCCESS := $(TMPDIR)/libtest-junit-output-stdout-success.xml
|
|
||||||
|
|
||||||
all: f.rs validate_junit.py output-default.xml output-stdout-success.xml
|
|
||||||
$(RUSTC) --test f.rs
|
|
||||||
RUST_BACKTRACE=0 $(call RUN,f) -Z unstable-options --test-threads=1 --format=junit > $(OUTPUT_FILE_DEFAULT) || true
|
|
||||||
RUST_BACKTRACE=0 $(call RUN,f) -Z unstable-options --test-threads=1 --format=junit --show-output > $(OUTPUT_FILE_STDOUT_SUCCESS) || true
|
|
||||||
|
|
||||||
cat $(OUTPUT_FILE_DEFAULT) | "$(PYTHON)" validate_junit.py
|
|
||||||
cat $(OUTPUT_FILE_STDOUT_SUCCESS) | "$(PYTHON)" validate_junit.py
|
|
||||||
|
|
||||||
# Normalize the actual output and compare to expected output file
|
|
||||||
cat $(OUTPUT_FILE_DEFAULT) | sed 's/time="[0-9.]*"/time="$$TIME"/g' | diff output-default.xml -
|
|
||||||
cat $(OUTPUT_FILE_STDOUT_SUCCESS) | sed 's/time="[0-9.]*"/time="$$TIME"/g' | diff output-stdout-success.xml -
|
|
31
tests/run-make/libtest-junit/rmake.rs
Normal file
31
tests/run-make/libtest-junit/rmake.rs
Normal file
@ -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();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user