about summary refs log tree commit diff
path: root/src/tools/compiletest
diff options
context:
space:
mode:
authorMateusz Mikuła <matti@marinelayer.io>2019-05-02 17:22:14 +0200
committerMateusz Mikuła <mati865@gmail.com>2019-05-10 16:12:47 +0200
commitf74debbe7d2bf43171270d5f3f5b42f2cc2e6243 (patch)
tree88f5daa4edb5816aff2bfe8b3cc6875d73bb83c4 /src/tools/compiletest
parent0ac53da03dad79655e2f3e65a58f94a2f3314d5f (diff)
downloadrust-f74debbe7d2bf43171270d5f3f5b42f2cc2e6243.tar.gz
rust-f74debbe7d2bf43171270d5f3f5b42f2cc2e6243.zip
Make tests compatible with musl host
Diffstat (limited to 'src/tools/compiletest')
-rw-r--r--src/tools/compiletest/src/runtest.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 3689946c055..10b8133326b 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1650,7 +1650,9 @@ impl<'test> TestCx<'test> {
                 (true, None)
             } else if self.config.target.contains("cloudabi")
                 || self.config.target.contains("emscripten")
-                || (self.config.target.contains("musl") && !aux_props.force_host)
+                || (self.config.target.contains("musl")
+                    && !aux_props.force_host
+                    && !self.config.host.contains("musl"))
                 || self.config.target.contains("wasm32")
                 || self.config.target.contains("nvptx")
             {
@@ -1932,6 +1934,11 @@ impl<'test> TestCx<'test> {
             }
         }
 
+        // Use dynamic musl for tests because static doesn't allow creating dylibs
+        if self.config.host.contains("musl") {
+            rustc.arg("-Ctarget-feature=-crt-static");
+        }
+
         rustc.args(&self.props.compile_flags);
 
         rustc
@@ -2725,6 +2732,12 @@ impl<'test> TestCx<'test> {
         // compiler flags set in the test cases:
         cmd.env_remove("RUSTFLAGS");
 
+        // Use dynamic musl for tests because static doesn't allow creating dylibs
+        if self.config.host.contains("musl") {
+            cmd.env("RUSTFLAGS", "-Ctarget-feature=-crt-static")
+                .env("IS_MUSL_HOST", "1");
+        }
+
         if self.config.target.contains("msvc") && self.config.cc != "" {
             // We need to pass a path to `lib.exe`, so assume that `cc` is `cl.exe`
             // and that `lib.exe` lives next to it.