about summary refs log tree commit diff
path: root/src/tools/compiletest
diff options
context:
space:
mode:
authorDavid Wood <david@davidtw.co>2018-08-09 10:58:16 +0200
committerDavid Wood <david@davidtw.co>2018-08-14 11:12:10 +0200
commit2ad663c1cd7ac8df9eea010cb0f3f40ed6d8707a (patch)
treef2495a2b3ce94d7e7bbe1026ff33620beaa36abe /src/tools/compiletest
parented79c31f0929059cb1933a52b0d6a154497fd206 (diff)
downloadrust-2ad663c1cd7ac8df9eea010cb0f3f40ed6d8707a.tar.gz
rust-2ad663c1cd7ac8df9eea010cb0f3f40ed6d8707a.zip
Normalize test build directory and root build directory.
Diffstat (limited to 'src/tools/compiletest')
-rw-r--r--src/tools/compiletest/src/runtest.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 56cf553dc82..af2108d7b88 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -2918,6 +2918,15 @@ impl<'test> TestCx<'test> {
         };
         normalized = normalized.replace(&src_dir_str, "$SRC_DIR");
 
+        // Paths into the build directory
+        let test_build_dir = &self.config.build_base;
+        let parent_build_dir = test_build_dir.parent().unwrap().parent().unwrap().parent().unwrap();
+
+        // eg. /home/user/rust/build/x86_64-unknown-linux-gnu/test/ui
+        normalized = normalized.replace(test_build_dir.to_str().unwrap(), "$TEST_BUILD_DIR");
+        // eg. /home/user/rust/build
+        normalized = normalized.replace(&parent_build_dir.to_str().unwrap(), "$BUILD_DIR");
+
         if json {
             // escaped newlines in json strings should be readable
             // in the stderr files. There's no point int being correct,