summaryrefslogtreecommitdiff
path: root/tests/lib/libc
AgeCommit message (Collapse)Author
2023-07-08clock_gettime(2): Fix CLOCK_PROCESS/THREAD_CPUTIME_ID.riastradh
Use same calculation as getrusage, not some ad-hoc arithmetic of internal scheduler parameters that are periodically rewound. PR kern/57512 XXX pullup-8 XXX pullup-9 XXX pullup-10
2023-07-08t_timerfd: Sprinkle slightly more diagnostics.riastradh
Might help us to see if we're off by just a little bit (maybe a tiny jitter between the hardclock timer and the monotonic clock), or if something is seriously amiss when the timerfd_block test fails sporadically.
2023-07-08t_clock_gettime: Add test for PR kern/57512.riastradh
2023-07-05t_posix_memalign: Simplify.riastradh
No functional change intended.
2023-07-05t_posix_memalign: Fix this to reflect restriction lifted in C17.riastradh
2023-07-04t_posix_memalign: Expand test cases and properties.riastradh
- Test cartesian product of a sampling of sizes and a sampling of alignments. - Verify all the edge cases I could find in posix_memalign and aligned_alloc, including failure modes. - Test an unreasonably large (but aligned) allocation size. - Use ATF_CHECK_* instead of ATF_REQUIRE_* so all failures will be reported, not just the first one. - While here, build with -fno-builtin-aligned_alloc and with -fno-builtin-posix_memalign to make sure the compiler doesn't try any shenanigans. XXX pullup-10
2023-06-03bsd.own.mk: rename GCC_NO_* to CC_WNO_*lukem
Rename compiler-warning-disable variables from GCC_NO_warning to CC_WNO_warning where warning is the full warning name as used by the compiler. GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH Using the convention CC_compilerflag, where compilerflag is based on the full compiler flag name.
2023-06-03bsd.own.mk: rename to CC_WNO_ADDRESS_OF_PACKED_MEMBERlukem
Provide a single variable CC_WNO_ADDRESS_OF_PACKED_MEMBER with options for both clang and gcc, to replace CLANG_NO_ADDR_OF_PACKED_MEMBER CC_NO_ADDR_OF_PACKED_MEMBER GCC_NO_ADDR_OF_PACKED_MEMBER Using the convention CC_compilerflag, where compilerflag is based on the full compiler flag name.
2023-05-24no more md5 for you.christos
2023-05-17t_ptm.c: add a test case that passes extra flagsgutteridge
Validate that O_NONBLOCK and O_CLOEXEC are actually set by posix_openpt(3), as until circa 9.99.101 they were not. If/when other flags are added like close-on-fork, this test could be adjusted. The current concern is with supporting the expectations of components like vte3, used by various graphical terminal clients.
2023-05-10t_getopt.sh: fix naming of head() of getopt_optval test casegutteridge
2023-05-07RISC-V support that works on QEMU with a single hart.skrll
Thanks for Simon Burge for plic(4).
2023-04-04Fix the test for "inf" output, also include newline in printf format...he
2023-04-04Add a test for PR/57250 from Havard Eidneschristos
2023-03-20Adjust pc/npc before syscall allowing EJUSTRETURN to returnhannken
to the next instruction. Only ERESTART should return to the same instruction. Differences to sparc64 reduced. Test t_ptrace_wait:syscallemu1 now passes on sparc. Fixes PR kern/52166 "syscallemu does not work on sparc (32-bit)" Ok: Martin Husemann
2023-02-20New optval test from des @ FreeBSDchristos
2023-01-30PR/57205: Dag-Erling Smørgrav: Add tests strchrnul(3), fix strchr pastochristos
from strlen.
2022-12-28swab(3): Rewrite this to be understandable.riastradh
And make the tests work, and exercise all lengths up to 100. Evidently the previous definition, presumably tightly optimized for 1980s-era compilers and CPUs, was too hard to understand, because it was incorrectly tested for two decades and broken for years. PR lib/57141 XXX pullup-8 XXX pullup-9 XXX pullup-10
2022-12-21adapt mbstowcs_basic test for unicode table updatewiz
reformat so it's easier to find which result data belongs to which input
2022-12-04allow testing of files other than those in /etcjschauma
To test e.g., the file "/some/where/protocols" instead of "/etc/protocols", set TEST_FILE=/some/where/protocols in your environment. Note: this now compares the contents of the file you gave versus what getprotoent(3)/getservent(3) uses (which still is /etc/protocols via h_protoent.c / /etc/services or /var/db/services.cdb via h_servent.c). When you have expected changes in the services or protocols file that you're generating, this necessarily produces a difference. To really allow testing the file versus what the library function returns, you'd have to install the file on the system running the test, but at least with this change you can now generate the file and verify that it didn't caused unexpected differences.
2022-12-04whitespacejschauma
2022-11-28whoops, we don't want an extra space herejschauma
(erroneously introduced in my previous commit)
2022-11-28whitespacejschauma
2022-10-06add tests for PR/57046.ryo
2022-08-12membar(3): Fix t_spinlock for machines with hash-locked atomics.riastradh
Regular stores don't participate in the hash-locking scheme, so use atomic_swap instead of a regular store here.
2022-08-01Provide _GNU_SOURCE for t_clone now that is required to make clone()kre
visible.
2022-07-18Make kqueue event status for vnodes shareable, and for stacked file systemsthorpej
like nullfs, make the upper vnode share that status with the lower vnode. And, lo, NetBSD 9.99.99. Fixes PR kern/56713.
2022-06-09There are two hard problems in computer science cache invalidation, namingskrll
and off-by-one errors. Fix a naming and off-by-one bug... Thanks to Tom Lane for spotting my typo.
2022-06-07PR/56865: hppa: t_ptrace_core_wait test doesn't know it must advance PC ↵skrll
after breakpoint Add __hppa__ to the list of architectures that need to advance to the instruction after the breakpoint Thanks to Tom Lane for the fix.
2022-06-04tests/lib/libc: Test mmap(2) with bad hints.riastradh
2022-06-04Fix syntax errorpgoyette
2022-05-31libc: Reintroduce getentropy.riastradh
This was introduced two years ago when the getrandom/getentropy API question was still open, and removed because the discussion was ongoing. Now getentropy is more widely adopted and soon to be in POSIX. So reintroduce the symbol into libc since we'll be keeping it anyway. Discussion of details of the semantics, as interpreted by NetBSD, is ongoing, but the symbol needs to get in before the netbsd-10 branch. The draft POSIX text is (https://www.opengroup.org/austin/docs/austin_1110.pdf): SYNOPSIS #include <unistd.h> int getentropy(void *buffer, size_t length); DESCRIPTION The getentropy() function shall write length bytes of data starting at the location pointed to by buffer. The output shall be unpredictable high quality random data, generated by a cryptographically secure pseudo-random number generator. The maximum permitted value for the length argument is given by the {GETENTROPY_MAX} symbolic constant defined in <limits.h>. RETURN VALUES Upon successful completion, getentropy() shall return 0; otherwise, -1 shall be retunred and errno set to indicate the error. ERRORS The getentropy() function shall fail if: [EINVAL] The value of length is greater than {GETENTROPY_MAX}. The getentropy() function may fail if: [ENOSYS] The system does not provide the necessary source of entropy. RATIONALE The getentropy() function is not a cancellation point. Minor changes from the previous introduction of getentropy into libc: - Return EINVAL, not EIO, on buflen > 256. - Define GETENTROPY_MAX in limits.h. The declaration of getentropy in unistd.h and definition of GETENTROPY_MAX in limits.h are currently conditional on _NETBSD_SOURCE. When the next revision of POSIX is finalized, we can expose them also under _POSIX_C_SOURCE > 20yymmL as usual -- and this can be done as a pullup without breaking existing compiled programs.
2022-05-31s/disbale/disable/ and s/enbale/enable/ in comments. also one more typo fix.andvar
2022-05-31Avoid plabels on hppa to make some tests not crashskrll
2022-05-31whitespace including space before delay slot instruction.skrll
2022-05-30More factoring of common code. NFCIpgoyette
2022-05-30Update test so all four combinations of update_{upper, lower} xpgoyette
monitor_{upper, lower}} can be verified. Currently update_upper is expected to fail regardless of which file is being monitored. PR kern/56713
2022-05-29fix various typos in comments and log messages.andvar
2022-05-24fix various typos in comment, documentation and log messages.andvar
2022-05-24s/estabilishing/establishing/ in copy pasted comment.andvar
2022-05-23s/controll/control/ in comments.andvar
2022-05-07Skip sigfpe_int also for sh3; integer division by zero is not trapped.rin
2022-05-01Rename variables to be more descriptive of their local meaning ratherpgoyette
than referring to external usage.
2022-04-30Don't put temporary files and directories into the atf_srcdir (thatpgoyette
might be read-only!). Instead, put them in the test's working directory what the atf framework will automatically clean up after the test completes.
2022-04-29Add a new test for PR kern/56713 and set to expected_failure for now.pgoyette
2022-04-12s/sould/should/ and s/shoud/should/andvar
2022-04-10membar_ops(3): Simplify alarm handling in membar tests.riastradh
2022-04-09Introduce membar_acquire/release. Deprecate membar_enter/exit.riastradh
The names membar_enter/exit were unclear, and the documentation of membar_enter has disagreed with the implementations on sparc, powerpc, and even x86(!) for the entire time it has been in NetBSD. The terms `acquire' and `release' are ubiquitous in the literature today, and have been adopted in the C and C++ standards to mean load-before-load/store and load/store-before-store, respectively, which are exactly the orderings required by acquiring and releasing a mutex, as well as other useful applications like decrementing a reference count and then freeing the underlying object if it went to zero. Originally I proposed changing one word in the documentation for membar_enter to make it load-before-load/store instead of store-before-load/store, i.e., to make it an acquire barrier. I proposed this on the grounds that (a) all implementations guarantee load-before-load/store, (b) some implementations fail to guarantee store-before-load/store, and (c) all uses in-tree assume load-before-load/store. I verified parts (a) and (b) (except, for (a), powerpc didn't even guarantee load-before-load/store -- isync isn't necessarily enough; need lwsync in general -- but it _almost_ did, and it certainly didn't guarantee store-before-load/store). Part (c) might not be correct, however: under the mistaken assumption that atomic-r/m/w then membar-w/rw is equivalent to atomic-r/m/w then membar-r/rw, I only audited the cases of membar_enter that _aren't_ immediately after an atomic-r/m/w. All of those cases assume load-before-load/store. But my assumption was wrong -- there are cases of atomic-r/m/w then membar-w/rw that would be broken by changing to atomic-r/m/w then membar-r/rw: https://mail-index.netbsd.org/tech-kern/2022/03/29/msg028044.html Furthermore, the name membar_enter has been adopted in other places like OpenBSD where it actually does follow the documentation and guarantee store-before-load/store, even if that order is not useful. So the name membar_enter currently lives in a bad place where it means either of two things -- r/rw or w/rw. With this change, we deprecate membar_enter/exit, introduce membar_acquire/release as better names for the useful pair (r/rw and rw/w), and make sure the implementation of membar_enter guarantees both what was documented _and_ what was implemented, making it an alias for membar_sync. While here, rework all of the membar_* definitions and aliases. The new logic follows a rule to make it easier to audit: membar_X is defined as an alias for membar_Y iff membar_X is guaranteed by membar_Y. The `no stronger than' relation is (the transitive closure of): - membar_consumer (r/r) is guaranteed by membar_acquire (r/rw) - membar_producer (w/w) is guaranteed by membar_release (rw/w) - membar_acquire (r/rw) is guaranteed by membar_sync (rw/rw) - membar_release (rw/w) is guaranteed by membar_sync (rw/rw) And, for the deprecated membars: - membar_enter (whether r/rw, w/rw, or rw/rw) is guaranteed by membar_sync (rw/rw) - membar_exit (rw/w) is guaranteed by membar_release (rw/w) (membar_exit is identical to membar_release, but the name is deprecated.) Finally, while here, annotate some of the instructions with their semantics. For powerpc, leave an essay with citations on the unfortunate but -- as far as I can tell -- necessary decision to use lwsync, not isync, for membar_acquire and membar_consumer. Also add membar(3) and atomic(3) man page links.
2022-04-08membar_ops(3): Add some automatic tests.riastradh
These tests run two threads for five seconds each to try to trigger races in the event of broken memory barriers. They run only on machines with at least two CPUs; on uniprocessor systems there's no point -- the membars can correctly just be (instruction barrier) no-ops.
2022-04-06Add a regression test for PR kern/52239, "Changing protections ofgson
already mmap'ed region can fail", based on the test program in the PR.