diff options
| author | bors <bors@rust-lang.org> | 2024-06-02 08:05:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-06-02 08:05:50 +0000 |
| commit | 13e2d7295ea42f842e57100b6349388bfe609a11 (patch) | |
| tree | cad04763a8075b687ff2df2bebafd9403c487f0a /compiler/rustc_interface/src/errors.rs | |
| parent | a83cf567b5949691de67f06895d9fe0404c40d27 (diff) | |
| parent | 45622450f8bcf4e39238ade6830873a30438e173 (diff) | |
| download | rust-13e2d7295ea42f842e57100b6349388bfe609a11.tar.gz rust-13e2d7295ea42f842e57100b6349388bfe609a11.zip | |
Auto merge of #125827 - jieyouxu:rmake-separate-tmp-dir, r=onur-ozkan
compiletest: split rmake.rs executable from scratch directory
When implementing support for rmake.rs, I copied over the `$TMPDIR` directory logic from the legacy Makefile setup. In doing so, I also compiled recipe `rmake.rs` into executables which unfortunately are placed into `$TMPDIR` as well.
This causes a problem on Windows (as observed in PRs like https://github.com/rust-lang/rust/pull/125752#issuecomment-2142577084) where:
- The `rmake.exe` executable is placed in `$TMPDIR`.
- We run the `rmake.exe` as a process.
- The process uses `rmake.exe` inside `$TMPDIR`.
- Windows prevents the .exe file from being deleted when the process is still alive.
- The recipe test code tries to `remove_dir_all($TMPDIR)`, which fails with access denied because `rmake.exe` is still being used.
We fix this by separating the recipe executable and the output artifacts directory:
```
base_dir/
rmake.exe
rmake_out/
```
We construct a base directory, unique to each run-make test, under which we place rmake.exe alongside a `rmake_out/` directory. This `rmake_out/` directory is what is passed to rmake.rs tests as `$TMPDIR`, so now `remove_dir_all($TMPDIR)` has a chance to succeed because it no longer contains `rmake.exe`.
This wasn't a problem for Makefile tests because there's no exe file under `$TMPDIR` whose process is still running when `rm -rf $TMPDIR` is called.
try-job: x86_64-msvc
Diffstat (limited to 'compiler/rustc_interface/src/errors.rs')
0 files changed, 0 insertions, 0 deletions
