From 7c2b3b5615cf5e8545c13f7635257cc3fb0eb7bf Mon Sep 17 00:00:00 2001 From: Oneirical Date: Tue, 11 Jun 2024 12:53:33 -0400 Subject: [PATCH] rewrite output-with-hyphens to rmake format --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/output-with-hyphens/Makefile | 8 ------- tests/run-make/output-with-hyphens/rmake.rs | 17 ++++++++++++++ .../parallel-rustc-no-overwrite/rmake.rs | 22 ++++++++++--------- 4 files changed, 29 insertions(+), 19 deletions(-) delete mode 100644 tests/run-make/output-with-hyphens/Makefile create mode 100644 tests/run-make/output-with-hyphens/rmake.rs diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index dd6e64057b444..0d7951bcfffc0 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -156,7 +156,6 @@ run-make/optimization-remarks-dir/Makefile run-make/output-filename-conflicts-with-directory/Makefile run-make/output-filename-overwrites-input/Makefile run-make/output-type-permutations/Makefile -run-make/output-with-hyphens/Makefile run-make/override-aliased-flags/Makefile run-make/overwrite-input/Makefile run-make/panic-abort-eh_frame/Makefile diff --git a/tests/run-make/output-with-hyphens/Makefile b/tests/run-make/output-with-hyphens/Makefile deleted file mode 100644 index 846c9a66a89a0..0000000000000 --- a/tests/run-make/output-with-hyphens/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: - $(RUSTC) foo-bar.rs --crate-type bin - [ -f $(TMPDIR)/$(call BIN,foo-bar) ] - $(RUSTC) foo-bar.rs --crate-type lib - [ -f $(TMPDIR)/libfoo_bar.rlib ] diff --git a/tests/run-make/output-with-hyphens/rmake.rs b/tests/run-make/output-with-hyphens/rmake.rs new file mode 100644 index 0000000000000..21c003c628b9e --- /dev/null +++ b/tests/run-make/output-with-hyphens/rmake.rs @@ -0,0 +1,17 @@ +// Rust files with hyphens in their filename should +// not result in compiled libraries keeping that hyphen - +// it should become an underscore. Only bin executables +// should keep the hyphen. This test ensures that this rule +// remains enforced. +// See https://github.com/rust-lang/rust/pull/23786 + +//@ ignore-cross-compile + +use run_make_support::{path, rustc}; + +fn main() { + rustc().input("foo-bar.rs").crate_type("bin").run(); + assert!(path(bin_name("foo-bar")).exists()); + rustc().input("foo-bar.rs").crate_type("lib").run(); + assert!(path(bin_name("libfoo_bar.rlib")).exists()); +} diff --git a/tests/run-make/parallel-rustc-no-overwrite/rmake.rs b/tests/run-make/parallel-rustc-no-overwrite/rmake.rs index d45eb4f29116e..40c6ab7ed5ebf 100644 --- a/tests/run-make/parallel-rustc-no-overwrite/rmake.rs +++ b/tests/run-make/parallel-rustc-no-overwrite/rmake.rs @@ -6,17 +6,19 @@ // See https://github.com/rust-lang/rust/pull/83846 use run_make_support::{fs_wrapper, rustc}; +use std::sync::{Arc, Barrier}; 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"); + let barrier = Arc::new(Barrier::new(2)); + let handle = { + let barrier = Arc::clone(&barrier); + thread::spawn(move || { + barrier.wait(); + rustc().crate_type("lib").arg("-Ztemps-dir=temp1").input("lib.rs"); + }) + }; + barrier.wait(); + rustc().crate_type("staticlib").arg("-Ztemps-dir=temp2").input("lib.rs"); + handle.join().expect("lib thread panicked"); }