mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-23 20:34:06 +00:00
Don't use the diff command in regex test
The output is small enough that getting a pretty diff isn't important. In addition this reduces the amount of commands the build system depends on.
This commit is contained in:
parent
890c61216a
commit
1a89507d7c
@ -169,9 +169,10 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
|
||||
REGEX.source_dir(&runner.dirs).join("examples").join("regexdna-input.txt"),
|
||||
)
|
||||
.unwrap();
|
||||
let expected_path =
|
||||
REGEX.source_dir(&runner.dirs).join("examples").join("regexdna-output.txt");
|
||||
let expected = fs::read_to_string(&expected_path).unwrap();
|
||||
let expected = fs::read_to_string(
|
||||
REGEX.source_dir(&runner.dirs).join("examples").join("regexdna-output.txt"),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let output = spawn_and_wait_with_input(run_cmd, input);
|
||||
// Make sure `[codegen mono items] start` doesn't poison the diff
|
||||
@ -184,20 +185,9 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
|
||||
|
||||
let output_matches = expected.lines().eq(output.lines());
|
||||
if !output_matches {
|
||||
let res_path = REGEX.source_dir(&runner.dirs).join("res.txt");
|
||||
fs::write(&res_path, &output).unwrap();
|
||||
|
||||
if cfg!(windows) {
|
||||
println!("Output files don't match!");
|
||||
println!("Expected Output:\n{}", expected);
|
||||
println!("Actual Output:\n{}", output);
|
||||
} else {
|
||||
let mut diff = Command::new("diff");
|
||||
diff.arg("-u");
|
||||
diff.arg(res_path);
|
||||
diff.arg(expected_path);
|
||||
spawn_and_wait(diff);
|
||||
}
|
||||
println!("Output files don't match!");
|
||||
println!("Expected Output:\n{}", expected);
|
||||
println!("Actual Output:\n{}", output);
|
||||
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user