rewrite pass-non-c-like-enum-to-c to rmake

This commit is contained in:
Oneirical 2024-07-17 15:23:55 -04:00
parent 1f976b43da
commit fdc8d62c96
3 changed files with 25 additions and 8 deletions

View File

@ -6,15 +6,15 @@
// Reason: the compiled binary is executed // Reason: the compiled binary is executed
use run_make_support::{ 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() { fn main() {
build_native_static_lib("cfoo"); build_native_static_lib("cfoo");
rustc().input("foo.rs").arg("-Cprefer-dynamic").run(); rustc().input("foo.rs").arg("-Cprefer-dynamic").run();
rustc().input("bar.rs").run(); rustc().input("bar.rs").run();
fs_wrapper::remove_file(static_lib_name("cfoo")); rfs::remove_file(static_lib_name("cfoo"));
run("bar"); run("bar");
fs_wrapper::remove_file(dynamic_lib_name("foo")); rfs::remove_file(dynamic_lib_name("foo"));
run_fail("bar"); run_fail("bar");
} }

View File

@ -5,15 +5,13 @@
//@ ignore-cross-compile //@ ignore-cross-compile
// Reason: the compiled binary is executed // Reason: the compiled binary is executed
use run_make_support::{ use run_make_support::{build_native_static_lib, rfs, run, rust_lib_name, rustc, static_lib_name};
build_native_static_lib, fs_wrapper, run, rust_lib_name, rustc, static_lib_name,
};
fn main() { fn main() {
build_native_static_lib("cfoo"); build_native_static_lib("cfoo");
rustc().input("foo.rs").run(); rustc().input("foo.rs").run();
rustc().input("bar.rs").run(); rustc().input("bar.rs").run();
fs_wrapper::remove_file(rust_lib_name("foo")); rfs::remove_file(rust_lib_name("foo"));
fs_wrapper::remove_file(static_lib_name("cfoo")); rfs::remove_file(static_lib_name("cfoo"));
run("bar"); run("bar");
} }

View File

@ -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");
}