From c68d25b0977b5415fdffb48c381ee1c49fb31322 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Mon, 8 Jul 2024 15:06:16 -0400 Subject: [PATCH] rewrite extern-fn-mangle to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/extern-fn-mangle/Makefile | 6 ------ tests/run-make/extern-fn-mangle/rmake.rs | 16 ++++++++++++++++ 3 files changed, 16 insertions(+), 7 deletions(-) delete mode 100644 tests/run-make/extern-fn-mangle/Makefile create mode 100644 tests/run-make/extern-fn-mangle/rmake.rs diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 1c6fc57bd81..2c272706e7d 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -25,7 +25,6 @@ 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-mangle/Makefile run-make/extern-fn-reachable/Makefile run-make/extern-fn-with-union/Makefile run-make/extern-multiple-copies/Makefile diff --git a/tests/run-make/extern-fn-mangle/Makefile b/tests/run-make/extern-fn-mangle/Makefile deleted file mode 100644 index 3cbbf383996..00000000000 --- a/tests/run-make/extern-fn-mangle/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: $(call NATIVE_STATICLIB,test) - $(RUSTC) test.rs - $(call RUN,test) || exit 1 diff --git a/tests/run-make/extern-fn-mangle/rmake.rs b/tests/run-make/extern-fn-mangle/rmake.rs new file mode 100644 index 00000000000..3db8b2a0db0 --- /dev/null +++ b/tests/run-make/extern-fn-mangle/rmake.rs @@ -0,0 +1,16 @@ +// In this test, the functions foo() and bar() must avoid being mangled, as +// the external C function depends on them to return the correct sum of 3 + 5 = 8. +// This test therefore checks that the compiled and executed program respects the +// #[no_mangle] flags successfully. +// 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("test.rs").run(); + run("test"); +}