diff options
| author | clippered <clarke_overkill@yahoo.com> | 2017-10-07 18:50:50 +1100 |
|---|---|---|
| committer | clippered <clarke_overkill@yahoo.com> | 2017-10-11 23:25:39 +1100 |
| commit | 057bc7d6506bb0208b5da782602c5cf7692d10c8 (patch) | |
| tree | 3d8a1518903998a587c7c4a7c63e391b513c8a10 /src/tools/compiletest | |
| parent | 264aafe0566e521bbc95bd3f44dae97591c9fd20 (diff) | |
| download | rust-057bc7d6506bb0208b5da782602c5cf7692d10c8.tar.gz rust-057bc7d6506bb0208b5da782602c5cf7692d10c8.zip | |
Fix #44968 Windows path in UI tests
Diffstat (limited to 'src/tools/compiletest')
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 870e08cc6e5..0ffc8b563bb 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2325,8 +2325,15 @@ actual:\n\ fn normalize_output(&self, output: &str, custom_rules: &[(String, String)]) -> String { let parent_dir = self.testpaths.file.parent().unwrap(); - let parent_dir_str = parent_dir.display().to_string(); + let cflags = self.props.compile_flags.join(" "); + let parent_dir_str = if cflags.contains("--error-format json") { + parent_dir.display().to_string().replace("\\", "\\\\") + } else { + parent_dir.display().to_string() + }; + let mut normalized = output.replace(&parent_dir_str, "$DIR") + .replace("\\\\", "\\") // denormalize for paths on windows .replace("\\", "/") // normalize for paths on windows .replace("\r\n", "\n") // normalize for linebreaks on windows .replace("\t", "\\t"); // makes tabs visible |
