about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBaoshan <pangbw@gmail.com>2019-08-21 08:27:56 -0700
committerGitHub <noreply@github.com>2019-08-21 08:27:56 -0700
commitb37d1073f6890d8b4fd38f1d6bb64143ec2f591a (patch)
tree1ed92c38a601ad21631311de1dc77beaa52726cd
parent0c8a14c7fb34d6edbc2b24495bb0774aeae27b98 (diff)
parent45d5f2256064306fdc3cc912ce5d6f569f6159b9 (diff)
downloadrust-b37d1073f6890d8b4fd38f1d6bb64143ec2f591a.tar.gz
rust-b37d1073f6890d8b4fd38f1d6bb64143ec2f591a.zip
Merge pull request #2 from Wind-River/bpang-runtest
Support static and dynamic linking mode for vxWorks in running test suite
-rw-r--r--src/tools/compiletest/src/runtest.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 3da6be74129..a712a27015d 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1725,6 +1725,17 @@ impl<'test> TestCx<'test> {
         }
     }
 
+    fn use_dynamic_linking(&self) -> bool {
+        if self.config.target.contains("vxworks") {
+            match env::var("RUST_TEST_DYLINK") {
+                Ok(s) => s == "1",
+                _ => false
+            }
+        } else {
+            true
+        }
+    }
+
     fn compose_and_run_compiler(&self, mut rustc: Command, input: Option<String>) -> ProcRes {
         let aux_dir = self.aux_output_dir_name();
 
@@ -1768,6 +1779,7 @@ impl<'test> TestCx<'test> {
                     && !self.config.host.contains("musl"))
                 || self.config.target.contains("wasm32")
                 || self.config.target.contains("nvptx")
+                || !self.use_dynamic_linking()
             {
                 // We primarily compile all auxiliary libraries as dynamic libraries
                 // to avoid code size bloat and large binaries as much as possible
@@ -1999,10 +2011,14 @@ impl<'test> TestCx<'test> {
         }
 
         if !is_rustdoc {
-            if self.config.target == "wasm32-unknown-unknown" {
+            if self.config.target == "wasm32-unknown-unknown"
+            || !self.use_dynamic_linking() {
                 // 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"]);
+                }
             }
         }