Page MenuHomeFreeBSD

Add tests for getpagesize{,s}
Needs ReviewPublic

Authored by andrew on Apr 20 2022, 12:51 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 26, 10:12 AM
Unknown Object (File)
Nov 6 2024, 10:31 AM
Unknown Object (File)
Nov 3 2024, 3:45 PM
Unknown Object (File)
Oct 3 2024, 4:12 PM
Unknown Object (File)
Oct 3 2024, 1:15 AM
Unknown Object (File)
Oct 1 2024, 10:33 AM
Unknown Object (File)
Sep 18 2024, 4:14 PM
Unknown Object (File)
Aug 25 2024, 3:40 AM
Subscribers
None

Details

Reviewers
kib
markj
imp
Summary

Add tests for the various ways we can ask for the page sizes to ensure
they return a value we expect.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 45249
Build 42137: arc lint + arc unit

Event Timeline

andrew created this revision.
lib/libc/tests/gen/getpagesize_test.c
67

For i386 the element with index 1 is M(4) when we are native i386, and M(2) when we are on amd64. Easiest way to check is sysctl kern.supported_archs. which is "amd64 i386" on amd64, and "i386" otherwise.

172

This is mostly tautological test, because libc getpagesizes() tries AT_PAGESIZES. It probably makes sense to directly find auxv vector right after system environment array, and fetch values from there.

lib/libc/tests/gen/getpagesize_test.c
67

Isn't it only 4MB when PAE is disabled? So

i386+PAE (default) -> 2MB
i386+no PAE -> 4MB
amd64 compat32 -> 2MB

I guess we could have a table for each case and check kern.supported_archs and vm.pmap.pae_mode to determine which one to use.

209

A more natural way to do this would be to have this test case call atf_tc_skip() if SKIP_PAGESIZES is defined. Then the test shows up in the list of skipped tests.

lib/libc/tests/gen/getpagesize_test.c
67

Indeed, I do not see a way to check for PAE from userspace without querying kernel.

BTW, go detects i386 on amd64, by querying kern.conftxt and looking for machine. I described them that this is too good, but I do not believe they fixed it to use kern.supported_archs.