about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBaoshan <pangbw@gmail.com>2019-08-29 10:16:22 -0700
committerGitHub <noreply@github.com>2019-08-29 10:16:22 -0700
commit964c37cdecbd1aa0e7870afac9ba38e5168be65f (patch)
tree1813e5dd1e4efd5806f401968b4ed34b8c9c76ac
parent76f17219c71973fd4a58f2f8020eec4d8f5dcd11 (diff)
parent043c19c69c0beac3696cb82d44476ba4298a6b07 (diff)
downloadrust-964c37cdecbd1aa0e7870afac9ba38e5168be65f.tar.gz
rust-964c37cdecbd1aa0e7870afac9ba38e5168be65f.zip
Merge pull request #10 from Wind-River/bpang-runtest
run test for vxWorks in 'pure' static linking mode by default;
-rw-r--r--src/tools/compiletest/src/runtest.rs25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index a712a27015d..0bc77c6c502 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1725,14 +1725,25 @@ impl<'test> TestCx<'test> {
         }
     }
 
-    fn use_dynamic_linking(&self) -> bool {
+    fn is_vxworks_pure_static(&self) -> bool {
+        if self.config.target.contains("vxworks") {
+            match env::var("RUST_TEST_DYLINK") {
+                Ok(s) => s != "1",
+                _ => true
+            }
+        } else {
+            false
+        }
+    }
+
+    fn is_vxworks_pure_dynamic(&self) -> bool {
         if self.config.target.contains("vxworks") {
             match env::var("RUST_TEST_DYLINK") {
                 Ok(s) => s == "1",
                 _ => false
             }
         } else {
-            true
+            false
         }
     }
 
@@ -1779,7 +1790,7 @@ impl<'test> TestCx<'test> {
                     && !self.config.host.contains("musl"))
                 || self.config.target.contains("wasm32")
                 || self.config.target.contains("nvptx")
-                || !self.use_dynamic_linking()
+                || self.is_vxworks_pure_static()
             {
                 // We primarily compile all auxiliary libraries as dynamic libraries
                 // to avoid code size bloat and large binaries as much as possible
@@ -2012,13 +2023,10 @@ impl<'test> TestCx<'test> {
 
         if !is_rustdoc {
             if self.config.target == "wasm32-unknown-unknown"
-            || !self.use_dynamic_linking() {
+                || self.is_vxworks_pure_static() {
                 // rustc.arg("-g"); // get any backtrace at all on errors
             } else if !self.props.no_prefer_dynamic {
                 rustc.args(&["-C", "prefer-dynamic"]);
-                if self.config.target.contains("vxworks") {
-                    rustc.args(&["-C", "target-feature=-crt-static"]);
-                }
             }
         }
 
@@ -2060,7 +2068,8 @@ impl<'test> TestCx<'test> {
         }
 
         // Use dynamic musl for tests because static doesn't allow creating dylibs
-        if self.config.host.contains("musl") {
+        if self.config.host.contains("musl")
+            || self.is_vxworks_pure_dynamic() {
             rustc.arg("-Ctarget-feature=-crt-static");
         }