From d9d013bec077600b8b0dc25e51191802d1e11cd9 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Mon, 27 May 2024 20:57:01 -0400 Subject: [PATCH 1/3] rewrite lto-smoke to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/lto-smoke/Makefile | 31 ------------------- tests/run-make/lto-smoke/rmake.rs | 13 ++++++++ 3 files changed, 13 insertions(+), 32 deletions(-) delete mode 100644 tests/run-make/lto-smoke/Makefile create mode 100644 tests/run-make/lto-smoke/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 2329b8b44dea0..baf341277c76a 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -145,7 +145,6 @@ run-make/lto-linkage-used-attr/Makefile run-make/lto-no-link-whole-rlib/Makefile run-make/lto-readonly-lib/Makefile run-make/lto-smoke-c/Makefile -run-make/lto-smoke/Makefile run-make/macos-deployment-target/Makefile run-make/macos-fat-archive/Makefile run-make/manual-crate-name/Makefile diff --git a/tests/run-make/lto-smoke/Makefile b/tests/run-make/lto-smoke/Makefile deleted file mode 100644 index 13a09fce73404..0000000000000 --- a/tests/run-make/lto-smoke/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: noparam bool_true bool_false thin fat - -noparam: - $(RUSTC) lib.rs - $(RUSTC) main.rs -C lto - $(call RUN,main) - -bool_true: - $(RUSTC) lib.rs - $(RUSTC) main.rs -C lto=yes - $(call RUN,main) - - -bool_false: - $(RUSTC) lib.rs - $(RUSTC) main.rs -C lto=off - $(call RUN,main) - -thin: - $(RUSTC) lib.rs - $(RUSTC) main.rs -C lto=thin - $(call RUN,main) - -fat: - $(RUSTC) lib.rs - $(RUSTC) main.rs -C lto=fat - $(call RUN,main) - diff --git a/tests/run-make/lto-smoke/rmake.rs b/tests/run-make/lto-smoke/rmake.rs new file mode 100644 index 0000000000000..7294c32fbf826 --- /dev/null +++ b/tests/run-make/lto-smoke/rmake.rs @@ -0,0 +1,13 @@ +// A simple smoke test to check that link time optimization +// (LTO) works as intended, with its various flags turned on. +// See https://github.com/rust-lang/rust/issues/10741 + +//@ ignore-cross-compile + +fn main() { + let lto_flags = ["-Clto", "-Clto=yes", "-Clto=off", "-Clto=thin", "-Clto=fat"]; + for flag in lto_flags { + rustc().input(lib.rs).run(); + rustc().input(main.rs).arg(flag).run(); + } +} From 634270e8da47d36736c4f8d1c92266bed4e0cf82 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Mon, 27 May 2024 21:10:57 -0400 Subject: [PATCH 2/3] rewrite mixing-deps in rmake --- src/tools/tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/lto-smoke/rmake.rs | 2 ++ tests/run-make/mixing-deps/Makefile | 8 -------- tests/run-make/mixing-formats/rmake.rs | 13 +++++++++++++ 4 files changed, 15 insertions(+), 9 deletions(-) delete mode 100644 tests/run-make/mixing-deps/Makefile create mode 100644 tests/run-make/mixing-formats/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 baf341277c76a..6d79711e6864d 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/min-global-align/Makefile 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 diff --git a/tests/run-make/lto-smoke/rmake.rs b/tests/run-make/lto-smoke/rmake.rs index 7294c32fbf826..c0f181c108258 100644 --- a/tests/run-make/lto-smoke/rmake.rs +++ b/tests/run-make/lto-smoke/rmake.rs @@ -4,6 +4,8 @@ //@ ignore-cross-compile +use run_make_support::rustc; + fn main() { let lto_flags = ["-Clto", "-Clto=yes", "-Clto=off", "-Clto=thin", "-Clto=fat"]; for flag in lto_flags { diff --git a/tests/run-make/mixing-deps/Makefile b/tests/run-make/mixing-deps/Makefile deleted file mode 100644 index c2a5a2a0abbed..0000000000000 --- a/tests/run-make/mixing-deps/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: - $(RUSTC) both.rs -C prefer-dynamic - $(RUSTC) dylib.rs -C prefer-dynamic - $(RUSTC) prog.rs - $(call RUN,prog) diff --git a/tests/run-make/mixing-formats/rmake.rs b/tests/run-make/mixing-formats/rmake.rs new file mode 100644 index 0000000000000..fb31bbef9d19e --- /dev/null +++ b/tests/run-make/mixing-formats/rmake.rs @@ -0,0 +1,13 @@ +// This test invokes the main function in prog.rs, which has dependencies +// in both an rlib and a dylib. This test checks that these different library +// types can be successfully mixed. +//@ ignore-cross-compile + +use run_make_support::{run, rustc}; + +fn main() { + rustc().input("both.rs").arg("-Cprefer-dynamic").run(); + rustc().input("dylib.rs").arg("-Cprefer-dynamic").run(); + rustc().input("prog.rs").run(); + run("prog"); +} From cc97376adeba686f6d1e1d77c290a02d9d688a68 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Mon, 27 May 2024 21:19:58 -0400 Subject: [PATCH 3/3] Rewrite simple-rlib to rmake --- src/tools/tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/lto-smoke/rmake.rs | 7 ++++--- .../{mixing-formats => mixing-deps}/rmake.rs | 0 tests/run-make/simple-rlib/Makefile | 6 ------ tests/run-make/simple-rlib/bar.rs | 1 - tests/run-make/simple-rlib/foo.rs | 5 ----- tests/ui/imports/auxiliary/simple-rlib.rs | 2 ++ tests/ui/imports/simple-rlib-import.rs | 12 ++++++++++++ 8 files changed, 18 insertions(+), 16 deletions(-) rename tests/run-make/{mixing-formats => mixing-deps}/rmake.rs (100%) delete mode 100644 tests/run-make/simple-rlib/Makefile delete mode 100644 tests/run-make/simple-rlib/bar.rs delete mode 100644 tests/run-make/simple-rlib/foo.rs create mode 100644 tests/ui/imports/auxiliary/simple-rlib.rs create mode 100644 tests/ui/imports/simple-rlib-import.rs diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 6d79711e6864d..7ad5dec8a8494 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -237,7 +237,6 @@ run-make/short-ice/Makefile run-make/silly-file-names/Makefile run-make/simd-ffi/Makefile run-make/simple-dylib/Makefile -run-make/simple-rlib/Makefile run-make/split-debuginfo/Makefile run-make/stable-symbol-names/Makefile run-make/static-dylib-by-default/Makefile diff --git a/tests/run-make/lto-smoke/rmake.rs b/tests/run-make/lto-smoke/rmake.rs index c0f181c108258..692945135cd3d 100644 --- a/tests/run-make/lto-smoke/rmake.rs +++ b/tests/run-make/lto-smoke/rmake.rs @@ -1,5 +1,6 @@ // A simple smoke test to check that link time optimization -// (LTO) works as intended, with its various flags turned on. +// (LTO) is accepted by the compiler, and that +// passing its various flags still results in successful compilation. // See https://github.com/rust-lang/rust/issues/10741 //@ ignore-cross-compile @@ -9,7 +10,7 @@ use run_make_support::rustc; fn main() { let lto_flags = ["-Clto", "-Clto=yes", "-Clto=off", "-Clto=thin", "-Clto=fat"]; for flag in lto_flags { - rustc().input(lib.rs).run(); - rustc().input(main.rs).arg(flag).run(); + rustc().input("lib.rs").run(); + rustc().input("main.rs").arg(flag).run(); } } diff --git a/tests/run-make/mixing-formats/rmake.rs b/tests/run-make/mixing-deps/rmake.rs similarity index 100% rename from tests/run-make/mixing-formats/rmake.rs rename to tests/run-make/mixing-deps/rmake.rs diff --git a/tests/run-make/simple-rlib/Makefile b/tests/run-make/simple-rlib/Makefile deleted file mode 100644 index 28df61a15478d..0000000000000 --- a/tests/run-make/simple-rlib/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# ignore-cross-compile -include ../tools.mk -all: - $(RUSTC) bar.rs --crate-type=rlib - $(RUSTC) foo.rs - $(call RUN,foo) diff --git a/tests/run-make/simple-rlib/bar.rs b/tests/run-make/simple-rlib/bar.rs deleted file mode 100644 index c5c0bc606cd69..0000000000000 --- a/tests/run-make/simple-rlib/bar.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn bar() {} diff --git a/tests/run-make/simple-rlib/foo.rs b/tests/run-make/simple-rlib/foo.rs deleted file mode 100644 index 8d68535e3b647..0000000000000 --- a/tests/run-make/simple-rlib/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate bar; - -fn main() { - bar::bar(); -} diff --git a/tests/ui/imports/auxiliary/simple-rlib.rs b/tests/ui/imports/auxiliary/simple-rlib.rs new file mode 100644 index 0000000000000..28a6273840f6c --- /dev/null +++ b/tests/ui/imports/auxiliary/simple-rlib.rs @@ -0,0 +1,2 @@ +#![crate_type = "rlib"] +pub fn bar() {} diff --git a/tests/ui/imports/simple-rlib-import.rs b/tests/ui/imports/simple-rlib-import.rs new file mode 100644 index 0000000000000..6eab7ba04cfaf --- /dev/null +++ b/tests/ui/imports/simple-rlib-import.rs @@ -0,0 +1,12 @@ +// A simple test, where foo.rs has a dependency +// on the rlib (a static Rust-specific library format) bar.rs. If the test passes, +// rlibs can be built and linked into another file successfully.. + +//@ aux-crate:bar=simple-rlib.rs +//@ run-pass + +extern crate bar; + +fn main() { + bar::bar(); +}