Skip to content

test: Set version-dependent skips based on header defines#5188

Merged
tgross35 merged 2 commits into
rust-lang:mainfrom
tgross35:version-skips
Jun 28, 2026
Merged

test: Set version-dependent skips based on header defines#5188
tgross35 merged 2 commits into
rust-lang:mainfrom
tgross35:version-skips

Conversation

@tgross35

@tgross35 tgross35 commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

When there are additions or updates that are only available with newer
platform versions, we don't have a great way to handle testing. The only
thing we can really do is unconditionally skip anything that doesn't
pass on the oldest versions we have on CI.

Improve this by adding a preprocess-only compiler invocation that
collects versions from the headers we are building against. These are
then used to skip

This initial patch only uses the versions for skips on Linux and
replacing the NetBSD uname invocation.

Also included is an IO number fix that showed up in the new tests.

@tgross35
tgross35 force-pushed the version-skips branch 7 times, most recently from 76aae41 to 0636284 Compare June 22, 2026 09:30
@rustbot rustbot added the A-CI Area: CI-related items label Jun 22, 2026
@tgross35
tgross35 force-pushed the version-skips branch 9 times, most recently from 8af7d0a to 69fa8db Compare June 23, 2026 07:12
@tgross35 tgross35 changed the title test: Only skip new additions on older kernels test: Set version-dependent skips based on header defines Jun 23, 2026
@tgross35
tgross35 force-pushed the version-skips branch 2 times, most recently from 16a376c to 44cb2ca Compare June 23, 2026 07:33
@tgross35
tgross35 marked this pull request as ready for review June 23, 2026 07:35
@tgross35
tgross35 requested a review from JohnTitor June 23, 2026 07:35
@tgross35

Copy link
Copy Markdown
Contributor Author

I think this is pretty reasonable, and probably the easiest way to make sure anyone on a different kernel version than CI doesn't get a handful of errors, but could use a second set of eyes.

@tgross35 tgross35 mentioned this pull request Jun 23, 2026
3 tasks
@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@tgross35 tgross35 mentioned this pull request Jun 26, 2026
3 tasks
Comment thread libc-test/build.rs

#[derive(Clone, Copy, Debug, Default)]
struct Versions {
linux: Option<(u32, u32)>,

@Thomasdezeeuw Thomasdezeeuw Jun 26, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to remove the Option here and make (0, 0) the current None, that would make the comparison in the code easier to deal with.

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it this way is to make it more obvious when there's a version detection failure so we can figure it out and fix it, rather than silently falling back and skipping more than needed. But I forgot to actually make use of this, updated now to unwrap rather than default for Linux.

tgross35 added 2 commits June 26, 2026 05:11
When there are additions or updates that are only available with newer
platform versions, we don't have a great way to handle testing. The only
thing we can really do is unconditionally skip anything that doesn't
pass on the oldest versions we have on CI.

Improve this by adding a preprocess-only compiler invocation that
collects versions from the headers we are building against. These are
then used to skip 

This initial patch only uses the versions for skips on Linux and
replacing the NetBSD `uname` invocation.
PowerPC, Sparc, and MIPS (32- and 64-bit for all) have different `_IOC`
numbers, meaning the constants were inaccurate. Example error on
PowerPC64:

    bad `EPIOCSPARAMS` value at byte 4: rust: 64 (0x40) != c 128 (0x80)
        rust bytes: 00 00 00 00 40 08 8a 01
        c bytes:    00 00 00 00 80 08 8a 01
    bad `EPIOCGPARAMS` value at byte 4: rust: 128 (0x80) != c 64 (0x40)
        rust bytes: 00 00 00 00 80 08 8a 02
        c bytes:    00 00 00 00 40 08 8a 02

Resolve this by using `_IOW` and `_IOR`.

Source: https://github.com/torvalds/linux/blob/502d801f0ab03e4f32f9a33d203154ce84887921/include/uapi/linux/eventpoll.h#L97-L99
Fixes: fb58c01 ("epoll: add busy polling parameters")
@rustbot

rustbot commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@JohnTitor JohnTitor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The concept makes sense to me 👍

View changes since this review

@tgross35
tgross35 enabled auto-merge June 28, 2026 20:30
@tgross35
tgross35 added this pull request to the merge queue Jun 28, 2026
Merged via the queue into rust-lang:main with commit 73f264c Jun 28, 2026
80 of 107 checks passed
@tgross35
tgross35 deleted the version-skips branch June 29, 2026 18:55
@tgross35 tgross35 added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Jun 29, 2026
tgross35 added a commit to tgross35/rust-libc that referenced this pull request Jul 20, 2026
When there are additions or updates that are only available with newer
platform versions, we don't have a great way to handle testing. The only
thing we can really do is unconditionally skip anything that doesn't
pass on the oldest versions we have on CI.

Improve this by adding a preprocess-only compiler invocation that
collects versions from the headers we are building against. These are
then used to skip

This initial patch only uses the versions for skips on Linux and
replacing the NetBSD `uname` invocation.

(backport <rust-lang#5188>)
(cherry picked from commit ccadc03)
tgross35 added a commit to tgross35/rust-libc that referenced this pull request Jul 20, 2026
PowerPC, Sparc, and MIPS (32- and 64-bit for all) have different `_IOC`
numbers, meaning the constants were inaccurate. Example error on
PowerPC64:

    bad `EPIOCSPARAMS` value at byte 4: rust: 64 (0x40) != c 128 (0x80)
        rust bytes: 00 00 00 00 40 08 8a 01
        c bytes:    00 00 00 00 80 08 8a 01
    bad `EPIOCGPARAMS` value at byte 4: rust: 128 (0x80) != c 64 (0x40)
        rust bytes: 00 00 00 00 80 08 8a 02
        c bytes:    00 00 00 00 40 08 8a 02

Resolve this by using `_IOW` and `_IOR`.

Source: https://github.com/torvalds/linux/blob/502d801f0ab03e4f32f9a33d203154ce84887921/include/uapi/linux/eventpoll.h#L97-L99
Fixes: fb58c01 ("epoll: add busy polling parameters")

(backport <rust-lang#5188>)
(cherry picked from commit 73f264c)
tgross35 added a commit to tgross35/rust-libc that referenced this pull request Jul 20, 2026
When there are additions or updates that are only available with newer
platform versions, we don't have a great way to handle testing. The only
thing we can really do is unconditionally skip anything that doesn't
pass on the oldest versions we have on CI.

Improve this by adding a preprocess-only compiler invocation that
collects versions from the headers we are building against. These are
then used to skip

This initial patch only uses the versions for skips on Linux and
replacing the NetBSD `uname` invocation.

(backport <rust-lang#5188>)
(cherry picked from commit ccadc03)
tgross35 added a commit to tgross35/rust-libc that referenced this pull request Jul 20, 2026
PowerPC, Sparc, and MIPS (32- and 64-bit for all) have different `_IOC`
numbers, meaning the constants were inaccurate. Example error on
PowerPC64:

    bad `EPIOCSPARAMS` value at byte 4: rust: 64 (0x40) != c 128 (0x80)
        rust bytes: 00 00 00 00 40 08 8a 01
        c bytes:    00 00 00 00 80 08 8a 01
    bad `EPIOCGPARAMS` value at byte 4: rust: 128 (0x80) != c 64 (0x40)
        rust bytes: 00 00 00 00 80 08 8a 02
        c bytes:    00 00 00 00 40 08 8a 02

Resolve this by using `_IOW` and `_IOR`.

Source: https://github.com/torvalds/linux/blob/502d801f0ab03e4f32f9a33d203154ce84887921/include/uapi/linux/eventpoll.h#L97-L99
Fixes: fb58c01 ("epoll: add busy polling parameters")

(backport <rust-lang#5188>)
(cherry picked from commit 73f264c)
This was referenced Jul 20, 2026
tgross35 added a commit to tgross35/rust-libc that referenced this pull request Jul 20, 2026
When there are additions or updates that are only available with newer
platform versions, we don't have a great way to handle testing. The only
thing we can really do is unconditionally skip anything that doesn't
pass on the oldest versions we have on CI.

Improve this by adding a preprocess-only compiler invocation that
collects versions from the headers we are building against. These are
then used to skip

This initial patch only uses the versions for skips on Linux and
replacing the NetBSD `uname` invocation.

(backport <rust-lang#5188>)
(cherry picked from commit ccadc03)
tgross35 added a commit to tgross35/rust-libc that referenced this pull request Jul 20, 2026
PowerPC, Sparc, and MIPS (32- and 64-bit for all) have different `_IOC`
numbers, meaning the constants were inaccurate. Example error on
PowerPC64:

    bad `EPIOCSPARAMS` value at byte 4: rust: 64 (0x40) != c 128 (0x80)
        rust bytes: 00 00 00 00 40 08 8a 01
        c bytes:    00 00 00 00 80 08 8a 01
    bad `EPIOCGPARAMS` value at byte 4: rust: 128 (0x80) != c 64 (0x40)
        rust bytes: 00 00 00 00 80 08 8a 02
        c bytes:    00 00 00 00 40 08 8a 02

Resolve this by using `_IOW` and `_IOR`.

Source: https://github.com/torvalds/linux/blob/502d801f0ab03e4f32f9a33d203154ce84887921/include/uapi/linux/eventpoll.h#L97-L99
Fixes: fb58c01 ("epoll: add busy polling parameters")

(backport <rust-lang#5188>)
(cherry picked from commit 73f264c)
@tgross35 tgross35 added stable-applied This PR has been cherry-picked to libc's stable release branch and removed stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CI Area: CI-related items stable-applied This PR has been cherry-picked to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants