]> git.lizzy.rs Git - rust.git/commitdiff
Don't use the diff command in regex test
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>
Fri, 13 Jan 2023 15:14:04 +0000 (15:14 +0000)
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>
Fri, 13 Jan 2023 15:29:28 +0000 (15:29 +0000)
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.

build_system/tests.rs

index 8bef6f733800afd82e070ac20327a5219fb86475..25c2457785e3043c5c7c1c92de4cebbce174698e 100644 (file)
@@ -169,9 +169,10 @@ const fn jit_bin(config: &'static str, source: &'static str, args: &'static str)
                 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 fn jit_bin(config: &'static str, source: &'static str, args: &'static str)
 
             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);
             }