From 2ad663c1cd7ac8df9eea010cb0f3f40ed6d8707a Mon Sep 17 00:00:00 2001 From: David Wood Date: Thu, 9 Aug 2018 10:58:16 +0200 Subject: Normalize test build directory and root build directory. --- src/tools/compiletest/src/runtest.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/tools') 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, -- cgit 1.4.1-3-g733a5