mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
rewrite and rename issue-10971-temps-dir to rmake format
This commit is contained in:
@@ -79,7 +79,6 @@ run-make/invalid-library/Makefile
|
||||
run-make/invalid-so/Makefile
|
||||
run-make/invalid-staticlib/Makefile
|
||||
run-make/issue-107094/Makefile
|
||||
run-make/issue-10971-temps-dir/Makefile
|
||||
run-make/issue-109934-lto-debuginfo/Makefile
|
||||
run-make/issue-14698/Makefile
|
||||
run-make/issue-15460/Makefile
|
||||
|
||||
@@ -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
|
||||
@@ -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");
|
||||
}
|
||||
Reference in New Issue
Block a user