From 5b1860a24e78fbe2d906574141e904c58c61a4ec Mon Sep 17 00:00:00 2001 From: Oneirical Date: Fri, 12 Jul 2024 14:33:16 -0400 Subject: [PATCH 1/9] rewrite return-non-c-like-enum-from-c to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - .../return-non-c-like-enum-from-c/Makefile | 6 ------ .../return-non-c-like-enum-from-c/rmake.rs | 17 +++++++++++++++++ 3 files changed, 17 insertions(+), 7 deletions(-) delete mode 100644 tests/run-make/return-non-c-like-enum-from-c/Makefile create mode 100644 tests/run-make/return-non-c-like-enum-from-c/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 bd25a6c144e64..07fd5d3e9b838 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -66,7 +66,6 @@ run-make/no-alloc-shim/Makefile run-make/no-builtins-attribute/Makefile run-make/no-duplicate-libs/Makefile run-make/panic-abort-eh_frame/Makefile -run-make/pass-non-c-like-enum-to-c/Makefile run-make/pdb-buildinfo-cl-cmd/Makefile run-make/pgo-gen-lto/Makefile run-make/pgo-gen-no-imp-symbols/Makefile diff --git a/tests/run-make/return-non-c-like-enum-from-c/Makefile b/tests/run-make/return-non-c-like-enum-from-c/Makefile deleted file mode 100644 index bd441d321bfab..0000000000000 --- a/tests/run-make/return-non-c-like-enum-from-c/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: $(call NATIVE_STATICLIB,test) - $(RUSTC) nonclike.rs -L$(TMPDIR) -ltest - $(call RUN,nonclike) diff --git a/tests/run-make/return-non-c-like-enum-from-c/rmake.rs b/tests/run-make/return-non-c-like-enum-from-c/rmake.rs new file mode 100644 index 0000000000000..f24bd6d5fc763 --- /dev/null +++ b/tests/run-make/return-non-c-like-enum-from-c/rmake.rs @@ -0,0 +1,17 @@ +// A reversed version of the `return-non-c-like-enum` test, though +// this time, the C code is the library, and the Rust code compiles +// into the executable. Once again, enum variants should be treated +// like an union of structs, which should prevent segfaults or +// unexpected results. +// See https://github.com/rust-lang/rust/issues/68190 + +//@ ignore-cross-compile +// Reason: the compiled binary is executed + +use run_make_support::{build_native_static_lib, run, rustc}; + +fn main() { + build_native_static_lib("test"); + rustc().input("nonclike.rs").arg("-ltest").run(); + run("nonclike"); +} From 5e55f07cc0d843dff89a1b29fb15b66e99391627 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Fri, 12 Jul 2024 14:57:05 -0400 Subject: [PATCH 2/9] rewrite and rename issue-28595 to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/issue-28595/Makefile | 7 ------- .../{issue-28595 => native-lib-load-order}/a.c | 0 .../{issue-28595 => native-lib-load-order}/a.rs | 0 .../{issue-28595 => native-lib-load-order}/b.c | 0 .../{issue-28595 => native-lib-load-order}/b.rs | 0 tests/run-make/native-lib-load-order/rmake.rs | 16 ++++++++++++++++ 7 files changed, 16 insertions(+), 8 deletions(-) delete mode 100644 tests/run-make/issue-28595/Makefile rename tests/run-make/{issue-28595 => native-lib-load-order}/a.c (100%) rename tests/run-make/{issue-28595 => native-lib-load-order}/a.rs (100%) rename tests/run-make/{issue-28595 => native-lib-load-order}/b.c (100%) rename tests/run-make/{issue-28595 => native-lib-load-order}/b.rs (100%) create mode 100644 tests/run-make/native-lib-load-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 07fd5d3e9b838..d935bb10d779c 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -37,7 +37,6 @@ run-make/interdependent-c-libraries/Makefile run-make/issue-107094/Makefile run-make/issue-14698/Makefile run-make/issue-15460/Makefile -run-make/issue-28595/Makefile run-make/issue-33329/Makefile run-make/issue-35164/Makefile run-make/issue-36710/Makefile diff --git a/tests/run-make/issue-28595/Makefile b/tests/run-make/issue-28595/Makefile deleted file mode 100644 index 258f9788aafa7..0000000000000 --- a/tests/run-make/issue-28595/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: $(call NATIVE_STATICLIB,a) $(call NATIVE_STATICLIB,b) - $(RUSTC) a.rs - $(RUSTC) b.rs - $(call RUN,b) diff --git a/tests/run-make/issue-28595/a.c b/tests/run-make/native-lib-load-order/a.c similarity index 100% rename from tests/run-make/issue-28595/a.c rename to tests/run-make/native-lib-load-order/a.c diff --git a/tests/run-make/issue-28595/a.rs b/tests/run-make/native-lib-load-order/a.rs similarity index 100% rename from tests/run-make/issue-28595/a.rs rename to tests/run-make/native-lib-load-order/a.rs diff --git a/tests/run-make/issue-28595/b.c b/tests/run-make/native-lib-load-order/b.c similarity index 100% rename from tests/run-make/issue-28595/b.c rename to tests/run-make/native-lib-load-order/b.c diff --git a/tests/run-make/issue-28595/b.rs b/tests/run-make/native-lib-load-order/b.rs similarity index 100% rename from tests/run-make/issue-28595/b.rs rename to tests/run-make/native-lib-load-order/b.rs diff --git a/tests/run-make/native-lib-load-order/rmake.rs b/tests/run-make/native-lib-load-order/rmake.rs new file mode 100644 index 0000000000000..ffe20a64168f8 --- /dev/null +++ b/tests/run-make/native-lib-load-order/rmake.rs @@ -0,0 +1,16 @@ +// An old compiler bug from 2015 caused native libraries to be loaded in the +// wrong order, causing `b` to be loaded before `a` in this test. If the compilation +// is successful, the libraries were loaded in the correct order. + +//@ ignore-cross-compile +// Reason: the compiled binary is executed + +use run_make_support::{build_native_static_lib, run, rustc}; + +fn main() { + build_native_static_lib("a"); + build_native_static_lib("b"); + rustc().input("a.rs").run(); + rustc().input("b.rs").run(); + run("b"); +} From 1ae1ab8215c3ba2c9c0066d1aa13a033f0f94d5e Mon Sep 17 00:00:00 2001 From: Oneirical Date: Fri, 12 Jul 2024 15:14:12 -0400 Subject: [PATCH 3/9] rewrite c-static-dylib to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/c-static-dylib/Makefile | 13 ------------ tests/run-make/c-static-dylib/rmake.rs | 20 +++++++++++++++++++ 3 files changed, 20 insertions(+), 14 deletions(-) delete mode 100644 tests/run-make/c-static-dylib/Makefile create mode 100644 tests/run-make/c-static-dylib/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 d935bb10d779c..4b5ab3b063f58 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -1,7 +1,6 @@ run-make/branch-protection-check-IBT/Makefile run-make/c-dynamic-dylib/Makefile run-make/c-dynamic-rlib/Makefile -run-make/c-static-dylib/Makefile run-make/c-static-rlib/Makefile run-make/c-unwind-abi-catch-lib-panic/Makefile run-make/c-unwind-abi-catch-panic/Makefile diff --git a/tests/run-make/c-static-dylib/Makefile b/tests/run-make/c-static-dylib/Makefile deleted file mode 100644 index 05da1743c83ba..0000000000000 --- a/tests/run-make/c-static-dylib/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# This test checks that static Rust linking with C does not encounter any errors, with dynamic dependencies given preference over static. -# See https://github.com/rust-lang/rust/issues/10434 - -# ignore-cross-compile -include ../tools.mk - -all: $(call NATIVE_STATICLIB,cfoo) - $(RUSTC) foo.rs -C prefer-dynamic - $(RUSTC) bar.rs - rm $(call NATIVE_STATICLIB,cfoo) - $(call RUN,bar) - $(call REMOVE_DYLIBS,foo) - $(call FAIL,bar) diff --git a/tests/run-make/c-static-dylib/rmake.rs b/tests/run-make/c-static-dylib/rmake.rs new file mode 100644 index 0000000000000..32edcd93feff3 --- /dev/null +++ b/tests/run-make/c-static-dylib/rmake.rs @@ -0,0 +1,20 @@ +// This test checks that static Rust linking with C does not encounter any errors, +// with dynamic dependencies given preference over static. +// See https://github.com/rust-lang/rust/issues/10434 + +//@ ignore-cross-compile +// Reason: the compiled binary is executed + +use run_make_support::{ + build_native_static_lib, dynamic_lib_name, fs_wrapper, run, run_fail, rustc, static_lib_name, +}; + +fn main() { + build_native_static_lib("cfoo"); + rustc().input("foo.rs").arg("-Cprefer-dynamic").run(); + rustc().input("bar.rs").run(); + fs_wrapper::remove_file(static_lib_name("cfoo")); + run("bar"); + fs_wrapper::remove_file(dynamic_lib_name("foo")); + run_fail("bar"); +} From 1a4fba5eb089d0c5413ed615c6e276eb76969535 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Fri, 12 Jul 2024 15:16:53 -0400 Subject: [PATCH 4/9] rewrite c-static-rlib to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/c-static-rlib/Makefile | 12 ------------ tests/run-make/c-static-rlib/rmake.rs | 19 +++++++++++++++++++ 3 files changed, 19 insertions(+), 13 deletions(-) delete mode 100644 tests/run-make/c-static-rlib/Makefile create mode 100644 tests/run-make/c-static-rlib/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 4b5ab3b063f58..0defdb373634c 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -1,7 +1,6 @@ run-make/branch-protection-check-IBT/Makefile run-make/c-dynamic-dylib/Makefile run-make/c-dynamic-rlib/Makefile -run-make/c-static-rlib/Makefile run-make/c-unwind-abi-catch-lib-panic/Makefile run-make/c-unwind-abi-catch-panic/Makefile run-make/cat-and-grep-sanity-check/Makefile diff --git a/tests/run-make/c-static-rlib/Makefile b/tests/run-make/c-static-rlib/Makefile deleted file mode 100644 index 298e432cdb8ad..0000000000000 --- a/tests/run-make/c-static-rlib/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# This test checks that static Rust linking with C does not encounter any errors, with static dependencies given preference over dynamic. (This is the default behaviour.) -# See https://github.com/rust-lang/rust/issues/10434 - -# ignore-cross-compile -include ../tools.mk - -all: $(call NATIVE_STATICLIB,cfoo) - $(RUSTC) foo.rs - $(RUSTC) bar.rs - $(call REMOVE_RLIBS,foo) - rm $(call NATIVE_STATICLIB,cfoo) - $(call RUN,bar) diff --git a/tests/run-make/c-static-rlib/rmake.rs b/tests/run-make/c-static-rlib/rmake.rs new file mode 100644 index 0000000000000..3d582dca98e12 --- /dev/null +++ b/tests/run-make/c-static-rlib/rmake.rs @@ -0,0 +1,19 @@ +// This test checks that static Rust linking with C does not encounter any errors, +// with static dependencies given preference over dynamic. (This is the default behaviour.) +// See https://github.com/rust-lang/rust/issues/10434 + +//@ ignore-cross-compile +// Reason: the compiled binary is executed + +use run_make_support::{ + build_native_static_lib, fs_wrapper, run, rust_lib_name, rustc, static_lib_name, +}; + +fn main() { + build_native_static_lib("cfoo"); + rustc().input("foo.rs").run(); + rustc().input("bar.rs").run(); + fs_wrapper::remove_file(rust_lib_name("foo")); + fs_wrapper::remove_file(static_lib_name("cfoo")); + run("bar"); +} From 8a09f2231d91fad0ff09ec4d4b3a89ff0376f860 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Fri, 12 Jul 2024 15:24:18 -0400 Subject: [PATCH 5/9] rewrite extern-fn-generic to rmake --- src/tools/tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/extern-fn-generic/Makefile | 7 ------- tests/run-make/extern-fn-generic/rmake.rs | 15 +++++++++++++++ 3 files changed, 15 insertions(+), 8 deletions(-) delete mode 100644 tests/run-make/extern-fn-generic/Makefile create mode 100644 tests/run-make/extern-fn-generic/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 0defdb373634c..ef18b6f16a270 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -20,7 +20,6 @@ run-make/emit-to-stdout/Makefile run-make/export-executable-symbols/Makefile run-make/extern-diff-internal-name/Makefile run-make/extern-flag-disambiguates/Makefile -run-make/extern-fn-generic/Makefile run-make/extern-fn-reachable/Makefile run-make/extern-fn-with-union/Makefile run-make/extern-multiple-copies/Makefile diff --git a/tests/run-make/extern-fn-generic/Makefile b/tests/run-make/extern-fn-generic/Makefile deleted file mode 100644 index 7dceea6cb887c..0000000000000 --- a/tests/run-make/extern-fn-generic/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: $(call NATIVE_STATICLIB,test) - $(RUSTC) testcrate.rs - $(RUSTC) test.rs - $(call RUN,test) || exit 1 diff --git a/tests/run-make/extern-fn-generic/rmake.rs b/tests/run-make/extern-fn-generic/rmake.rs new file mode 100644 index 0000000000000..3dee1e20544e2 --- /dev/null +++ b/tests/run-make/extern-fn-generic/rmake.rs @@ -0,0 +1,15 @@ +// Generic types in foreign-function interfaces were introduced in #15831 - this +// test simply runs a Rust program containing generics that is also reliant on +// a C library, and checks that compilation and execution are successful. +// See https://github.com/rust-lang/rust/pull/15831 +//@ ignore-cross-compile +// Reason: the compiled binary is executed + +use run_make_support::{build_native_static_lib, run, rustc}; + +fn main() { + build_native_static_lib("test"); + rustc().input("testcrate.rs").run(); + rustc().input("test.rs").run(); + run("test"); +} From 01c7118fa99a0c1f2df47b25c63fae6f62ef6ed1 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Fri, 12 Jul 2024 15:32:46 -0400 Subject: [PATCH 6/9] rewrite extern-fn-with-union to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/extern-fn-generic/rmake.rs | 1 + tests/run-make/extern-fn-with-union/Makefile | 7 ------- tests/run-make/extern-fn-with-union/rmake.rs | 16 ++++++++++++++++ 4 files changed, 17 insertions(+), 8 deletions(-) delete mode 100644 tests/run-make/extern-fn-with-union/Makefile create mode 100644 tests/run-make/extern-fn-with-union/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 ef18b6f16a270..421097a4bdf8c 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -21,7 +21,6 @@ run-make/export-executable-symbols/Makefile run-make/extern-diff-internal-name/Makefile run-make/extern-flag-disambiguates/Makefile run-make/extern-fn-reachable/Makefile -run-make/extern-fn-with-union/Makefile run-make/extern-multiple-copies/Makefile run-make/extern-multiple-copies2/Makefile run-make/fmt-write-bloat/Makefile diff --git a/tests/run-make/extern-fn-generic/rmake.rs b/tests/run-make/extern-fn-generic/rmake.rs index 3dee1e20544e2..05de839a1b0d8 100644 --- a/tests/run-make/extern-fn-generic/rmake.rs +++ b/tests/run-make/extern-fn-generic/rmake.rs @@ -2,6 +2,7 @@ // test simply runs a Rust program containing generics that is also reliant on // a C library, and checks that compilation and execution are successful. // See https://github.com/rust-lang/rust/pull/15831 + //@ ignore-cross-compile // Reason: the compiled binary is executed diff --git a/tests/run-make/extern-fn-with-union/Makefile b/tests/run-make/extern-fn-with-union/Makefile deleted file mode 100644 index e6c8c9936791b..0000000000000 --- a/tests/run-make/extern-fn-with-union/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: $(call NATIVE_STATICLIB,ctest) - $(RUSTC) testcrate.rs - $(RUSTC) test.rs - $(call RUN,test) || exit 1 diff --git a/tests/run-make/extern-fn-with-union/rmake.rs b/tests/run-make/extern-fn-with-union/rmake.rs new file mode 100644 index 0000000000000..200602eabeb5c --- /dev/null +++ b/tests/run-make/extern-fn-with-union/rmake.rs @@ -0,0 +1,16 @@ +// If an external function from foreign-function interface was called upon, +// its attributes would only be passed to LLVM if and only if it was called in the same crate. +// This caused passing around unions to be incorrect. +// See https://github.com/rust-lang/rust/pull/14191 + +//@ ignore-cross-compile +// Reason: the compiled binary is executed + +use run_make_support::{build_native_static_lib, run, rustc}; + +fn main() { + build_native_static_lib("ctest"); + rustc().input("testcrate.rs").run(); + rustc().input("test.rs").run(); + run("test"); +} From db8398db6f79ad70ce4598372bf807c68b62ea13 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Fri, 12 Jul 2024 15:49:26 -0400 Subject: [PATCH 7/9] rewrite lto-no-link-whole-rlib to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/lto-no-link-whole-rlib/Makefile | 9 --------- tests/run-make/lto-no-link-whole-rlib/rmake.rs | 18 ++++++++++++++++++ 3 files changed, 18 insertions(+), 10 deletions(-) delete mode 100644 tests/run-make/lto-no-link-whole-rlib/Makefile create mode 100644 tests/run-make/lto-no-link-whole-rlib/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 421097a4bdf8c..3f5de1f7c1528 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -52,7 +52,6 @@ run-make/linkage-attr-on-static/Makefile run-make/long-linker-command-lines-cmd-exe/Makefile run-make/long-linker-command-lines/Makefile run-make/lto-linkage-used-attr/Makefile -run-make/lto-no-link-whole-rlib/Makefile run-make/macos-deployment-target/Makefile run-make/min-global-align/Makefile run-make/native-link-modifier-bundle/Makefile diff --git a/tests/run-make/lto-no-link-whole-rlib/Makefile b/tests/run-make/lto-no-link-whole-rlib/Makefile deleted file mode 100644 index 3e82322e72d34..0000000000000 --- a/tests/run-make/lto-no-link-whole-rlib/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: $(call NATIVE_STATICLIB,foo) $(call NATIVE_STATICLIB,bar) - $(RUSTC) lib1.rs - $(RUSTC) lib2.rs - $(RUSTC) main.rs -Clto - $(call RUN,main) - diff --git a/tests/run-make/lto-no-link-whole-rlib/rmake.rs b/tests/run-make/lto-no-link-whole-rlib/rmake.rs new file mode 100644 index 0000000000000..8cd653d5f0866 --- /dev/null +++ b/tests/run-make/lto-no-link-whole-rlib/rmake.rs @@ -0,0 +1,18 @@ +// In order to improve linking performance, entire rlibs will only be linked if a dylib is being +// created. Otherwise, an executable will only link one rlib as usual. Linking will fail in this +// test should this optimization be reverted. +// See https://github.com/rust-lang/rust/pull/31460 + +//@ ignore-cross-compile +// Reason: the compiled binary is executed + +use run_make_support::{build_native_static_lib, run, rustc}; + +fn main() { + build_native_static_lib("foo"); + build_native_static_lib("bar"); + rustc().input("lib1.rs").run(); + rustc().input("lib2.rs").run(); + rustc().input("main.rs").arg("-Clto").run(); + run("main"); +} From 1f976b43da767ae3926df75ccfda279159038bcb Mon Sep 17 00:00:00 2001 From: Oneirical Date: Fri, 12 Jul 2024 15:58:06 -0400 Subject: [PATCH 8/9] rewrite linkage-attr-on-static to rmake --- src/tools/tidy/src/allowed_run_make_makefiles.txt | 2 -- tests/run-make/linkage-attr-on-static/Makefile | 6 ------ tests/run-make/linkage-attr-on-static/rmake.rs | 15 +++++++++++++++ tests/run-make/pass-non-c-like-enum-to-c/Makefile | 6 ------ 4 files changed, 15 insertions(+), 14 deletions(-) delete mode 100644 tests/run-make/linkage-attr-on-static/Makefile create mode 100644 tests/run-make/linkage-attr-on-static/rmake.rs delete mode 100644 tests/run-make/pass-non-c-like-enum-to-c/Makefile diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 3f5de1f7c1528..6a987c184df3a 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -48,7 +48,6 @@ run-make/libtest-junit/Makefile run-make/libtest-thread-limit/Makefile run-make/link-cfg/Makefile run-make/link-framework/Makefile -run-make/linkage-attr-on-static/Makefile run-make/long-linker-command-lines-cmd-exe/Makefile run-make/long-linker-command-lines/Makefile run-make/lto-linkage-used-attr/Makefile @@ -76,7 +75,6 @@ run-make/redundant-libs/Makefile run-make/remap-path-prefix-dwarf/Makefile run-make/reproducible-build-2/Makefile run-make/reproducible-build/Makefile -run-make/return-non-c-like-enum-from-c/Makefile run-make/rlib-format-packed-bundled-libs-2/Makefile run-make/rlib-format-packed-bundled-libs-3/Makefile run-make/rlib-format-packed-bundled-libs/Makefile diff --git a/tests/run-make/linkage-attr-on-static/Makefile b/tests/run-make/linkage-attr-on-static/Makefile deleted file mode 100644 index ef50a7ef9f13c..0000000000000 --- a/tests/run-make/linkage-attr-on-static/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: $(call NATIVE_STATICLIB,foo) - $(RUSTC) bar.rs - $(call RUN,bar) || exit 1 diff --git a/tests/run-make/linkage-attr-on-static/rmake.rs b/tests/run-make/linkage-attr-on-static/rmake.rs new file mode 100644 index 0000000000000..cd85542e9587d --- /dev/null +++ b/tests/run-make/linkage-attr-on-static/rmake.rs @@ -0,0 +1,15 @@ +// #[linkage] is a useful attribute which can be applied to statics to allow +// external linkage, something which was not possible before #18890. This test +// checks that using this new feature results in successful compilation and execution. +// See https://github.com/rust-lang/rust/pull/18890 + +//@ ignore-cross-compile +// Reason: the compiled binary is executed + +use run_make_support::{build_native_static_lib, run, rustc}; + +fn main() { + build_native_static_lib("foo"); + rustc().input("bar.rs").run(); + run("bar"); +} diff --git a/tests/run-make/pass-non-c-like-enum-to-c/Makefile b/tests/run-make/pass-non-c-like-enum-to-c/Makefile deleted file mode 100644 index bd441d321bfab..0000000000000 --- a/tests/run-make/pass-non-c-like-enum-to-c/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: $(call NATIVE_STATICLIB,test) - $(RUSTC) nonclike.rs -L$(TMPDIR) -ltest - $(call RUN,nonclike) From fdc8d62c962c401a096a9e4beb63a3b421570471 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Wed, 17 Jul 2024 15:23:55 -0400 Subject: [PATCH 9/9] rewrite pass-non-c-like-enum-to-c to rmake --- tests/run-make/c-static-dylib/rmake.rs | 6 +++--- tests/run-make/c-static-rlib/rmake.rs | 8 +++----- .../pass-non-c-like-enum-to-c/rmake.rs | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 tests/run-make/pass-non-c-like-enum-to-c/rmake.rs diff --git a/tests/run-make/c-static-dylib/rmake.rs b/tests/run-make/c-static-dylib/rmake.rs index 32edcd93feff3..12ec06c8199d6 100644 --- a/tests/run-make/c-static-dylib/rmake.rs +++ b/tests/run-make/c-static-dylib/rmake.rs @@ -6,15 +6,15 @@ // Reason: the compiled binary is executed use run_make_support::{ - build_native_static_lib, dynamic_lib_name, fs_wrapper, run, run_fail, rustc, static_lib_name, + build_native_static_lib, dynamic_lib_name, rfs, run, run_fail, rustc, static_lib_name, }; fn main() { build_native_static_lib("cfoo"); rustc().input("foo.rs").arg("-Cprefer-dynamic").run(); rustc().input("bar.rs").run(); - fs_wrapper::remove_file(static_lib_name("cfoo")); + rfs::remove_file(static_lib_name("cfoo")); run("bar"); - fs_wrapper::remove_file(dynamic_lib_name("foo")); + rfs::remove_file(dynamic_lib_name("foo")); run_fail("bar"); } diff --git a/tests/run-make/c-static-rlib/rmake.rs b/tests/run-make/c-static-rlib/rmake.rs index 3d582dca98e12..447e29a14f657 100644 --- a/tests/run-make/c-static-rlib/rmake.rs +++ b/tests/run-make/c-static-rlib/rmake.rs @@ -5,15 +5,13 @@ //@ ignore-cross-compile // Reason: the compiled binary is executed -use run_make_support::{ - build_native_static_lib, fs_wrapper, run, rust_lib_name, rustc, static_lib_name, -}; +use run_make_support::{build_native_static_lib, rfs, run, rust_lib_name, rustc, static_lib_name}; fn main() { build_native_static_lib("cfoo"); rustc().input("foo.rs").run(); rustc().input("bar.rs").run(); - fs_wrapper::remove_file(rust_lib_name("foo")); - fs_wrapper::remove_file(static_lib_name("cfoo")); + rfs::remove_file(rust_lib_name("foo")); + rfs::remove_file(static_lib_name("cfoo")); run("bar"); } diff --git a/tests/run-make/pass-non-c-like-enum-to-c/rmake.rs b/tests/run-make/pass-non-c-like-enum-to-c/rmake.rs new file mode 100644 index 0000000000000..c706e82f4a0cc --- /dev/null +++ b/tests/run-make/pass-non-c-like-enum-to-c/rmake.rs @@ -0,0 +1,19 @@ +// Similar to the `return-non-c-like-enum-from-c` test, where +// the C code is the library, and the Rust code compiles +// into the executable. Once again, enum variants should be treated +// like an union of structs, which should prevent segfaults or +// unexpected results. The only difference with the aforementioned +// test is that the structs are passed into C directly through the +// `tt_add` and `t_add` function calls. +// See https://github.com/rust-lang/rust/issues/68190 + +//@ ignore-cross-compile +// Reason: the compiled binary is executed + +use run_make_support::{build_native_static_lib, run, rustc}; + +fn main() { + build_native_static_lib("test"); + rustc().input("nonclike.rs").arg("-ltest").run(); + run("nonclike"); +}