about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUrgau <3616612+Urgau@users.noreply.github.com>2024-10-16 12:03:44 +0200
committerGitHub <noreply@github.com>2024-10-16 12:03:44 +0200
commit43a142e4d02210caa8936777f747f31f7ce064f9 (patch)
treefb8c75aace401eb68778f0db48663465c909bbb9
parent6b27c3057df4ff501862c3793366df52ca4dcd53 (diff)
parent4cf0475eeb6fb3aca3b67cd16127d825709a0bb4 (diff)
downloadrust-43a142e4d02210caa8936777f747f31f7ce064f9.tar.gz
rust-43a142e4d02210caa8936777f747f31f7ce064f9.zip
Rollup merge of #131764 - Zalathar:double-dir, r=jieyouxu
Fix unnecessary nesting in run-make test output directories

Run-make tests were using `output_base_name` to determine their output directory, which results in a redundant subdirectory (e.g. `$build/test/run-make/<foo>/<foo>/`) because that method is intended to produce the name of an individual file.

The previous attempt to fix this double-nesting tried adding a special case in `output_base_dir`, which had the side-effect of breaking up-to-date checking for run-make tests, and had to be reverted in #131681.

The fix is simply to call `output_base_dir` directory, which gives the desired directory without any redundant part.

r? jieyouxu
-rw-r--r--src/tools/compiletest/src/runtest/run_make.rs6
-rw-r--r--tests/run-make/README.md2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/tools/compiletest/src/runtest/run_make.rs b/src/tools/compiletest/src/runtest/run_make.rs
index 75fe6a6baaf..f8ffd0fbe3f 100644
--- a/src/tools/compiletest/src/runtest/run_make.rs
+++ b/src/tools/compiletest/src/runtest/run_make.rs
@@ -22,6 +22,10 @@ impl TestCx<'_> {
         let src_root = self.config.src_base.parent().unwrap().parent().unwrap();
         let src_root = cwd.join(&src_root);
 
+        // FIXME(Zalathar): This should probably be `output_base_dir` to avoid
+        // an unnecessary extra subdirectory, but since legacy Makefile tests
+        // are hopefully going away, it seems safer to leave this perilous code
+        // as-is until it can all be deleted.
         let tmpdir = cwd.join(self.output_base_name());
         if tmpdir.exists() {
             self.aggressive_rm_rf(&tmpdir).unwrap();
@@ -213,7 +217,7 @@ impl TestCx<'_> {
         // `rmake_out/` directory.
         //
         // This setup intentionally diverges from legacy Makefile run-make tests.
-        let base_dir = self.output_base_name();
+        let base_dir = self.output_base_dir();
         if base_dir.exists() {
             self.aggressive_rm_rf(&base_dir).unwrap();
         }
diff --git a/tests/run-make/README.md b/tests/run-make/README.md
index 9e1eaa881c9..40359903473 100644
--- a/tests/run-make/README.md
+++ b/tests/run-make/README.md
@@ -29,7 +29,7 @@ The setup for the `rmake.rs` version is a 3-stage process:
    structure within `build/<target>/test/run-make/`
 
    ```
-   <test-name>/<test-name>/
+   <test-name>/
        rmake.exe              # recipe binary
        rmake_out/             # sources from test sources copied over
    ```