Skip to content

Commit 56c8549

Browse files
committed
Auto merge of #2113 - joshtriplett:ci-kernel, r=JohnTitor
CI: Consolidate and blanket-ignore kernel definitions on non-glibc Skip definitions from the kernel on non-glibc Linux targets. They're libc-independent, so we only need to check them on one libc. We don't want to break CI if musl or another libc doesn't have the definitions yet. (We do still want to check them on every glibc target, though, as some of them can vary by architecture.)
2 parents 508f65a + 0a9aec7 commit 56c8549

File tree

1 file changed

+36
-48
lines changed

1 file changed

+36
-48
lines changed

libc-test/build.rs

Lines changed: 36 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2561,6 +2561,39 @@ fn test_linux(target: &str) {
25612561
});
25622562

25632563
cfg.skip_const(move |name| {
2564+
if !gnu {
2565+
// Skip definitions from the kernel on non-glibc Linux targets.
2566+
// They're libc-independent, so we only need to check them on one
2567+
// libc. We don't want to break CI if musl or another libc doesn't
2568+
// have the definitions yet. (We do still want to check them on
2569+
// every glibc target, though, as some of them can vary by
2570+
// architecture.)
2571+
//
2572+
// This is not an exhaustive list of kernel constants, just a list
2573+
// of prefixes of all those that have appeared here or that get
2574+
// updated regularly and seem likely to cause breakage.
2575+
if name.starts_with("AF_")
2576+
|| name.starts_with("ARPHRD_")
2577+
|| name.starts_with("EPOLL")
2578+
|| name.starts_with("F_")
2579+
|| name.starts_with("FALLOC_FL_")
2580+
|| name.starts_with("IFLA_")
2581+
|| name.starts_with("MS_")
2582+
|| name.starts_with("MSG_")
2583+
|| name.starts_with("P_")
2584+
|| name.starts_with("PF_")
2585+
|| name.starts_with("RLIMIT_")
2586+
|| name.starts_with("SOL_")
2587+
|| name.starts_with("STATX_")
2588+
|| name.starts_with("SW_")
2589+
|| name.starts_with("SYS_")
2590+
|| name.starts_with("TCP_")
2591+
|| name.starts_with("UINPUT_")
2592+
|| name.starts_with("VMADDR_")
2593+
{
2594+
return true;
2595+
}
2596+
}
25642597
match name {
25652598
// These constants are not available if gnu headers have been included
25662599
// and can therefore not be tested here
@@ -2580,25 +2613,9 @@ fn test_linux(target: &str) {
25802613
| "F_SEAL_GROW"
25812614
| "F_SEAL_WRITE" => true,
25822615

2583-
// The musl-sanitized kernel headers used in CI
2584-
// target the Linux kernel 4.4 and do not contain the
2585-
// following constants:
2586-
//
2587-
// Requires Linux kernel 4.9
2588-
| "FALLOC_FL_UNSHARE_RANGE"
2589-
//
2590-
// Require Linux kernel 5.x:
2591-
| "MSG_COPY"
2592-
if musl => true,
25932616
// Require Linux kernel 5.1:
25942617
"F_SEAL_FUTURE_WRITE" => true,
25952618

2596-
// The musl version 1.1.24 used in CI does not
2597-
// contain these glibc constants yet:
2598-
| "RLIMIT_RTTIME" // should be in `resource.h`
2599-
| "TCP_COOKIE_TRANSACTIONS" // should be in the `netinet/tcp.h` header
2600-
if musl => true,
2601-
26022619
// FIXME: deprecated: not available in any header
26032620
// See: https://github.com/rust-lang/libc/issues/1356
26042621
"ENOATTR" => true,
@@ -2629,33 +2646,13 @@ fn test_linux(target: &str) {
26292646
| "IPPROTO_MAX"
26302647
| "IPPROTO_MPTCP" => true,
26312648

2632-
// Defined in kernel headers but musl removes it; need musl 1.2 for definition in musl
2633-
// headers.
2634-
"P_PIDFD" => true,
2635-
26362649
// FIXME: Not currently available in headers
2650+
"P_PIDFD" if mips => true,
26372651
"SYS_pidfd_open" if mips => true,
26382652

26392653
// FIXME: Not currently available in headers on MIPS
26402654
// Not yet implemented on sparc64
2641-
// FIXME: available in musl headers since musl 1.2.0
2642-
"SYS_clone3" if mips | sparc64 | musl => true,
2643-
2644-
// Missing from musl's kernel headers
2645-
| "IFLA_GSO_MAX_SEGS"
2646-
| "IFLA_GSO_MAX_SIZE"
2647-
| "IFLA_PAD"
2648-
| "IFLA_XDP"
2649-
| "IFLA_EVENT"
2650-
| "IFLA_NEW_NETNSID"
2651-
| "IFLA_IF_NETNSID"
2652-
| "IFLA_TARGET_NETNSID"
2653-
| "IFLA_CARRIER_UP_COUNT"
2654-
| "IFLA_CARRIER_DOWN_COUNT"
2655-
| "IFLA_NEW_IFINDEX"
2656-
| "IFLA_MIN_MTU"
2657-
| "IFLA_MAX_MTU"
2658-
if musl => true,
2655+
"SYS_clone3" if mips | sparc64 => true,
26592656

26602657
// Requires more recent kernel headers:
26612658
| "IFLA_PROP_LIST"
@@ -2668,23 +2665,14 @@ fn test_linux(target: &str) {
26682665
| "CAN_RAW_FILTER_MAX"
26692666
| "CAN_NPROTO" => true,
26702667

2671-
"MS_RMT_MASK" if uclibc => true, // updated in glibc 2.22 and musl 1.1.13
2672-
2673-
// These are not defined in uclibc but will be passed through to the kernel
2674-
// so they will be supported if the kernel supports them. Otherwise the
2675-
// kernel will return runtime errors. Since they're required for tokio
2676-
// support, we except them from the tests here.
2677-
// See https://github.com/rust-lang/libc/pull/2019#issuecomment-754351482
2678-
"EPOLLEXCLUSIVE" | "EPOLLWAKEUP" if uclibc => true,
2679-
26802668
// FIXME: Requires recent kernel headers (5.8):
26812669
"STATX_MNT_ID" => true,
26822670

26832671
// FIXME: requires more recent kernel headers on CI
26842672
| "UINPUT_VERSION"
26852673
| "SW_MAX"
26862674
| "SW_CNT"
2687-
if musl || mips || ppc64 || riscv64 || sparc64 => true,
2675+
if mips || ppc64 || riscv64 || sparc64 => true,
26882676

26892677
_ => false,
26902678
}

0 commit comments

Comments
 (0)