Skip to content

run test for vxWorks in 'pure' static linking mode by default; #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
@@ -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");
}