diff options
| author | Baoshan Pang <baoshan.pang@windriver.com> | 2019-08-16 13:56:03 -0700 |
|---|---|---|
| committer | Baoshan Pang <baoshan.pang@windriver.com> | 2019-08-27 16:54:16 -0700 |
| commit | cae6d66d9989857e321e0963142b08b1517dc723 (patch) | |
| tree | 9c3043259b3f35b9b2980f7354536af3f136a97e /src/tools/compiletest | |
| parent | 403e672c913643515a8c467352075ca854d62a2e (diff) | |
| download | rust-cae6d66d9989857e321e0963142b08b1517dc723.tar.gz rust-cae6d66d9989857e321e0963142b08b1517dc723.zip | |
run test for vxWorks in 'pure' static linking mode by default;
if environment variables 'RUST_TEST_DYLINK' is set to 1, then run test in 'pure' dynamic linking mode
Diffstat (limited to 'src/tools/compiletest')
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 3da6be74129..0bc77c6c502 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1725,6 +1725,28 @@ impl<'test> TestCx<'test> { } } + 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 { + false + } + } + fn compose_and_run_compiler(&self, mut rustc: Command, input: Option<String>) -> ProcRes { let aux_dir = self.aux_output_dir_name(); @@ -1768,6 +1790,7 @@ impl<'test> TestCx<'test> { && !self.config.host.contains("musl")) || self.config.target.contains("wasm32") || self.config.target.contains("nvptx") + || 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 @@ -1999,7 +2022,8 @@ impl<'test> TestCx<'test> { } if !is_rustdoc { - if self.config.target == "wasm32-unknown-unknown" { + if self.config.target == "wasm32-unknown-unknown" + || 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"]); @@ -2044,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"); } |
