From 2c867d0b5f630a1e0dea48da93abe806a1816400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?= Date: Sat, 20 Jul 2024 09:05:38 +0000 Subject: [PATCH] compiletest/rmake: avoid double test directory for rmake.rs tests This is important for other tests that have various things like modes, revisions and the like. These features are not supported in run-make tests, so we don't need the double layering. --- src/tools/compiletest/src/common.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index da7f03441e7..bc66dcbfb94 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -760,8 +760,14 @@ pub fn output_testname_unique( /// test/revision should reside. Example: /// /path/to/build/host-triple/test/ui/relative/testname.revision.mode/ pub fn output_base_dir(config: &Config, testpaths: &TestPaths, revision: Option<&str>) -> PathBuf { - output_relative_path(config, &testpaths.relative_dir) - .join(output_testname_unique(config, testpaths, revision)) + // In run-make tests, constructing a relative path + unique testname causes a double layering + // since revisions are not supported, causing unnecessary nesting. + if config.mode == Mode::RunMake { + output_relative_path(config, &testpaths.relative_dir) + } else { + output_relative_path(config, &testpaths.relative_dir) + .join(output_testname_unique(config, testpaths, revision)) + } } /// Absolute path to the base filename used as output for the given