about summary refs log tree commit diff
path: root/src/tools/compiletest
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-07-06 12:12:10 +0200
committerGitHub <noreply@github.com>2023-07-06 12:12:10 +0200
commitf94a0c91cdd7475fbed03adecbb7f2ab7aae2f81 (patch)
treeda15b847a0293f16caadbcbf8d97cabe011110c5 /src/tools/compiletest
parentb112bc5529cfa8d8a9000f7a85278ece3232e579 (diff)
parentec18a34e1b3644fdb4aa1ef8723475ed9a8049d1 (diff)
downloadrust-f94a0c91cdd7475fbed03adecbb7f2ab7aae2f81.tar.gz
rust-f94a0c91cdd7475fbed03adecbb7f2ab7aae2f81.zip
Rollup merge of #112295 - ForrestOfBarnes:tests-listing-format-json-windows-fix, r=pietroalbini
Fix the tests-listing-format-json test on Windows

tests/ui/test-attrs/tests-listing-json-format.rs was failing on Windows because each path in the json-formatted output contained "\\\\" instead of "\\". `runtest::TestCx::normalize_output` already checks the compile flags for json-related arguments to handle this case, so I added an equivalent check for the new run flag.
Diffstat (limited to 'src/tools/compiletest')
-rw-r--r--src/tools/compiletest/src/runtest.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index e8d0ebd40b0..672779325ae 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -4022,8 +4022,11 @@ impl<'test> TestCx<'test> {
     }
 
     fn normalize_output(&self, output: &str, custom_rules: &[(String, String)]) -> String {
+        let rflags = self.props.run_flags.as_ref();
         let cflags = self.props.compile_flags.join(" ");
-        let json = cflags.contains("--error-format json")
+        let json = rflags
+            .map_or(false, |s| s.contains("--format json") || s.contains("--format=json"))
+            || cflags.contains("--error-format json")
             || cflags.contains("--error-format pretty-json")
             || cflags.contains("--error-format=json")
             || cflags.contains("--error-format=pretty-json")