From cd347a84d07143f43bc5b6e37e1ca07dfe84a34e Mon Sep 17 00:00:00 2001 From: Oneirical Date: Tue, 21 May 2024 15:52:00 -0400 Subject: [PATCH] Remove some allowed-makefiles --- .../tidy/src/allowed_run_make_makefiles.txt | 3 - tests/run-make/bare-outfile/rmake.rs | 6 +- tests/run-make/emit/rmake.rs | 8 +- tests/run-make/mixing-formats/rmake.rs | 130 +++++++++--------- 4 files changed, 75 insertions(+), 72 deletions(-) diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 3f4fceccab068..4bc06350441f9 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -3,7 +3,6 @@ run-make/allow-non-lint-warnings-cmdline/Makefile run-make/allow-warnings-cmdline-stability/Makefile run-make/archive-duplicate-names/Makefile run-make/atomic-lock-free/Makefile -run-make/bare-outfile/Makefile run-make/branch-protection-check-IBT/Makefile run-make/c-dynamic-dylib/Makefile run-make/c-dynamic-rlib/Makefile @@ -48,7 +47,6 @@ run-make/emit-path-unhashed/Makefile run-make/emit-shared-files/Makefile run-make/emit-stack-sizes/Makefile run-make/emit-to-stdout/Makefile -run-make/emit/Makefile run-make/env-dep-info/Makefile run-make/error-found-staticlib-instead-crate/Makefile run-make/error-writing-dependencies/Makefile @@ -165,7 +163,6 @@ run-make/mingw-export-call-convention/Makefile run-make/mismatching-target-triples/Makefile run-make/missing-crate-dependency/Makefile run-make/mixing-deps/Makefile -run-make/mixing-formats/Makefile run-make/mixing-libs/Makefile run-make/msvc-opt-minsize/Makefile run-make/multiple-emits/Makefile diff --git a/tests/run-make/bare-outfile/rmake.rs b/tests/run-make/bare-outfile/rmake.rs index c2b6347f96896..9b380102108c8 100644 --- a/tests/run-make/bare-outfile/rmake.rs +++ b/tests/run-make/bare-outfile/rmake.rs @@ -4,11 +4,11 @@ //@ ignore-cross-compile use run_make_support::{run, rustc, tmp_dir}; -use std::fs; use std::env; +use std::fs; -fn main(){ - fs::copy("foo.rs", tmp_dir()).unwrap(); +fn main() { + fs::copy("foo.rs", tmp_dir().join("foo.rs")).unwrap(); env::set_current_dir(tmp_dir()); rustc().output("foo").input("foo.rs"); run("foo"); diff --git a/tests/run-make/emit/rmake.rs b/tests/run-make/emit/rmake.rs index d3ccc7fdc27ad..8b3ddb66f9238 100644 --- a/tests/run-make/emit/rmake.rs +++ b/tests/run-make/emit/rmake.rs @@ -1,6 +1,6 @@ // A bug from 2015 would cause errors when emitting multiple types of files -// in the same rustc call. A fix was created in #30452. This test checks that -// the fix did not accidentally break compilation. +// in the same rustc call. A fix was created in #30452. This test checks that rustc still compiles +// a source file successfully when emission of multiple output artifacts are requested. // See https://github.com/rust-lang/rust/pull/30452 //@ ignore-cross-compile @@ -10,10 +10,10 @@ use run_make_support::{run, rustc}; fn main() { let opt_levels = ["0", "1", "2", "3", "s", "z"]; for level in opt_levels { - rustc().opt_level(level).emit("llvm-bc,llvm-ir,asm,obj,link").input("test-24876.rs"); + rustc().opt_level(level).emit("llvm-bc,llvm-ir,asm,obj,link").input("test-24876.rs").run(); } for level in opt_levels { - rustc().opt_level(level).emit("llvm-bc,llvm-ir,asm,obj,link").input("test-26235.rs"); + rustc().opt_level(level).emit("llvm-bc,llvm-ir,asm,obj,link").input("test-26235.rs").run(); run("test-26235"); } } diff --git a/tests/run-make/mixing-formats/rmake.rs b/tests/run-make/mixing-formats/rmake.rs index c80951a15975f..51a478f332a43 100644 --- a/tests/run-make/mixing-formats/rmake.rs +++ b/tests/run-make/mixing-formats/rmake.rs @@ -15,70 +15,76 @@ use run_make_support::{rustc, tmp_dir}; use std::fs; -fn main() { - // Building just baz - rustc().crate_type("rlib").input("foo.rs").run(); - rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run(); - rustc().crate_type("dylib,rlib").input("baz.rs").arg("-Cprefer-dynamic").run(); - rustc().crate_type("bin").input("baz.rs").run(); - fs::remove_dir_all(tmp_dir()).unwrap(); - fs::create_dir(tmp_dir()).unwrap(); - rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run(); - rustc().crate_type("rlib").input("bar1.rs").run(); - rustc().crate_type("dylib,rlib").input("baz.rs").arg("-Cprefer-dynamic").run(); - rustc().crate_type("bin").input("baz.rs").run(); - fs::remove_dir_all(tmp_dir()).unwrap(); - fs::create_dir(tmp_dir()).unwrap(); - // Building baz2 - rustc().crate_type("rlib").input("foo.rs").run(); - rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run(); - rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run(); - rustc().crate_type("dylib").input("baz2.rs").run_fail_assert_exit_code(1); - rustc().crate_type("bin").input("baz2.rs").run_fail_assert_exit_code(1); - fs::remove_dir_all(tmp_dir()).unwrap(); - fs::create_dir(tmp_dir()).unwrap(); - rustc().crate_type("rlib").input("foo.rs").run(); - rustc().crate_type("rlib").input("bar1.rs").run(); - rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run(); - rustc().crate_type("dylib,rlib").input("baz2.rs").run(); - rustc().crate_type("bin").input("baz2.rs").run; - fs::remove_dir_all(tmp_dir()).unwrap(); - fs::create_dir(tmp_dir()).unwrap(); - rustc().crate_type("rlib").input("foo.rs").run(); - rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run(); - rustc().crate_type("rlib").input("bar2.rs").run(); - rustc().crate_type("dylib,rlib").input("baz2.rs").arg("-Cprefer-dynamic").run(); - rustc().crate_type("bin").input("baz2.rs").run(); - fs::remove_dir_all(tmp_dir()).unwrap(); - fs::create_dir(tmp_dir()).unwrap(); - rustc().crate_type("rlib").input("foo.rs").run(); - rustc().crate_type("rlib").input("bar1.rs").run(); - rustc().crate_type("rlib").input("bar2.rs").run(); - rustc().crate_type("dylib,rlib").input("baz2.rs").arg("-Cprefer-dynamic").run(); - rustc().crate_type("bin").input("baz2.rs").run(); - fs::remove_dir_all(tmp_dir()).unwrap(); - fs::create_dir(tmp_dir()).unwrap(); - rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run(); - rustc().crate_type("rlib").input("bar1.rs").run(); - rustc().crate_type("rlib").input("bar2.rs").run(); - rustc().crate_type("dylib,rlib").input("baz2.rs").arg("-Cprefer-dynamic").run(); - rustc().crate_type("bin").input("baz2.rs").run(); - fs::remove_dir_all(tmp_dir()).unwrap(); - fs::create_dir(tmp_dir()).unwrap(); - rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run(); - rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run(); - rustc().crate_type("rlib").input("bar2.rs").run(); - rustc().crate_type("dylib,rlib").input("baz2.rs").run(); - rustc().crate_type("bin").input("baz2.rs").run(); - fs::remove_dir_all(tmp_dir()).unwrap(); - fs::create_dir(tmp_dir()).unwrap(); - rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run(); - rustc().crate_type("rlib").input("bar1.rs").run(); - rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run(); - rustc().crate_type("dylib,rlib").input("baz2.rs").run(); - rustc().crate_type("bin").input("baz2.rs").run(); +fn test_with_teardown(rustc_calls: &dyn Fn()) { + rustc_calls(); fs::remove_dir_all(tmp_dir()).unwrap(); fs::create_dir(tmp_dir()).unwrap(); +} + +fn main() { + test_with_teardown(&|| { + // Building just baz + rustc().crate_type("rlib").input("foo.rs").run(); + rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run(); + rustc().crate_type("dylib,rlib").input("baz.rs").arg("-Cprefer-dynamic").run(); + rustc().crate_type("bin").input("baz.rs").run(); + }); + test_with_teardown(&|| { + rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run(); + rustc().crate_type("rlib").input("bar1.rs").run(); + rustc().crate_type("dylib,rlib").input("baz.rs").arg("-Cprefer-dynamic").run(); + rustc().crate_type("bin").input("baz.rs").run(); + }); + test_with_teardown(&|| { + // Building baz2 + rustc().crate_type("rlib").input("foo.rs").run(); + rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run(); + rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run(); + rustc().crate_type("dylib").input("baz2.rs").run_fail_assert_exit_code(1); + rustc().crate_type("bin").input("baz2.rs").run_fail_assert_exit_code(1); + }); + test_with_teardown(&|| { + rustc().crate_type("rlib").input("foo.rs").run(); + rustc().crate_type("rlib").input("bar1.rs").run(); + rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run(); + rustc().crate_type("dylib,rlib").input("baz2.rs").run(); + rustc().crate_type("bin").input("baz2.rs").run(); + }); + test_with_teardown(&|| { + rustc().crate_type("rlib").input("foo.rs").run(); + rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run(); + rustc().crate_type("rlib").input("bar2.rs").run(); + rustc().crate_type("dylib,rlib").input("baz2.rs").arg("-Cprefer-dynamic").run(); + rustc().crate_type("bin").input("baz2.rs").run(); + }); + test_with_teardown(&|| { + rustc().crate_type("rlib").input("foo.rs").run(); + rustc().crate_type("rlib").input("bar1.rs").run(); + rustc().crate_type("rlib").input("bar2.rs").run(); + rustc().crate_type("dylib,rlib").input("baz2.rs").arg("-Cprefer-dynamic").run(); + rustc().crate_type("bin").input("baz2.rs").run(); + }); + test_with_teardown(&|| { + rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run(); + rustc().crate_type("rlib").input("bar1.rs").run(); + rustc().crate_type("rlib").input("bar2.rs").run(); + rustc().crate_type("dylib,rlib").input("baz2.rs").arg("-Cprefer-dynamic").run(); + rustc().crate_type("bin").input("baz2.rs").run(); + }); + test_with_teardown(&|| { + rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run(); + rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run(); + rustc().crate_type("rlib").input("bar2.rs").run(); + rustc().crate_type("dylib,rlib").input("baz2.rs").run(); + rustc().crate_type("bin").input("baz2.rs").run(); + }); + test_with_teardown(&|| { + rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run(); + rustc().crate_type("rlib").input("bar1.rs").run(); + rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run(); + rustc().crate_type("dylib,rlib").input("baz2.rs").run(); + rustc().crate_type("bin").input("baz2.rs").run(); + }); rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run(); rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run(); rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run();