Skip to content

Commit ecee472

Browse files
committed
musl: Fix skips with recent versions
It appeared that tests with the constants here were passing in CI with new versions of musl before, but that was only because the correct config wasn't being set. Go back to our original configuration (with some cleanup) to resolve this. Fixes: dd44cb6 ("test: linux: Unskip types and constants that are now available") (backport <#4775>) (cherry picked from commit 075c118)
1 parent 33d56c2 commit ecee472

File tree

1 file changed

+61
-64
lines changed

1 file changed

+61
-64
lines changed

libc-test/build.rs

Lines changed: 61 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -4084,8 +4084,14 @@ fn test_linux(target: &str) {
40844084
// FIXME(linux): Requires >= 6.12 kernel headers.
40854085
"mnt_ns_info" => true,
40864086

4087-
// Struct has changed for new musl versions
4088-
"tcp_info" if old_musl => true,
4087+
// FIXME(musl): Struct has changed for new musl versions
4088+
"tcp_info" if musl => true,
4089+
4090+
// FIXME(musl): Supported in new musl but we don't have a new enough version in CI.
4091+
"statx" | "statx_timestamp" if musl => true,
4092+
4093+
// FIXME(musl): New fields in newer versions
4094+
"utmpx" if !old_musl => true,
40894095

40904096
_ => false,
40914097
}
@@ -4139,35 +4145,26 @@ fn test_linux(target: &str) {
41394145
if name.starts_with("NI_IDN") {
41404146
return true;
41414147
}
4142-
// FIXME(musl): Not in musl yet
4143-
if name == "SO_NETNS_COOKIE"
4144-
|| name == "SO_BUF_LOCK"
4145-
|| name == "SO_RESERVE_MEM"
4146-
|| name == "SO_TXREHASH"
4147-
|| name == "SO_RCVMARK"
4148-
|| name == "SO_PASSPIDFD"
4149-
|| name == "SO_PEERPIDFD"
4150-
|| name == "SO_DEVMEM_LINEAR"
4151-
|| name == "SO_DEVMEM_DMABUF"
4152-
|| name == "SO_DEVMEM_DONTNEED"
4153-
{
4154-
return true;
4155-
}
4156-
// FIXME(musl): Not in musl yet
4157-
if name == "SCM_DEVMEM_LINEAR" || name == "SCM_DEVMEM_DMABUF" {
4158-
return true;
4159-
}
4160-
// FIXME: Does not exist on non-x86 architectures, slated for removal
4161-
// in libc in 1.0
4162-
if ppc64 && name == "MAP_32BIT" {
4163-
return true;
4164-
}
4165-
}
4166-
if old_musl {
4167-
// Constants that don't exist on the old version of musl we test with, but do exist
4168-
// on newer versions.
4148+
41694149
match name {
4170-
"FAN_EVENT_INFO_TYPE_ERROR"
4150+
// FIXME: Does not exist on non-x86 architectures, slated for removal
4151+
// in libc in 1.0
4152+
"MAP_32BIT" if ppc64 => return true,
4153+
4154+
// FIXME(musl): None of these are actually defined in musl, they should be removed.
4155+
"SO_NETNS_COOKIE"
4156+
| "SO_BUF_LOCK"
4157+
| "SO_RESERVE_MEM"
4158+
| "SO_TXREHASH"
4159+
| "SO_RCVMARK"
4160+
| "SO_PASSPIDFD"
4161+
| "SO_PEERPIDFD"
4162+
| "SO_DEVMEM_LINEAR"
4163+
| "SO_DEVMEM_DMABUF"
4164+
| "SO_DEVMEM_DONTNEED"
4165+
| "SCM_DEVMEM_LINEAR"
4166+
| "SCM_DEVMEM_DMABUF"
4167+
| "FAN_EVENT_INFO_TYPE_ERROR"
41714168
| "FAN_EVENT_INFO_TYPE_NEW_DFID_NAME"
41724169
| "FAN_EVENT_INFO_TYPE_OLD_DFID_NAME"
41734170
| "FAN_FS_ERROR"
@@ -4180,21 +4177,39 @@ fn test_linux(target: &str) {
41804177
| "FAN_REPORT_TARGET_FID"
41814178
| "FAN_RESPONSE_INFO_AUDIT_RULE"
41824179
| "FAN_RESPONSE_INFO_NONE"
4183-
| "IPPROTO_ETHERNET"
4184-
| "IPPROTO_MPTCP"
41854180
| "PR_GET_MDWE"
41864181
| "PR_MDWE_NO_INHERIT"
41874182
| "PR_MDWE_REFUSE_EXEC_GAIN"
41884183
| "PR_SET_MDWE"
4189-
| "RLIM_NLIMITS"
4184+
| "IPPROTO_ETHERNET"
4185+
| "IPPROTO_MPTCP"
41904186
| "SI_DETHREAD"
4191-
| "SO_BUSY_POLL_BUDGET"
4192-
| "SO_PREFER_BUSY_POLL" => return true,
4193-
// Values changed in newer musl versions on these arches
4187+
| "PR_SET_VMA"
4188+
| "PR_SET_VMA_ANON_NAME"
4189+
| "PR_SCHED_CORE"
4190+
| "PR_SCHED_CORE_CREATE"
4191+
| "PR_SCHED_CORE_GET"
4192+
| "PR_SCHED_CORE_MAX"
4193+
| "PR_SCHED_CORE_SCOPE_PROCESS_GROUP"
4194+
| "PR_SCHED_CORE_SCOPE_THREAD"
4195+
| "PR_SCHED_CORE_SCOPE_THREAD_GROUP"
4196+
| "PR_SCHED_CORE_SHARE_FROM"
4197+
| "PR_SCHED_CORE_SHARE_TO" => return true,
4198+
4199+
/* Added in versions more recent than what we test */
4200+
// Since 1.2.3
4201+
"SO_BUSY_POLL_BUDGET" | "SO_PREFER_BUSY_POLL" => return true,
4202+
4203+
// FIXME(musl): value was updated in new musl
4204+
"RLIM_NLIMITS" => return true,
4205+
4206+
// FIXME(musl): Values changed in newer musl versions on these arches
41944207
"O_LARGEFILE" if riscv64 || x86_64 => return true,
4208+
41954209
_ => (),
41964210
}
41974211
}
4212+
41984213
match name {
41994214
// These constants are not available if gnu headers have been included
42004215
// and can therefore not be tested here
@@ -4307,23 +4322,6 @@ fn test_linux(target: &str) {
43074322
// is a private value for kernel usage normally
43084323
"FUSE_SUPER_MAGIC" => true,
43094324

4310-
// Not present on old musl
4311-
"PR_SET_VMA"
4312-
| "PR_SET_VMA_ANON_NAME"
4313-
| "PR_SCHED_CORE"
4314-
| "PR_SCHED_CORE_CREATE"
4315-
| "PR_SCHED_CORE_GET"
4316-
| "PR_SCHED_CORE_MAX"
4317-
| "PR_SCHED_CORE_SCOPE_PROCESS_GROUP"
4318-
| "PR_SCHED_CORE_SCOPE_THREAD"
4319-
| "PR_SCHED_CORE_SCOPE_THREAD_GROUP"
4320-
| "PR_SCHED_CORE_SHARE_FROM"
4321-
| "PR_SCHED_CORE_SHARE_TO"
4322-
if old_musl =>
4323-
{
4324-
true
4325-
}
4326-
43274325
// Not present in glibc
43284326
"PR_SME_VL_LEN_MAX" | "PR_SME_SET_VL_INHERIT" | "PR_SME_SET_VL_ONE_EXEC" if gnu => true,
43294327

@@ -4514,20 +4512,22 @@ fn test_linux(target: &str) {
45144512
// assume it's a int instead.
45154513
"getnameinfo" if uclibc => true,
45164514

4517-
// FIXME(musl): This needs musl 1.2.2 or later.
4518-
"gettid" if old_musl => true,
4515+
// FIXME(musl): This needs musl 1.2.2 or later, which is newer than what we test with
4516+
// on CI.
4517+
"gettid" | "reallocarray" if musl => true,
4518+
// Needs musl 1.2.3 or later.
4519+
"pthread_getname_np" if musl => true,
4520+
// Added in musl 1.2.5
4521+
"preadv2" | "pwritev2" if musl => true,
4522+
// FIXME(musl): Supported in new musl but we don't have a new enough version in CI.
4523+
"statx" if musl => true,
45194524

45204525
// Needs glibc 2.33 or later.
45214526
"mallinfo2" => true,
45224527

4523-
"reallocarray" if old_musl => true,
4524-
45254528
// Not defined in uclibc as of 1.0.34
45264529
"gettid" if uclibc => true,
45274530

4528-
// Needs musl 1.2.3 or later.
4529-
"pthread_getname_np" if old_musl => true,
4530-
45314531
// pthread_sigqueue uses sigval, which was initially declared
45324532
// as a struct but should be defined as a union. However due
45334533
// to the issues described here: https://github.com/rust-lang/libc/issues/2816
@@ -4553,9 +4553,6 @@ fn test_linux(target: &str) {
45534553
// FIXME(linux): function pointers changed since Ubuntu 23.10
45544554
"strtol" | "strtoll" | "strtoul" | "strtoull" | "fscanf" | "scanf" | "sscanf" => true,
45554555

4556-
// Added in musl 1.2.5
4557-
"preadv2" | "pwritev2" if musl => true,
4558-
45594556
_ => false,
45604557
}
45614558
});
@@ -4665,7 +4662,7 @@ fn test_linux(target: &str) {
46654662
// the `xsk_tx_metadata_union` field is an anonymous union
46664663
(struct_ == "xsk_tx_metadata" && field == "xsk_tx_metadata_union") ||
46674664
// After musl 1.2.0, the type becomes `int` instead of `long`.
4668-
(old_musl && struct_ == "utmpx" && field == "ut_session") ||
4665+
(musl && struct_ == "utmpx" && field == "ut_session") ||
46694666
// `frames` is a flexible array member
46704667
(struct_ == "bcm_msg_head" && field == "frames") ||
46714668
// FAM

0 commit comments

Comments
 (0)