Skip to content

Commit cae6d66

Browse files
committed
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
1 parent 403e672 commit cae6d66

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

Diff for: src/tools/compiletest/src/runtest.rs

+27-2
Original file line numberDiff line numberDiff line change
@@ -1725,6 +1725,28 @@ impl<'test> TestCx<'test> {
17251725
}
17261726
}
17271727

1728+
fn is_vxworks_pure_static(&self) -> bool {
1729+
if self.config.target.contains("vxworks") {
1730+
match env::var("RUST_TEST_DYLINK") {
1731+
Ok(s) => s != "1",
1732+
_ => true
1733+
}
1734+
} else {
1735+
false
1736+
}
1737+
}
1738+
1739+
fn is_vxworks_pure_dynamic(&self) -> bool {
1740+
if self.config.target.contains("vxworks") {
1741+
match env::var("RUST_TEST_DYLINK") {
1742+
Ok(s) => s == "1",
1743+
_ => false
1744+
}
1745+
} else {
1746+
false
1747+
}
1748+
}
1749+
17281750
fn compose_and_run_compiler(&self, mut rustc: Command, input: Option<String>) -> ProcRes {
17291751
let aux_dir = self.aux_output_dir_name();
17301752

@@ -1768,6 +1790,7 @@ impl<'test> TestCx<'test> {
17681790
&& !self.config.host.contains("musl"))
17691791
|| self.config.target.contains("wasm32")
17701792
|| self.config.target.contains("nvptx")
1793+
|| self.is_vxworks_pure_static()
17711794
{
17721795
// We primarily compile all auxiliary libraries as dynamic libraries
17731796
// to avoid code size bloat and large binaries as much as possible
@@ -1999,7 +2022,8 @@ impl<'test> TestCx<'test> {
19992022
}
20002023

20012024
if !is_rustdoc {
2002-
if self.config.target == "wasm32-unknown-unknown" {
2025+
if self.config.target == "wasm32-unknown-unknown"
2026+
|| self.is_vxworks_pure_static() {
20032027
// rustc.arg("-g"); // get any backtrace at all on errors
20042028
} else if !self.props.no_prefer_dynamic {
20052029
rustc.args(&["-C", "prefer-dynamic"]);
@@ -2044,7 +2068,8 @@ impl<'test> TestCx<'test> {
20442068
}
20452069

20462070
// Use dynamic musl for tests because static doesn't allow creating dylibs
2047-
if self.config.host.contains("musl") {
2071+
if self.config.host.contains("musl")
2072+
|| self.is_vxworks_pure_dynamic() {
20482073
rustc.arg("-Ctarget-feature=-crt-static");
20492074
}
20502075

0 commit comments

Comments
 (0)