Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate 9 more very similar FFI run-make tests to rmake #127663

Merged
merged 9 commits into from
Jul 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
@@ -1,8 +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
run-make/cat-and-grep-sanity-check/Makefile
Expand All @@ -22,9 +20,7 @@ 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
run-make/extern-multiple-copies2/Makefile
run-make/fmt-write-bloat/Makefile
Expand All @@ -37,7 +33,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
Expand All @@ -53,11 +48,9 @@ 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
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
Expand All @@ -66,7 +59,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
Expand All @@ -83,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
Expand Down
13 changes: 0 additions & 13 deletions tests/run-make/c-static-dylib/Makefile

This file was deleted.

20 changes: 20 additions & 0 deletions tests/run-make/c-static-dylib/rmake.rs
Original file line number Diff line number Diff line change
@@ -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, 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();
rfs::remove_file(static_lib_name("cfoo"));
run("bar");
rfs::remove_file(dynamic_lib_name("foo"));
run_fail("bar");
}
12 changes: 0 additions & 12 deletions tests/run-make/c-static-rlib/Makefile

This file was deleted.

17 changes: 17 additions & 0 deletions tests/run-make/c-static-rlib/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// 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, 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();
rfs::remove_file(rust_lib_name("foo"));
rfs::remove_file(static_lib_name("cfoo"));
run("bar");
}
7 changes: 0 additions & 7 deletions tests/run-make/extern-fn-generic/Makefile

This file was deleted.

16 changes: 16 additions & 0 deletions tests/run-make/extern-fn-generic/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// 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");
}
7 changes: 0 additions & 7 deletions tests/run-make/extern-fn-with-union/Makefile

This file was deleted.

16 changes: 16 additions & 0 deletions tests/run-make/extern-fn-with-union/rmake.rs
Original file line number Diff line number Diff line change
@@ -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");
}
7 changes: 0 additions & 7 deletions tests/run-make/issue-28595/Makefile

This file was deleted.

6 changes: 0 additions & 6 deletions tests/run-make/linkage-attr-on-static/Makefile

This file was deleted.

15 changes: 15 additions & 0 deletions tests/run-make/linkage-attr-on-static/rmake.rs
Original file line number Diff line number Diff line change
@@ -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");
}
9 changes: 0 additions & 9 deletions tests/run-make/lto-no-link-whole-rlib/Makefile

This file was deleted.

18 changes: 18 additions & 0 deletions tests/run-make/lto-no-link-whole-rlib/rmake.rs
Original file line number Diff line number Diff line change
@@ -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");
}
16 changes: 16 additions & 0 deletions tests/run-make/native-lib-load-order/rmake.rs
Original file line number Diff line number Diff line change
@@ -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");
}
6 changes: 0 additions & 6 deletions tests/run-make/pass-non-c-like-enum-to-c/Makefile

This file was deleted.

19 changes: 19 additions & 0 deletions tests/run-make/pass-non-c-like-enum-to-c/rmake.rs
Original file line number Diff line number Diff line change
@@ -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");
}
6 changes: 0 additions & 6 deletions tests/run-make/return-non-c-like-enum-from-c/Makefile

This file was deleted.

17 changes: 17 additions & 0 deletions tests/run-make/return-non-c-like-enum-from-c/rmake.rs
Original file line number Diff line number Diff line change
@@ -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");
}
Loading