Skip to content

Commit 18c095b

Browse files
committed
Ignore vsock tests on Linux aarch64
Apparently AWS Graviton containers don't support it. socket() retunrs EAFNOSUPPORT in that environment. Also, be more selective about skipping tests under QEMU Instead of skipping them on architectures where we happen to use QEMU, only skip them when QEMU is actually being used.
1 parent a593227 commit 18c095b

File tree

6 files changed

+68
-50
lines changed

6 files changed

+68
-50
lines changed

.cirrus.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ task:
4848
RUST_TEST_THREADS: 1 # QEMU works best with 1 thread
4949
HOME: /tmp/home
5050
PATH: $HOME/.cargo/bin:$PATH
51+
RUSTFLAGS: --cfg qemu
5152
matrix:
5253
- name: Linux arm gnueabi
5354
env:
@@ -94,7 +95,7 @@ task:
9495
- cross test --target $TARGET
9596
before_cache_script: rm -rf $CARGO_HOME/registry/index
9697

97-
# Tasks for Linux amd64 builds
98+
# Tasks for Linux native builds
9899
task:
99100
matrix:
100101
- name: Rust Stable
@@ -106,6 +107,7 @@ task:
106107
arm_container:
107108
image: rust:1.46
108109
env:
110+
RUSTFLAGS: --cfg graviton
109111
TARGET: aarch64-unknown-linux-gnu
110112
- name: Linux x86_64
111113
container:

Cross.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
[build.env]
2-
passthrough = ["RUST_TEST_THREADS"]
2+
passthrough = [
3+
"RUSTFLAGS",
4+
"RUST_TEST_THREADS"
5+
]

test/sys/test_socket.rs

Lines changed: 47 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,9 @@ mod recvfrom {
288288
use nix::sys::socket::sockopt::{UdpGroSegment, UdpGsoSegment};
289289

290290
#[test]
291-
// Disable the test on emulated platforms because it fails in Cirrus-CI. Lack of QEMU
292-
// support is suspected.
293-
#[cfg_attr(not(any(target_arch = "x86_64", target_arch="i686")), ignore)]
291+
// Disable the test under emulation because it fails in Cirrus-CI. Lack
292+
// of QEMU support is suspected.
293+
#[cfg_attr(qemu, ignore)]
294294
pub fn gso() {
295295
require_kernel_version!(udp_offload::gso, ">= 4.18");
296296

@@ -342,9 +342,9 @@ mod recvfrom {
342342
}
343343

344344
#[test]
345-
// Disable the test on emulated platforms because it fails in Cirrus-CI. Lack of QEMU
346-
// support is suspected.
347-
#[cfg_attr(not(any(target_arch = "x86_64", target_arch="i686")), ignore)]
345+
// Disable the test on emulated platforms because it fails in Cirrus-CI.
346+
// Lack of QEMU support is suspected.
347+
#[cfg_attr(qemu, ignore)]
348348
pub fn gro() {
349349
require_kernel_version!(udp_offload::gro, ">= 5.3");
350350

@@ -583,7 +583,7 @@ pub fn test_recvmsg_ebadf() {
583583

584584
// Disable the test on emulated platforms due to a bug in QEMU versions <
585585
// 2.12.0. https://bugs.launchpad.net/qemu/+bug/1701808
586-
#[cfg_attr(not(any(target_arch = "x86_64", target_arch="i686")), ignore)]
586+
#[cfg_attr(qemu, ignore)]
587587
#[test]
588588
pub fn test_scm_rights() {
589589
use nix::sys::uio::IoVec;
@@ -637,8 +637,8 @@ pub fn test_scm_rights() {
637637
}
638638

639639
// Disable the test on emulated platforms due to not enabled support of AF_ALG in QEMU from rust cross
640-
#[cfg_attr(not(any(target_arch = "x86_64", target_arch = "i686")), ignore)]
641640
#[cfg(any(target_os = "linux", target_os= "android"))]
641+
#[cfg_attr(qemu, ignore)]
642642
#[test]
643643
pub fn test_af_alg_cipher() {
644644
use libc;
@@ -705,9 +705,10 @@ pub fn test_af_alg_cipher() {
705705
assert_eq!(decrypted, payload);
706706
}
707707

708-
// Disable the test on emulated platforms due to not enabled support of AF_ALG in QEMU from rust cross
709-
#[cfg_attr(not(any(target_arch = "x86_64", target_arch = "i686")), ignore)]
708+
// Disable the test on emulated platforms due to not enabled support of AF_ALG
709+
// in QEMU from rust cross
710710
#[cfg(any(target_os = "linux", target_os= "android"))]
711+
#[cfg_attr(qemu, ignore)]
711712
#[test]
712713
pub fn test_af_alg_aead() {
713714
use libc::{ALG_OP_DECRYPT, ALG_OP_ENCRYPT};
@@ -910,7 +911,7 @@ pub fn test_sendmsg_ipv6packetinfo() {
910911
/// Tests that passing multiple fds using a single `ControlMessage` works.
911912
// Disable the test on emulated platforms due to a bug in QEMU versions <
912913
// 2.12.0. https://bugs.launchpad.net/qemu/+bug/1701808
913-
#[cfg_attr(not(any(target_arch = "x86_64", target_arch="i686")), ignore)]
914+
#[cfg_attr(qemu, ignore)]
914915
#[test]
915916
fn test_scm_rights_single_cmsg_multiple_fds() {
916917
use std::os::unix::net::UnixDatagram;
@@ -1057,9 +1058,9 @@ fn test_scm_credentials() {
10571058
/// Ensure that we can send `SCM_CREDENTIALS` and `SCM_RIGHTS` with a single
10581059
/// `sendmsg` call.
10591060
#[cfg(any(target_os = "android", target_os = "linux"))]
1060-
// qemu's handling of multiple cmsgs is bugged, ignore tests on non-x86
1061+
// qemu's handling of multiple cmsgs is bugged, ignore tests under emulation
10611062
// see https://bugs.launchpad.net/qemu/+bug/1781280
1062-
#[cfg_attr(not(any(target_arch = "x86_64", target_arch = "x86")), ignore)]
1063+
#[cfg_attr(qemu, ignore)]
10631064
#[test]
10641065
fn test_scm_credentials_and_rights() {
10651066
use libc;
@@ -1071,9 +1072,9 @@ fn test_scm_credentials_and_rights() {
10711072
/// Ensure that passing a an oversized control message buffer to recvmsg
10721073
/// still works.
10731074
#[cfg(any(target_os = "android", target_os = "linux"))]
1074-
// qemu's handling of multiple cmsgs is bugged, ignore tests on non-x86
1075+
// qemu's handling of multiple cmsgs is bugged, ignore tests under emulation
10751076
// see https://bugs.launchpad.net/qemu/+bug/1781280
1076-
#[cfg_attr(not(any(target_arch = "x86_64", target_arch = "x86")), ignore)]
1077+
#[cfg_attr(qemu, ignore)]
10771078
#[test]
10781079
fn test_too_large_cmsgspace() {
10791080
let space = vec![0u8; 1024];
@@ -1262,10 +1263,13 @@ fn loopback_address(family: AddressFamily) -> Option<nix::ifaddrs::InterfaceAddr
12621263
target_os = "netbsd",
12631264
))]
12641265
// qemu doesn't seem to be emulating this correctly in these architectures
1265-
#[cfg_attr(any(
1266-
target_arch = "mips",
1267-
target_arch = "mips64",
1268-
target_arch = "powerpc64",
1266+
#[cfg_attr(all(
1267+
qemu,
1268+
any(
1269+
target_arch = "mips",
1270+
target_arch = "mips64",
1271+
target_arch = "powerpc64",
1272+
)
12691273
), ignore)]
12701274
#[test]
12711275
pub fn test_recv_ipv4pktinfo() {
@@ -1352,10 +1356,13 @@ pub fn test_recv_ipv4pktinfo() {
13521356
target_os = "openbsd",
13531357
))]
13541358
// qemu doesn't seem to be emulating this correctly in these architectures
1355-
#[cfg_attr(any(
1356-
target_arch = "mips",
1357-
target_arch = "mips64",
1358-
target_arch = "powerpc64",
1359+
#[cfg_attr(all(
1360+
qemu,
1361+
any(
1362+
target_arch = "mips",
1363+
target_arch = "mips64",
1364+
target_arch = "powerpc64",
1365+
)
13591366
), ignore)]
13601367
#[test]
13611368
pub fn test_recvif() {
@@ -1463,10 +1470,13 @@ pub fn test_recvif() {
14631470
target_os = "openbsd",
14641471
))]
14651472
// qemu doesn't seem to be emulating this correctly in these architectures
1466-
#[cfg_attr(any(
1467-
target_arch = "mips",
1468-
target_arch = "mips64",
1469-
target_arch = "powerpc64",
1473+
#[cfg_attr(all(
1474+
qemu,
1475+
any(
1476+
target_arch = "mips",
1477+
target_arch = "mips64",
1478+
target_arch = "powerpc64",
1479+
)
14701480
), ignore)]
14711481
#[test]
14721482
pub fn test_recv_ipv6pktinfo() {
@@ -1544,6 +1554,7 @@ pub fn test_recv_ipv6pktinfo() {
15441554
}
15451555

15461556
#[cfg(any(target_os = "android", target_os = "linux"))]
1557+
#[cfg_attr(graviton, ignore = "Not supported by the CI environment")]
15471558
#[test]
15481559
pub fn test_vsock() {
15491560
use libc;
@@ -1588,9 +1599,9 @@ pub fn test_vsock() {
15881599
thr.join().unwrap();
15891600
}
15901601

1591-
// Disable the test on emulated platforms because it fails in Cirrus-CI. Lack of QEMU
1592-
// support is suspected.
1593-
#[cfg_attr(not(any(target_arch = "x86_64")), ignore)]
1602+
// Disable the test on emulated platforms because it fails in Cirrus-CI. Lack
1603+
// of QEMU support is suspected.
1604+
#[cfg_attr(qemu, ignore)]
15941605
#[cfg(all(target_os = "linux"))]
15951606
#[test]
15961607
fn test_recvmsg_timestampns() {
@@ -1639,9 +1650,9 @@ fn test_recvmsg_timestampns() {
16391650
nix::unistd::close(in_socket).unwrap();
16401651
}
16411652

1642-
// Disable the test on emulated platforms because it fails in Cirrus-CI. Lack of QEMU
1643-
// support is suspected.
1644-
#[cfg_attr(not(any(target_arch = "x86_64")), ignore)]
1653+
// Disable the test on emulated platforms because it fails in Cirrus-CI. Lack
1654+
// of QEMU support is suspected.
1655+
#[cfg_attr(qemu, ignore)]
16451656
#[cfg(all(target_os = "linux"))]
16461657
#[test]
16471658
fn test_recvmmsg_timestampns() {
@@ -1696,9 +1707,9 @@ fn test_recvmmsg_timestampns() {
16961707
nix::unistd::close(in_socket).unwrap();
16971708
}
16981709

1699-
// Disable the test on emulated platforms because it fails in Cirrus-CI. Lack of QEMU
1700-
// support is suspected.
1701-
#[cfg_attr(not(any(target_arch = "x86_64")), ignore)]
1710+
// Disable the test on emulated platforms because it fails in Cirrus-CI. Lack
1711+
// of QEMU support is suspected.
1712+
#[cfg_attr(qemu, ignore)]
17021713
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
17031714
#[test]
17041715
fn test_recvmsg_rxq_ovfl() {

test/sys/test_uio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ fn test_preadv() {
205205

206206
#[test]
207207
#[cfg(target_os = "linux")]
208-
// FIXME: qemu-user doesn't implement process_vm_readv/writev on most arches
209-
#[cfg_attr(not(any(target_arch = "x86", target_arch = "x86_64")), ignore)]
208+
// qemu-user doesn't implement process_vm_readv/writev on most arches
209+
#[cfg_attr(qemu, ignore)]
210210
fn test_process_vm_readv() {
211211
use nix::unistd::ForkResult::*;
212212
use nix::sys::signal::*;

test/test_fcntl.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,8 @@ mod linux_android {
236236
/// The from_offset should be updated by the call to reflect
237237
/// the 3 bytes read (6).
238238
#[test]
239-
// QEMU does not support copy_file_range. Skip platforms that use QEMU in CI
240-
#[cfg_attr(all(target_os = "linux", any(
241-
target_arch = "aarch64",
242-
target_arch = "arm",
243-
target_arch = "mips",
244-
target_arch = "mips64",
245-
target_arch = "powerpc64"
246-
)), ignore)]
239+
// QEMU does not support copy_file_range. Skip under qemu
240+
#[cfg_attr(qemu, ignore)]
247241
fn test_copy_file_range() {
248242
const CONTENTS: &[u8] = b"foobarbaz";
249243

test/test_mq.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ fn test_mq_getattr() {
6060
// FIXME: Fix failures for mips in QEMU
6161
#[test]
6262
#[cfg(not(any(target_os = "netbsd")))]
63-
#[cfg_attr(any(target_arch = "mips", target_arch = "mips64"), ignore)]
63+
#[cfg_attr(all(
64+
qemu,
65+
any(target_arch = "mips", target_arch = "mips64")
66+
), ignore
67+
)]
6468
fn test_mq_setattr() {
6569
use nix::mqueue::{mq_getattr, mq_setattr};
6670
const MSG_SIZE: mq_attr_member_t = 32;
@@ -97,7 +101,11 @@ fn test_mq_setattr() {
97101
// FIXME: Fix failures for mips in QEMU
98102
#[test]
99103
#[cfg(not(any(target_os = "netbsd")))]
100-
#[cfg_attr(any(target_arch = "mips", target_arch = "mips64"), ignore)]
104+
#[cfg_attr(all(
105+
qemu,
106+
any(target_arch = "mips", target_arch = "mips64")
107+
), ignore
108+
)]
101109
fn test_mq_set_nonblocking() {
102110
use nix::mqueue::{mq_getattr, mq_set_nonblock, mq_remove_nonblock};
103111
const MSG_SIZE: mq_attr_member_t = 32;

0 commit comments

Comments
 (0)