diff options
| author | Oneirical <manchot@videotron.ca> | 2024-06-11 11:37:51 -0400 |
|---|---|---|
| committer | Oneirical <manchot@videotron.ca> | 2024-06-12 10:12:51 -0400 |
| commit | d2268902f7db32c03520f160f2d0e750d4d8d0b1 (patch) | |
| tree | f7c1af3153b3c7a60f38c0c9c71f52ec5d9b97f6 /tests | |
| parent | bbe9a9c20bac888efae2c7f033fb6cb3925a65b7 (diff) | |
| download | rust-d2268902f7db32c03520f160f2d0e750d4d8d0b1.tar.gz rust-d2268902f7db32c03520f160f2d0e750d4d8d0b1.zip | |
rewrite and rename issue-10971-temps-dir to rmake format
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/run-make/issue-10971-temps-dir/Makefile | 10 | ||||
| -rw-r--r-- | tests/run-make/parallel-rustc-no-overwrite/rmake.rs | 22 |
2 files changed, 22 insertions, 10 deletions
diff --git a/tests/run-make/issue-10971-temps-dir/Makefile b/tests/run-make/issue-10971-temps-dir/Makefile deleted file mode 100644 index 6e1649a58d2..00000000000 --- a/tests/run-make/issue-10971-temps-dir/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -# Regression test for issue #10971 -# Running two invocations in parallel would overwrite each other's temp files. - -all: - touch $(TMPDIR)/lib.rs - - $(RUSTC) --crate-type=lib -Z temps-dir=$(TMPDIR)/temp1 $(TMPDIR)/lib.rs & \ - $(RUSTC) --crate-type=staticlib -Z temps-dir=$(TMPDIR)/temp2 $(TMPDIR)/lib.rs diff --git a/tests/run-make/parallel-rustc-no-overwrite/rmake.rs b/tests/run-make/parallel-rustc-no-overwrite/rmake.rs new file mode 100644 index 00000000000..d45eb4f2911 --- /dev/null +++ b/tests/run-make/parallel-rustc-no-overwrite/rmake.rs @@ -0,0 +1,22 @@ +// When two instances of rustc are invoked in parallel, they +// can conflict on their temporary files and overwrite each others', +// leading to unsuccessful compilation. The -Z temps-dir flag adds +// separate designated directories for each rustc invocation, preventing +// conflicts. This test uses this flag and checks for successful compilation. +// See https://github.com/rust-lang/rust/pull/83846 + +use run_make_support::{fs_wrapper, rustc}; +use std::thread; + +fn main() { + fs_wrapper::create_file("lib.rs"); + let handle1 = thread::spawn(move || { + rustc().crate_type("lib").arg("-Ztemps-dir=temp1").input("lib.rs"); + }); + + let handle2 = thread::spawn(move || { + rustc().crate_type("staticlib").arg("-Ztemps-dir=temp2").input("lib.rs"); + }); + handle1.join().expect("lib thread panicked"); + handle2.join().expect("staticlib thread panicked"); +} |
