From fdc8d62c962c401a096a9e4beb63a3b421570471 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Wed, 17 Jul 2024 15:23:55 -0400 Subject: [PATCH] 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 32edcd93fef..12ec06c8199 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 3d582dca98e..447e29a14f6 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 00000000000..c706e82f4a0 --- /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"); +}