Skip to content

Commit

Permalink
rewrite pass-non-c-like-enum-to-c to rmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed Jul 17, 2024
1 parent bbad12f commit 5d40df3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
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");
}

0 comments on commit 5d40df3

Please sign in to comment.