From 7e0c203f2d4320ad2299a78f6d1dc8ae00cf5bc8 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 2 Jun 2024 11:51:08 +0200 Subject: [PATCH 1/4] Add new `MSVC_LIB_PATH` runtest environment variable to know location of the `msvc_lib` binary --- src/tools/compiletest/src/runtest.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 5398820313648..7e7f98a13548f 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -3382,6 +3382,7 @@ impl<'test> TestCx<'test> { cmd.env("IS_MSVC", "1") .env("IS_WINDOWS", "1") .env("MSVC_LIB", format!("'{}' -nologo", lib.display())) + .env("MSVC_LIB_PATH", format!("{}", lib.display())) .env("CC", format!("'{}' {}", self.config.cc, cflags)) .env("CXX", format!("'{}' {}", &self.config.cxx, cxxflags)); } else { @@ -3752,6 +3753,7 @@ impl<'test> TestCx<'test> { cmd.env("IS_MSVC", "1") .env("IS_WINDOWS", "1") .env("MSVC_LIB", format!("'{}' -nologo", lib.display())) + .env("MSVC_LIB_PATH", format!("{}", lib.display())) // Note: we diverge from legacy run_make and don't lump `CC` the compiler and // default flags together. .env("CC_DEFAULT_FLAGS", &cflags) From 84eee6890d49e067a86f2e844e2d3db2d3b395f2 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 2 Jun 2024 11:51:30 +0200 Subject: [PATCH 2/4] Add `run_make_support::build_native_static_lib` function From 5257ca7f4fcfe55d021d6d30a429b89aaf52a07a Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 2 Jun 2024 11:53:00 +0200 Subject: [PATCH 3/4] Migrate `run-make/issue-15460` to `rmake.rs` --- src/tools/tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/issue-15460/Makefile | 7 ------- tests/run-make/issue-15460/rmake.rs | 12 ++++++++++++ 3 files changed, 12 insertions(+), 8 deletions(-) delete mode 100644 tests/run-make/issue-15460/Makefile create mode 100644 tests/run-make/issue-15460/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 d6da40d3d78f0..3224fdb6933b3 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -27,7 +27,6 @@ run-make/foreign-rust-exceptions/Makefile run-make/incr-add-rust-src-component/Makefile run-make/incr-foreign-head-span/Makefile run-make/interdependent-c-libraries/Makefile -run-make/issue-15460/Makefile run-make/issue-35164/Makefile run-make/issue-36710/Makefile run-make/issue-47551/Makefile diff --git a/tests/run-make/issue-15460/Makefile b/tests/run-make/issue-15460/Makefile deleted file mode 100644 index a36a085fa6f18..0000000000000 --- a/tests/run-make/issue-15460/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: $(call NATIVE_STATICLIB,foo) - $(RUSTC) foo.rs -C extra-filename=-383hf8 -C prefer-dynamic - $(RUSTC) bar.rs - $(call RUN,bar) diff --git a/tests/run-make/issue-15460/rmake.rs b/tests/run-make/issue-15460/rmake.rs new file mode 100644 index 0000000000000..6f2c0d4e59536 --- /dev/null +++ b/tests/run-make/issue-15460/rmake.rs @@ -0,0 +1,12 @@ +//@ ignore-cross-compile + +use run_make_support::{build_native_static_lib, run, rustc}; + +fn main() { + build_native_static_lib("foo"); + + rustc().input("foo.rs").extra_filename("-383hf8").arg("-Cprefer-dynamic").run(); + rustc().input("bar.rs").run(); + + run("bar"); +} From 3de52521aea47df85394c69559008f555fb3ed40 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 2 Jun 2024 14:20:39 +0200 Subject: [PATCH 4/4] Rename `tests/run-make/issue-15460` into `tests/run-make/link-native-static-lib-to-dylib` --- .../{issue-15460 => link-native-static-lib-to-dylib}/bar.rs | 0 .../{issue-15460 => link-native-static-lib-to-dylib}/foo.c | 0 .../{issue-15460 => link-native-static-lib-to-dylib}/foo.rs | 0 .../{issue-15460 => link-native-static-lib-to-dylib}/rmake.rs | 2 ++ 4 files changed, 2 insertions(+) rename tests/run-make/{issue-15460 => link-native-static-lib-to-dylib}/bar.rs (100%) rename tests/run-make/{issue-15460 => link-native-static-lib-to-dylib}/foo.c (100%) rename tests/run-make/{issue-15460 => link-native-static-lib-to-dylib}/foo.rs (100%) rename tests/run-make/{issue-15460 => link-native-static-lib-to-dylib}/rmake.rs (78%) diff --git a/tests/run-make/issue-15460/bar.rs b/tests/run-make/link-native-static-lib-to-dylib/bar.rs similarity index 100% rename from tests/run-make/issue-15460/bar.rs rename to tests/run-make/link-native-static-lib-to-dylib/bar.rs diff --git a/tests/run-make/issue-15460/foo.c b/tests/run-make/link-native-static-lib-to-dylib/foo.c similarity index 100% rename from tests/run-make/issue-15460/foo.c rename to tests/run-make/link-native-static-lib-to-dylib/foo.c diff --git a/tests/run-make/issue-15460/foo.rs b/tests/run-make/link-native-static-lib-to-dylib/foo.rs similarity index 100% rename from tests/run-make/issue-15460/foo.rs rename to tests/run-make/link-native-static-lib-to-dylib/foo.rs diff --git a/tests/run-make/issue-15460/rmake.rs b/tests/run-make/link-native-static-lib-to-dylib/rmake.rs similarity index 78% rename from tests/run-make/issue-15460/rmake.rs rename to tests/run-make/link-native-static-lib-to-dylib/rmake.rs index 6f2c0d4e59536..0746c3963143b 100644 --- a/tests/run-make/issue-15460/rmake.rs +++ b/tests/run-make/link-native-static-lib-to-dylib/rmake.rs @@ -1,3 +1,5 @@ +// Regression test for . + //@ ignore-cross-compile use run_make_support::{build_native_static_lib, run, rustc};