forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#129037 - Zalathar:rmake-libtest, r=jieyouxu
Port `run-make/libtest-json` and `run-make/libtest-junit` to rmake Unlike rust-lang#126773, this is just a straightforward port to `rmake`, without attempting to switch to compiletest or get rid of the (trivial) Python scripts. Part of rust-lang#121876. r? ``@jieyouxu`` try-job: x86_64-msvc try-job: i686-mingw try-job: test-various try-job: aarch64-gnu try-job: aarch64-apple
- Loading branch information
Showing
7 changed files
with
64 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Check libtest's JSON 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.json"); | ||
run_tests(&["--show-output"], "output-stdout-success.json"); | ||
} | ||
|
||
#[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=json"]) | ||
.args(extra_args) | ||
.run_fail(); | ||
let test_stdout = &cmd_out.stdout_utf8(); | ||
|
||
python_command().arg("validate_json.py").stdin(test_stdout).run(); | ||
|
||
diff() | ||
.expected_file(expected_file) | ||
.actual_text("stdout", test_stdout) | ||
.normalize(r#"(?<prefix>"exec_time": )[0-9.]+"#, r#"${prefix}"$$EXEC_TIME""#) | ||
.run(); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |