| #
85e449cf |
| 10-Apr-2025 |
K Rin <rin@sandb0x.tw> |
libc/tests: copy ieeefp tests out from contrib/netbsd-tests and rename them as FreeBSD test convention.
Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1656
|
| #
670738a1 |
| 03-Jun-2026 |
Jitendra Bhati <bhatijitendra2022@gmail.com> |
fts: add fts regression tests
Add ATF regression tests for previously-fixed fts(3) bugs:
- PR 45723: directory with read but no execute is traversed via FTS_DONTCHDIR fallback, not silently skipp
fts: add fts regression tests
Add ATF regression tests for previously-fixed fts(3) bugs:
- PR 45723: directory with read but no execute is traversed via FTS_DONTCHDIR fallback, not silently skipped (commit 1e03bff7f2b7) - PR 196724: FTS_SLNONE must not be returned for a non-symlink; time-bounded race test runs for 1 second with concurrent file creation/deletion (commit bf4374c54589) - PR 262038: readdir(2) errors produce FTS_DNR with fts_errno set, not silently treated as end-of-directory (commit 0cff70ca6654) - SVN r246641: normal traversal works correctly with O_DIRECTORY fix in fts_safe_changedir() (commit f9928f1705ee) - SVN r261589: no crash when tree modified during traversal; time-bounded race test runs for 1 second with concurrent file creation/deletion (commit c6d38f088e5c)
Sponsored by: Google LLC (GSoC 2026) Reviewed by: asomers MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd-src/pull/2257
show more ...
|
| #
940142d6 |
| 20-May-2026 |
Jitendra Bhati <bhatijitendra2022@gmail.com> |
lib/libc/tests/gen: add fts_set() tests
Add ATF test cases for fts_set():
fts_set: - invalid instruction returns non-zero with EINVAL - FTS_AGAIN revisits the current node - FTS_AGAIN consecutive v
lib/libc/tests/gen: add fts_set() tests
Add ATF test cases for fts_set():
fts_set: - invalid instruction returns non-zero with EINVAL - FTS_AGAIN revisits the current node - FTS_AGAIN consecutive visits node three times - FTS_FOLLOW on symlink to file yields FTS_F - FTS_FOLLOW on symlink to directory causes descent - FTS_FOLLOW on dead symlink yields FTS_SLNONE - FTS_SKIP prevents descent into directory - fts_set_clientptr/fts_get_clientptr round-trip - fts_get_stream returns parent FTS* from FTSENT*
Sponsored by: Google LLC (GSoC 2026) Reviewed by: asomers MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd-src/pull/2242
show more ...
|
| #
e624417d |
| 21-May-2026 |
Jitendra Bhati <bhatijitendra2022@gmail.com> |
lib/libc/tests/gen: add fts_children() tests
Add ATF test cases covering fts_children() behaviour:
- before fts_read returns root entry list - empty directory returns NULL with errno 0 - non-empty
lib/libc/tests/gen: add fts_children() tests
Add ATF test cases covering fts_children() behaviour:
- before fts_read returns root entry list - empty directory returns NULL with errno 0 - non-empty directory returns all children in order - called twice returns equivalent results - FTS_NAMEONLY fills only fts_name, fts_info is FTS_NSOK - non-directory node returns NULL with errno 0 - invalid options returns NULL with EINVAL
Sponsored by: Google LLC (GSoC 2026) Reviewed by: asomers MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/2218
show more ...
|
| #
113c262b |
| 21-May-2026 |
Jitendra Bhati <bhatijitendra2022@gmail.com> |
lib/libc/tests/gen: add fts_open() error and edge case tests
Add ATF test cases covering fts_open() error conditions and edge cases:
- invalid option bits (outside FTS_OPTIONMASK) yield EINVAL - em
lib/libc/tests/gen: add fts_open() error and edge case tests
Add ATF test cases covering fts_open() error conditions and edge cases:
- invalid option bits (outside FTS_OPTIONMASK) yield EINVAL - empty argv yields EINVAL - empty path string yields FTS_NS with ENOENT - nonexistent path yields FTS_NS, not open failure - trailing slash does not crash (SVN r49851 regression) - unreadable directory yields FTS_D then FTS_DNR, never FTS_DP - multiple root paths are all visited left to right
Sponsored by: Google LLC (GSoC 2026) Reviewed by: asomers MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/2217
show more ...
|
| #
4a1c7529 |
| 19-Nov-2025 |
Robert Clausecker <fuz@FreeBSD.org> |
libc/tests: add test for *_MAX, *_MIN, and *_WIDTH
This file checks the correctness of the various _MAX, _MIN, and _WIDTH macros defined for the libc types. It assumes that none of the types have p
libc/tests: add test for *_MAX, *_MIN, and *_WIDTH
This file checks the correctness of the various _MAX, _MIN, and _WIDTH macros defined for the libc types. It assumes that none of the types have padding bits.
Approved by: markj (mentor) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D53831
show more ...
|
| #
c08e019c |
| 08-Jul-2025 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
opendir, fdopendir: Add tests, clean up.
* Add test cases for opendir() and fdopendir(). * Drop O_NONBLOCK from opendir(); it was added a long time ago to avoid blocking if given a closed named pi
opendir, fdopendir: Add tests, clean up.
* Add test cases for opendir() and fdopendir(). * Drop O_NONBLOCK from opendir(); it was added a long time ago to avoid blocking if given a closed named pipe, but now we use O_DIRECTORY, which ensures that we get ENOTDIR in that case. * While here, remove unused #includes left over from the split.
Sponsored by: Klara, Inc. Reviewed by: kevans, markj Differential Revision: https://reviews.freebsd.org/D51126
show more ...
|
| #
8d02b719 |
| 02-Jul-2025 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
fts: Add test cases for unreadable directories.
Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D51098
|
| #
deeebfde |
| 20-Jun-2025 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
libc: Add fscandir(), fscandir_b(), scandirat_b().
While here, clean up scandir() a bit and improve the documentation.
MFC after: never Sponsored by: Klara, Inc. Reviewed by: markj Differential Rev
libc: Add fscandir(), fscandir_b(), scandirat_b().
While here, clean up scandir() a bit and improve the documentation.
MFC after: never Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D50935
show more ...
|
| #
d580567d |
| 15-May-2025 |
Ricardo Branco <rbranco@suse.de> |
Add tests for sig2str() / str2sig()
Reviewed by: imp, kib, des, jilles Pull Request: https://github.com/freebsd/freebsd-src/pull/1696
|
| #
4d7c31bc |
| 23-May-2025 |
Bojan Novković <bnovkov@FreeBSD.org> |
glob2_test: Add tests for error callback functions and blocks
This change adds tests that check basic callback functionality for blocks and function pointers. The tests also make sure that GLOB_ERR
glob2_test: Add tests for error callback functions and blocks
This change adds tests that check basic callback functionality for blocks and function pointers. The tests also make sure that GLOB_ERR overrides the callback's return value.
Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D50486
show more ...
|
| #
d30a84ab |
| 08-May-2025 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
fts: Rename fts_options to fts_options_test
Sponsored by: Klara, Inc.
|
| #
d2da6ed9 |
| 08-May-2025 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
fts: Add tests for most FTS options.
Sponsored by: Klara, Inc. Reviewed by: kevans, imp Differential Revision: https://reviews.freebsd.org/D50234
|
| #
12668ead |
| 22-Apr-2025 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
bsd.compiler.mk: Add a blocks compiler feature.
Sponsored by: Klara, Inc. Reviewed by: jrtc27 Differential Revision: https://reviews.freebsd.org/D49963
|
| #
f0ac5e91 |
| 22-Apr-2025 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
fts: Add blocks support.
This adds an `fts_open_b()` variant of `fts_open()` which takes a block instead of a function pointer.
This was inspired by, and is intended to be compatible with, Apple's
fts: Add blocks support.
This adds an `fts_open_b()` variant of `fts_open()` which takes a block instead of a function pointer.
This was inspired by, and is intended to be compatible with, Apple's implementation; however, although our FTS and theirs share a common ancestor, they have diverged significantly. That and the fact that we still target compilers which don't support blocks means Apple's implementation was not directly reusable.
This is the second use case for blocks in FreeBSD (the first being `qsort_b()`, which we use here). This suggest we might want to add a `COMPILER_FEATURE` for blocks to avoid hardcoding any further `COMPILER_TYPE` checks.
MFC after: never Relnotes: yes Sponsored by: Klara, Inc. Reviewed by: kevans, theraven, imp Differential Revision: https://reviews.freebsd.org/D49877
show more ...
|
| #
e9ac4169 |
| 15-Jul-2024 |
Warner Losh <imp@FreeBSD.org> |
Remove residual blank line at start of Makefile
This is a residual of the $FreeBSD$ removal.
MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
|
| #
d0b2dbfa |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
|
| #
9e1281ea |
| 31-Dec-2020 |
Kyle Evans <kevans@FreeBSD.org> |
libc: tests: hook CPUSET(9) test up to the build
Add shims to map NetBSD's API to CPUSET(9). Obviously the invalid input parts of these tests are relatively useless since we're just testing the shim
libc: tests: hook CPUSET(9) test up to the build
Add shims to map NetBSD's API to CPUSET(9). Obviously the invalid input parts of these tests are relatively useless since we're just testing the shims that aren't used elsewhere, there's still some amount of value in the parts testing valid inputs.
Differential Revision: https://reviews.freebsd.org/D27307
show more ...
|
| #
2d143336 |
| 24-Jun-2020 |
Mitchell Horne <mhorne@FreeBSD.org> |
Enable long double tests on RISC-V
Some of the NetBSD contributed tests are gated behind the __HAVE_LONG_DOUBLE flag. This flag seems to be defined only for platforms whose long double is larger tha
Enable long double tests on RISC-V
Some of the NetBSD contributed tests are gated behind the __HAVE_LONG_DOUBLE flag. This flag seems to be defined only for platforms whose long double is larger than their double. I could not find this explicitly documented anywhere, but it is implied by the definitions in NetBSD's sys/arch/${arch}/include/math.h headers, and the following assertion from the UBSAN code:
#ifdef __HAVE_LONG_DOUBLE long double LD; ASSERT(sizeof(LD) > sizeof(uint64_t)); #endif
RISC-V has 128-bit long doubles, so enable the tests on this platform, and update the comments to better explain the purpose of this flag.
Reviewed by: ngie MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25419
show more ...
|
| #
301cb491 |
| 10-Jun-2020 |
Kyle Evans <kevans@FreeBSD.org> |
execvp: fix up the ENOEXEC fallback
If execve fails with ENOEXEC, execvp is expected to rebuild the command with /bin/sh instead and try again.
The previous version did this, but overlooked two det
execvp: fix up the ENOEXEC fallback
If execve fails with ENOEXEC, execvp is expected to rebuild the command with /bin/sh instead and try again.
The previous version did this, but overlooked two details:
argv[0] can conceivably be NULL, in which case memp would never get terminated. We must allocate no less than three * sizeof(char *) so we can properly terminate at all times. For the non-NULL argv standard case, we count all the non-NULL elements and actually skip the first argument, so we end up capturing the NULL terminator in our bcopy().
The second detail is that the spec is actually worded such that we should have been preserving argv[0] as passed to execvp:
"[...] executed command shall be as if the process invoked the sh utility using execl() as follows:
execl(<shell path>, arg0, file, arg1, ..., (char *)0);
where <shell path> is an unspecified pathname for the sh utility, file is the process image file, and for execvp(), where arg0, arg1, and so on correspond to the values passed to execvp() in argv[0], argv[1], and so on."
So we make this change at this time as well, while we're already touching it. We decidedly can't preserve a NULL argv[0] as this would be incredibly, incredibly fragile, so we retain our legacy behavior of using "sh" for argv[] in this specific instance.
Some light tests are added to try and detect some components of handling the ENOEXEC fallback; posix_spawnp_enoexec_fallback_null_argv0 is likely not 100% reliable, but it at least won't raise false-alarms and it did result in useful failures with pre-change libc on my machine.
This is a secondary change in D25038.
Reported by: Andrew Gierth <andrew_tao173.riddles.org.uk> Reviewed by: jilles, kib, Andrew Gierth MFC after: 1 week
show more ...
|
| #
7dc859a5 |
| 12-Dec-2019 |
Kyle Evans <kevans@FreeBSD.org> |
Add sigsetop extensions commonly found in musl libc and glibc
These functions (sigandset, sigisemptyset, sigorset) are commonly available in at least musl libc and glibc; sigorset, at least, has pro
Add sigsetop extensions commonly found in musl libc and glibc
These functions (sigandset, sigisemptyset, sigorset) are commonly available in at least musl libc and glibc; sigorset, at least, has proven quite useful in qemu-bsd-user work for tracking the current process signal mask in a more self-documenting/aesthetically pleasing manner.
Reviewed by: bapt, jilles, pfg MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22187
show more ...
|
| #
e9ac2743 |
| 21-Mar-2018 |
Conrad Meyer <cem@FreeBSD.org> |
Implement getrandom(2) and getentropy(3)
The general idea here is to provide userspace programs with well-defined sources of entropy, in a fashion that doesn't require opening a new file descriptor
Implement getrandom(2) and getentropy(3)
The general idea here is to provide userspace programs with well-defined sources of entropy, in a fashion that doesn't require opening a new file descriptor (ulimits) or accessing paths (/dev/urandom may be restricted by chroot or capsicum).
getrandom(2) is the more general API, and comes from the Linux world. Since our urandom and random devices are identical, the GRND_RANDOM flag is ignored.
getentropy(3) is added as a compatibility shim for the OpenBSD API.
truss(1) support is included.
Tests for both system calls are provided. Coverage is believed to be at least as comprehensive as LTP getrandom(2) test coverage. Additionally, instructions for running the LTP tests directly against FreeBSD are provided in the "Test Plan" section of the Differential revision linked below. (They pass, of course.)
PR: 194204 Reported by: David CARLIER <david.carlier AT hardenedbsd.org> Discussed with: cperciva, delphij, jhb, markj Relnotes: maybe Differential Revision: https://reviews.freebsd.org/D14500
show more ...
|
| #
acf1f710 |
| 31-Jan-2018 |
John Baldwin <jhb@FreeBSD.org> |
Add a new set of simple tests for makecontext().
In contrast to the existing NetBSD setcontext_link test, these tests verify that passing from 1 to 6 arguments through to the callback function work
Add a new set of simple tests for makecontext().
In contrast to the existing NetBSD setcontext_link test, these tests verify that passing from 1 to 6 arguments through to the callback function work correctly which can be useful for testing ABIs which split arguments between registers and the stack.
Sponsored by: DARPA / AFRL
show more ...
|
| #
82241ed5 |
| 06-Dec-2017 |
Alan Somers <asomers@FreeBSD.org> |
Optimize telldir(3)
Currently each call to telldir() requires a malloc and adds an entry to a linked list which must be traversed on future telldir(), seekdir(), closedir(), and readdir() calls. App
Optimize telldir(3)
Currently each call to telldir() requires a malloc and adds an entry to a linked list which must be traversed on future telldir(), seekdir(), closedir(), and readdir() calls. Applications that call telldir() for every directory entry incur O(n^2) behavior in readdir() and O(n) in telldir() and closedir().
This optimization eliminates the malloc() and linked list in most cases by packing the relevant information into a single long. On 64-bit architectures msdosfs, NFS, tmpfs, UFS, and ZFS can all use the packed representation. On 32-bit architectures msdosfs, NFS, and UFS can use the packed representation, but ZFS and tmpfs can only use it for about the first 128 files per directory. Memory savings is about 50 bytes per telldir(3) call. Speedup for telldir()-heavy directory traversals is about 20-30x for one million files per directory.
Reviewed by: kib, mav, mckusick MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D13385
show more ...
|
| #
5a28df2e |
| 25-Aug-2017 |
Conrad Meyer <cem@FreeBSD.org> |
getmntinfo(3): Scale faster, and return sooner
getmntinfo(3) is designed around a relatively static or slow growing set of current mounts. It tried to detect a race with somewhat concurrent mount a
getmntinfo(3): Scale faster, and return sooner
getmntinfo(3) is designed around a relatively static or slow growing set of current mounts. It tried to detect a race with somewhat concurrent mount and re-call getfsstat(2) in that case, looping indefinitely. It also allocated space for a single extra mount as slop.
In the case where the user has a large number of mounts and is adding them at a rapid pace, it fell over.
This patch makes two functional changes:
1. Allocate even more slop. Double whatever the last getfsstat(2) returned.
2. Abort and return some known results after looping a few times (arbitrarily, 3). If the list is constantly changing, we can't guarantee we return a full result to the user at any point anyways.
While here, add very basic functional tests for getmntinfo(3) to the libc suite.
PR: 221743 Submitted by: Peter Eriksson <peter AT ifm.liu.se> (earlier version) Sponsored by: Dell EMC Isilon
show more ...
|