Commit 13e2d72
committed
Auto merge of rust-lang#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 rust-lang#125752 (comment)) 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-msvc1 file changed
+24
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3431 | 3431 | | |
3432 | 3432 | | |
3433 | 3433 | | |
3434 | | - | |
3435 | | - | |
3436 | | - | |
| 3434 | + | |
| 3435 | + | |
| 3436 | + | |
| 3437 | + | |
| 3438 | + | |
| 3439 | + | |
| 3440 | + | |
| 3441 | + | |
| 3442 | + | |
| 3443 | + | |
| 3444 | + | |
| 3445 | + | |
| 3446 | + | |
| 3447 | + | |
3437 | 3448 | | |
3438 | | - | |
| 3449 | + | |
| 3450 | + | |
3439 | 3451 | | |
3440 | 3452 | | |
3441 | 3453 | | |
| |||
3452 | 3464 | | |
3453 | 3465 | | |
3454 | 3466 | | |
3455 | | - | |
3456 | | - | |
| 3467 | + | |
| 3468 | + | |
| 3469 | + | |
| 3470 | + | |
| 3471 | + | |
3457 | 3472 | | |
3458 | 3473 | | |
3459 | 3474 | | |
| |||
3494 | 3509 | | |
3495 | 3510 | | |
3496 | 3511 | | |
3497 | | - | |
| 3512 | + | |
3498 | 3513 | | |
3499 | 3514 | | |
3500 | 3515 | | |
| |||
3530 | 3545 | | |
3531 | 3546 | | |
3532 | 3547 | | |
3533 | | - | |
| 3548 | + | |
3534 | 3549 | | |
3535 | 3550 | | |
3536 | 3551 | | |
| |||
3546 | 3561 | | |
3547 | 3562 | | |
3548 | 3563 | | |
3549 | | - | |
| 3564 | + | |
3550 | 3565 | | |
3551 | 3566 | | |
3552 | 3567 | | |
| |||
0 commit comments