From 22953b3f52a06c5b4826d455fba526c36ef8cb58 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Tue, 28 May 2024 10:58:01 -0400 Subject: [PATCH 1/3] convert simple-dylib to ui test --- src/tools/tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/simple-dylib/Makefile | 6 ------ tests/run-make/simple-dylib/bar.rs | 1 - tests/run-make/simple-dylib/foo.rs | 5 ----- tests/ui/imports/auxiliary/simple-dylib.rs | 4 ++++ tests/ui/imports/simple-dylib-import.rs | 12 ++++++++++++ 6 files changed, 16 insertions(+), 13 deletions(-) delete mode 100644 tests/run-make/simple-dylib/Makefile delete mode 100644 tests/run-make/simple-dylib/bar.rs delete mode 100644 tests/run-make/simple-dylib/foo.rs create mode 100644 tests/ui/imports/auxiliary/simple-dylib.rs create mode 100644 tests/ui/imports/simple-dylib-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 75cd2b4c77317..1639286e90213 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -235,7 +235,6 @@ run-make/share-generics-dylib/Makefile run-make/short-ice/Makefile run-make/silly-file-names/Makefile run-make/simd-ffi/Makefile -run-make/simple-dylib/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/simple-dylib/Makefile b/tests/run-make/simple-dylib/Makefile deleted file mode 100644 index f3e1c1da88cec..0000000000000 --- a/tests/run-make/simple-dylib/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# ignore-cross-compile -include ../tools.mk -all: - $(RUSTC) bar.rs --crate-type=dylib -C prefer-dynamic - $(RUSTC) foo.rs - $(call RUN,foo) diff --git a/tests/run-make/simple-dylib/bar.rs b/tests/run-make/simple-dylib/bar.rs deleted file mode 100644 index c5c0bc606cd69..0000000000000 --- a/tests/run-make/simple-dylib/bar.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn bar() {} diff --git a/tests/run-make/simple-dylib/foo.rs b/tests/run-make/simple-dylib/foo.rs deleted file mode 100644 index 8d68535e3b647..0000000000000 --- a/tests/run-make/simple-dylib/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate bar; - -fn main() { - bar::bar(); -} diff --git a/tests/ui/imports/auxiliary/simple-dylib.rs b/tests/ui/imports/auxiliary/simple-dylib.rs new file mode 100644 index 0000000000000..1b5d85104ca15 --- /dev/null +++ b/tests/ui/imports/auxiliary/simple-dylib.rs @@ -0,0 +1,4 @@ +//@ compile-flags --crate-type=dylib -Cprefer-dynamic + +#![crate_type = "dylib"] +pub fn bar() {} diff --git a/tests/ui/imports/simple-dylib-import.rs b/tests/ui/imports/simple-dylib-import.rs new file mode 100644 index 0000000000000..7c7f3afec93b2 --- /dev/null +++ b/tests/ui/imports/simple-dylib-import.rs @@ -0,0 +1,12 @@ +// A simple test, where foo.rs has a dependency +// on the dynamic library simple-dylib.rs. If the test passes, +// dylibs can be built and linked into another file successfully.. + +//@ aux-crate: simple-dylib.rs +//@ run-pass + +extern crate bar; + +fn main() { + bar::bar(); +} From 0697884ea970ebca67b2de41dc1d380e66fd9c2b Mon Sep 17 00:00:00 2001 From: Oneirical Date: Tue, 28 May 2024 11:17:17 -0400 Subject: [PATCH 2/3] convert fpic to ui test --- tests/run-make/fpic/Makefile | 11 ----------- tests/run-make/fpic/hello.rs | 1 - tests/ui/errors/pic-linker.rs | 12 ++++++++++++ 3 files changed, 12 insertions(+), 12 deletions(-) delete mode 100644 tests/run-make/fpic/Makefile delete mode 100644 tests/run-make/fpic/hello.rs create mode 100644 tests/ui/errors/pic-linker.rs diff --git a/tests/run-make/fpic/Makefile b/tests/run-make/fpic/Makefile deleted file mode 100644 index d3754d17372ff..0000000000000 --- a/tests/run-make/fpic/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -# ignore-windows -# ignore-apple - -# Test for #39529. -# `-z text` causes ld to error if there are any non-PIC sections - -all: - $(RUSTC) hello.rs -C link-args=-Wl,-z,text diff --git a/tests/run-make/fpic/hello.rs b/tests/run-make/fpic/hello.rs deleted file mode 100644 index 45590d86ba6c5..0000000000000 --- a/tests/run-make/fpic/hello.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() { } diff --git a/tests/ui/errors/pic-linker.rs b/tests/ui/errors/pic-linker.rs new file mode 100644 index 0000000000000..9fea42484ed83 --- /dev/null +++ b/tests/ui/errors/pic-linker.rs @@ -0,0 +1,12 @@ +// `-z text` caused the linker to error if there were any non-position-independent +// code (PIC) sections. This test checks that this no longer happens. +// See https://github.com/rust-lang/rust/pull/39803 + +//@ ignore-windows +//@ ignore-macos +//@ ignore-cross-compile + +//@ compile-flags -Clink-args=-Wl,-z,text +//@ run-pass + +fn main() {} From 8c8d0db02deccea377e179948b8b3bfdd4b92e44 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Tue, 28 May 2024 11:35:33 -0400 Subject: [PATCH 3/3] rewrite and rename issue-37893 to rmake --- src/tools/tidy/src/allowed_run_make_makefiles.txt | 2 -- tests/run-make/issue-37893/Makefile | 5 ----- .../{issue-37893 => proc-macro-init-order}/a.rs | 0 .../{issue-37893 => proc-macro-init-order}/b.rs | 0 .../{issue-37893 => proc-macro-init-order}/c.rs | 0 tests/run-make/proc-macro-init-order/rmake.rs | 15 +++++++++++++++ tests/ui/errors/pic-linker.rs | 2 +- tests/ui/imports/auxiliary/simple-dylib.rs | 2 +- tests/ui/imports/simple-dylib-import.rs | 2 +- 9 files changed, 18 insertions(+), 10 deletions(-) delete mode 100644 tests/run-make/issue-37893/Makefile rename tests/run-make/{issue-37893 => proc-macro-init-order}/a.rs (100%) rename tests/run-make/{issue-37893 => proc-macro-init-order}/b.rs (100%) rename tests/run-make/{issue-37893 => proc-macro-init-order}/c.rs (100%) create mode 100644 tests/run-make/proc-macro-init-order/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 1639286e90213..c47361ebc0597 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -72,7 +72,6 @@ run-make/forced-unwind-terminate-pof/Makefile run-make/foreign-double-unwind/Makefile run-make/foreign-exceptions/Makefile run-make/foreign-rust-exceptions/Makefile -run-make/fpic/Makefile run-make/glibc-staticlib-args/Makefile run-make/inaccessible-temp-dir/Makefile run-make/include_bytes_deps/Makefile @@ -103,7 +102,6 @@ run-make/issue-33329/Makefile run-make/issue-35164/Makefile run-make/issue-36710/Makefile run-make/issue-37839/Makefile -run-make/issue-37893/Makefile run-make/issue-40535/Makefile run-make/issue-47384/Makefile run-make/issue-47551/Makefile diff --git a/tests/run-make/issue-37893/Makefile b/tests/run-make/issue-37893/Makefile deleted file mode 100644 index 44e4a321a30a5..0000000000000 --- a/tests/run-make/issue-37893/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: - $(RUSTC) a.rs && $(RUSTC) b.rs && $(RUSTC) c.rs diff --git a/tests/run-make/issue-37893/a.rs b/tests/run-make/proc-macro-init-order/a.rs similarity index 100% rename from tests/run-make/issue-37893/a.rs rename to tests/run-make/proc-macro-init-order/a.rs diff --git a/tests/run-make/issue-37893/b.rs b/tests/run-make/proc-macro-init-order/b.rs similarity index 100% rename from tests/run-make/issue-37893/b.rs rename to tests/run-make/proc-macro-init-order/b.rs diff --git a/tests/run-make/issue-37893/c.rs b/tests/run-make/proc-macro-init-order/c.rs similarity index 100% rename from tests/run-make/issue-37893/c.rs rename to tests/run-make/proc-macro-init-order/c.rs diff --git a/tests/run-make/proc-macro-init-order/rmake.rs b/tests/run-make/proc-macro-init-order/rmake.rs new file mode 100644 index 0000000000000..3c3fc813381c5 --- /dev/null +++ b/tests/run-make/proc-macro-init-order/rmake.rs @@ -0,0 +1,15 @@ +// a.rs is a procedural macro crate, on which b.rs and c.rs depend. A now +// patched bug caused a compilation failure if the proc-macro crate was +// initialized with its dependents in this exact order. This test checks +// that compilation succeeds even when initialization is done in this order. +// See https://github.com/rust-lang/rust/issues/37893 + +//@ ignore-cross-compile + +use run_make_support::rustc; + +fn main() { + rustc().input("a.rs").run(); + rustc().input("b.rs").run(); + rustc().input("c.rs").run(); +} diff --git a/tests/ui/errors/pic-linker.rs b/tests/ui/errors/pic-linker.rs index 9fea42484ed83..d90989903048e 100644 --- a/tests/ui/errors/pic-linker.rs +++ b/tests/ui/errors/pic-linker.rs @@ -6,7 +6,7 @@ //@ ignore-macos //@ ignore-cross-compile -//@ compile-flags -Clink-args=-Wl,-z,text +//@ compile-flags: -Clink-args=-Wl,-z,text //@ run-pass fn main() {} diff --git a/tests/ui/imports/auxiliary/simple-dylib.rs b/tests/ui/imports/auxiliary/simple-dylib.rs index 1b5d85104ca15..af64aa66f31b4 100644 --- a/tests/ui/imports/auxiliary/simple-dylib.rs +++ b/tests/ui/imports/auxiliary/simple-dylib.rs @@ -1,4 +1,4 @@ -//@ compile-flags --crate-type=dylib -Cprefer-dynamic +//@ compile-flags: -Cprefer-dynamic #![crate_type = "dylib"] pub fn bar() {} diff --git a/tests/ui/imports/simple-dylib-import.rs b/tests/ui/imports/simple-dylib-import.rs index 7c7f3afec93b2..d8ee3496b90dd 100644 --- a/tests/ui/imports/simple-dylib-import.rs +++ b/tests/ui/imports/simple-dylib-import.rs @@ -2,7 +2,7 @@ // on the dynamic library simple-dylib.rs. If the test passes, // dylibs can be built and linked into another file successfully.. -//@ aux-crate: simple-dylib.rs +//@ aux-crate:bar=simple-dylib.rs //@ run-pass extern crate bar;