Skip to content

Commit 7f781f1

Browse files
committed
Skip cmsg tests on s390x and sparc64
1 parent 5a89a1f commit 7f781f1

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

libc-test/build.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ extern crate ctest;
66
use std::env;
77

88
fn do_cc() {
9-
#[cfg(unix)] {
9+
// Run the cmsg tests on all Unixen, but skip them on platforms that fail
10+
// due to suspected QEMU bugs. Sparc64 gets SIGILL and s390x hangs, both
11+
// before executing any test functions.
12+
#[cfg(all(unix,
13+
not(target_arch = "sparc64"),
14+
not(target_arch = "s390x")))]
15+
{
1016
cc::Build::new()
1117
.file("src/cmsg.c")
1218
.compile("cmsg");

libc-test/test/cmsg.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ extern crate libc;
55
use libc::{c_uchar, c_uint, c_void, cmsghdr, msghdr};
66
use std::{mem, ptr};
77

8-
#[cfg(unix)]
8+
// Run these tests on all Unixen, but skip them on platforms that fail due to
9+
// suspected QEMU bugs. Sparc64 gets SIGILL and s390x hangs, both before
10+
// executing any test functions.
11+
#[cfg(all(unix,
12+
not(target_arch = "sparc64"),
13+
not(target_arch = "s390x")))]
14+
{
15+
916
extern {
1017
pub fn cmsg_firsthdr(msgh: *const msghdr) -> *mut cmsghdr;
1118
pub fn cmsg_nxthdr(mhdr: *const msghdr,
@@ -15,7 +22,6 @@ extern {
1522
pub fn cmsg_data(cmsg: *const cmsghdr) -> *mut c_uchar;
1623
}
1724

18-
#[cfg(unix)]
1925
#[test]
2026
fn test_cmsg_data() {
2127
for l in 0..128 {
@@ -26,7 +32,6 @@ fn test_cmsg_data() {
2632
}
2733
}
2834

29-
#[cfg(unix)]
3035
#[test]
3136
fn test_cmsg_firsthdr() {
3237
let mut mhdr: msghdr = unsafe{mem::zeroed()};
@@ -40,7 +45,6 @@ fn test_cmsg_firsthdr() {
4045
}
4146
}
4247

43-
#[cfg(unix)]
4448
#[test]
4549
fn test_cmsg_len() {
4650
for l in 0..128 {
@@ -50,7 +54,6 @@ fn test_cmsg_len() {
5054
}
5155
}
5256

53-
#[cfg(unix)]
5457
#[test]
5558
fn test_cmsg_nxthdr() {
5659
let mut buffer = [0u8; 256];
@@ -83,7 +86,6 @@ fn test_cmsg_nxthdr() {
8386
}
8487
}
8588

86-
#[cfg(unix)]
8789
#[test]
8890
fn test_cmsg_space() {
8991
unsafe {
@@ -92,3 +94,5 @@ fn test_cmsg_space() {
9294
}
9395
}
9496
}
97+
98+
}

0 commit comments

Comments
 (0)