Skip to content

Commit

Permalink
Merge pull request #2 from Wind-River/bpang-runtest
Browse files Browse the repository at this point in the history
Support static and dynamic linking mode for vxWorks in running test suite
  • Loading branch information
BaoshanPang authored Aug 21, 2019
2 parents 0c8a14c + 45d5f22 commit b37d107
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"]);
}
}
}

Expand Down

0 comments on commit b37d107

Please sign in to comment.