Skip to content

Commit

Permalink
Rollup merge of rust-lang#131764 - Zalathar:double-dir, r=jieyouxu
Browse files Browse the repository at this point in the history
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 rust-lang#131681.

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

r? jieyouxu
  • Loading branch information
Urgau authored Oct 16, 2024
2 parents 6b27c30 + 4cf0475 commit 43a142e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/tools/compiletest/src/runtest/run_make.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down

0 comments on commit 43a142e

Please sign in to comment.