Skip to content

Support both static and dynamic linking mode in testing for vxWorks #63789

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 14 commits into from
Sep 7, 2019
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion src/libstd/net/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1597,7 +1597,8 @@ mod tests {

// FIXME: re-enabled openbsd tests once their socket timeout code
// no longer has rounding errors.
#[cfg_attr(any(target_os = "netbsd", target_os = "openbsd"), ignore)]
// VxWorks ignores SO_SNDTIMEO.
#[cfg_attr(any(target_os = "netbsd", target_os = "openbsd", target_os = "vxworks"), ignore)]
#[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
#[test]
fn timeouts() {
Expand Down
3 changes: 2 additions & 1 deletion src/libstd/net/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,8 @@ mod tests {

// FIXME: re-enabled openbsd/netbsd tests once their socket timeout code
// no longer has rounding errors.
#[cfg_attr(any(target_os = "netbsd", target_os = "openbsd"), ignore)]
// VxWorks ignores SO_SNDTIMEO.
#[cfg_attr(any(target_os = "netbsd", target_os = "openbsd", target_os = "vxworks"), ignore)]
#[test]
fn timeouts() {
let addr = next_test_ip4();
Expand Down
22 changes: 20 additions & 2 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1727,6 +1727,21 @@ impl<'test> TestCx<'test> {
}
}

fn is_vxworks_pure_static(&self) -> bool {
if self.config.target.contains("vxworks") {
match env::var("RUST_VXWORKS_TEST_DYLINK") {
Ok(s) => s != "1",
_ => true
}
} else {
false
}
}

fn is_vxworks_pure_dynamic(&self) -> bool {
self.config.target.contains("vxworks") && !self.is_vxworks_pure_static()
}

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 @@ -1770,6 +1785,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
Expand Down Expand Up @@ -2001,7 +2017,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"]);
Expand Down Expand Up @@ -2046,7 +2063,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");
}

Expand Down