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
Prev Previous commit
rewrite pass-non-c-like-enum-to-c to rmake
  • Loading branch information
Oneirical committed Jul 19, 2024
commit fdc8d62c962c401a096a9e4beb63a3b421570471
6 changes: 3 additions & 3 deletions tests/run-make/c-static-dylib/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
8 changes: 3 additions & 5 deletions tests/run-make/c-static-rlib/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
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");
}
Loading