aboutsummaryrefslogtreecommitdiff
path: root/contrib/netbsd-tests
Commit message (Collapse)AuthorAgeFilesLines
* bin/cat: add test for reading data from stdinK Rin2025-06-132-0/+16
| | | | | | Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1671 Closes: https://github.com/freebsd/freebsd-src/pull/1671
* Revert "Mark several getaddrinfo tests as XFAIL"Enji Cooper2025-05-281-18/+0
| | | | | | This change was unreviewed and should not have been committed to :main. This reverts commit 9b37d84c87e69dabc69d818aa4d2fea718bd8b74.
* Mark several getaddrinfo tests as XFAILEnji Cooper2025-05-281-0/+18
| | | | | | | | | | | | | | | | | These tests were recently enabled on main and have failed consistently since they were enabled. - lib.libc.net.getaddrinfo.getaddrinfo.basic - lib.libc.net.getaddrinfo.getaddrinfo.nofamily - lib.libc.net.getaddrinfo.getaddrinfo_test.basic - lib.libc.net.getaddrinfo.getaddrinfo_test.empty_servname - lib.libc.net.getaddrinfo.getaddrinfo_test.sock_raw Mark them as expected failures so they no longer count as failures in Jenkins CI. PR: 285826 MFC with: 5313457780, 0b773a94ab
* Fix remaining zgrep(1) wrapper script regressionsCraig Leres2025-02-091-4/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Fix short flags without whitespace, e.g: zgrep -wefoo test Fix multiple -e flags: zgrep -e foo -e xxx test Previously only the last pattern would be used. Clean up possible leading blank in ${grep_args}. Update comment: 2.51 -> 2.6.0 Add a test case for the last known zgrep wrapper issue: recursion (-r) not implemented. Reviewers: markj, kevans, ngie, bapt Reviewed By: markj Subscribers: imp Differential Revision: https://reviews.freebsd.org/D48873
* vfs: Fix vop_stdis_text()Mark Johnston2024-11-191-0/+35
| | | | | | | | | | | | | | | atomic(9) primitives are documented as operating on unsigned types. Here, we need a cast to avoid a tautological comparison. Add a regression test for access(2), which was affected by the bug. Reported by: NetApp Reviewed by: kib Fixes: e511bd1406fa ("vfs: fully lockless v_writecount adjustment") MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D47672
* netbsd-tests: Update a test case to chase grep symlink handling changesMark Johnston2024-09-071-1/+1
| | | | | | | | | | | This test case verifies that grep detects symlink loops when traversing a directory hierarchy. Fixes: fc12c191c087 ("grep: Default to -p instead of -S.") Reviewed by: ngie, jhb Reported by: Jenkins MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D46544
* netbsd-tests: Remove an xfail annotationMark Johnston2024-08-291-3/+0
| | | | | | | The test passes after commit 5ab6ed93cd36 ("faccessat(2): Honor AT_SYMLINK_NOFOLLOW"). Reported by: Jenkins
* man filesystems: fix more xrefs after move to s4Alexander Ziaee2024-06-281-3/+3
| | | | | | Fixes: 1a720cbec513 Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1282
* contrib: Remove various $FreeBSD$ tags not upstreamWarner Losh2024-05-311-2/+0
| | | | Sponsored by: Netflix
* Prepare the system for _FORTIFY_SOURCEKyle Evans2024-05-131-0/+3
| | | | | | | | | | | | | | | Notably: - libc needs to #undef some of the macros from ssp/* for underlying implementations - ssp/* wants a __RENAME() macro (snatched more or less from NetBSD) There's some extra hinkiness included for read(), since libc spells it as "_read" while the rest of the world spells it "read." Reviewed by: imp, ngie Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D32307
* tmpfs tests: Remove an xfail annotationMark Johnston2024-04-041-2/+0
| | | | | | | | This test passes after commit 08f3d5b60cdf ("copy_file_range: Call vn_rdwr() at least once"). PR: 274615 MFC after: 1 month
* tmpfs: Improve file time tests.Dag-Erling Smørgrav2024-04-041-6/+32
| | | | | | | | | | | | | | | | * The empty test case no longer fails because 89f1dcb3eb46 causes empty files to bypass the bug. * The bug still exists, so add a test case which exercises it. * While here, tighten up some of the checks. A similar patch has been submitted upstream. PR: 274615 X-MFC-With: 89f1dcb3eb46 Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D44609
* Add expected failure for tmpfs atime test failing on FreeBSDEd Maste2023-10-221-0/+4
| | | | | | | PR: 274615 Reviewed by: ngie Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42321
* libc: Add unit tests for N2630 and possible collateral damage.Dag-Erling Smørgrav2023-08-281-0/+6
| | | | | Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D41512
* netbsd-tests: libc: fix strvis(3) overflow testsKyle Evans2023-08-201-1/+1
| | | | | | | | | | | | | These tests weren't run on x86 until CI grabbed them. It turns out, there's a sign extension bug that surfaces on x86 with char being a signed type. NetBSD unearthed this when they took and improved the patch, so just grab their solution until we get to merging in the latest version of the test. Reported by: CI (via ngie) Fixes: 2f489a509e61 ("libc: fix some overflow scenarios in vis(3)")
* libc: fix some overflow scenarios in vis(3)Kyle Evans2023-08-081-0/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | The previous incarnation of this would call wcrtomb() on the destination buffer, and only check for overflow *after* it's happened. Additionally, the conversion error / VIS_NOLOCALE path also didn't check for overflow, and the overflow check at the end didn't account for the fact that we still need to write a NUL terminator afterward. Start by only doing the multibyte conversion into mbdst directly if we have enough buffer space to guarantee it'll fit. An additional MB_CUR_MAX buffer has been stashed on the stack to write into if we're cutting it close at the end of the buffer, since we don't really have a good way to determine the length of the wchar_t without just doing the conversion. We'll do the conversion into the buffer that's guaranteed to fit, then copy it over if the copy won't overflow. The byte-for-byte overflow is a little bit easier, as we simply check for overflow with each byte written and make sure we can still NUL terminate after. Tests added to exercise these edge cases. Reviewed by: des Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D41328
* libexecinfo: Enable backtrace_test.backtrace_fmt_basic on amd64 againDmitry Chagin2023-06-291-5/+0
| | | | | | | | Due to unwind tables generation enabled after c969310c for csu. PR: 241562, 246322, 246537 Reviewed by: kib, ngie Differential Revision: https://reviews.freebsd.org/D40758
* netbsd-tests: Remove some pointless sleeps from message queue testsMark Johnston2023-03-103-6/+0
| | | | | | | | | | - In the msgctl tests, there is no point in sleeping after a fork(). Just block immediately in wait(). - In non-blocking send/recv tests, just wait for the child to exit once it's reached a message limit. If a bug prevents the child from exiting promptly, the test will time out. MFC after: 1 week
* libc: Add tests for strchrnul(3).Dag-Erling Smørgrav2023-02-022-6/+299
| | | | | | | MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D38286
* libc: Update mktime(3) / timegm(3) tests.Dag-Erling Smørgrav2023-01-251-11/+10
| | | | | | Sponsored by: Klara, Inc. Reviewed by: ngie Differential Revision: https://reviews.freebsd.org/D38177
* libc: Fix longjmp/_longjmp(buf, 0) for AArch64 and RISC-VJessica Clarke2023-01-091-5/+45
| | | | | | | | | | | These architectures fail to handle this special case, and will cause the corresponding setjmp/_setjmp to return 0 rather than 1. Fix this and add regression tests (also committed upstream). PR: 268684 Reviewed by: arichardson, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29363
* h_resolv: Fix a buffer overflow in load().John Baldwin2022-12-281-5/+5
| | | | | | | | | | | | | | | | fgetln() returns a pointer to an array of characters that is 'len' characters long, not 'len + 1'. While here, overwriting the contents of the buffer returned by fgetln isn't really safe, so switch to using getline() instead. Note that these fixes are a subset of those applied to a near-identical copy of this function in libc's resolv_test.c in commit 2afeaad315ac19450389b8f2befdbe7c91c37818. Reviewed by: ngie Reported by: CHERI (buffer overflow) Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D37886
* sysv test: properly wait for childrenEric van Gyzen2022-05-131-142/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the msg and shm tests, if the child exited before the parent entered sigsuspend(), the test would hang and time out. This was also a problem in the sem test, but the misuse of atf_tc_pass() masked it. Adding a short sleep before the sigsuspend() calls made the hang 100% reliable. With the same sleep in the new version, the test passes reliably. Remove calls to atf_tc_pass(). The call in the sem test broke the test by exiting prematurely, after only one child out of five had finished. The other two were harmless but unhelpful. Reduce a one-second sleep to a more reasonable duration so I can quickly run many iterations of the test. Where feasible, assert that wait() returns the child PID. While I'm here, use the more succinct ATF_REQUIRE* instead of if/atf_tc_fail/else. Flush stdout before forking to avoid double-flush. Use errx() when errno is irrelevant. Don't use ATF_REQUIRE* in children. Apparently, the output doesn't get saved. The exit status works, so it fails correctly, but silently. Re-enable the test in CI. PR: 233649 Reviewed by: markj (previous version) MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D35187
* newfs_msdos: connect the ATF test from NetBSDEric van Gyzen2022-02-161-2/+12
| | | | | | | | | | | NetBSD has an ATF test for newfs_msdos. Connect it to the build. Adapt it for FreeBSD. This would have caught the bug fixed by my previous commit. Reviewed by: delphij, emaste MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D34116
* netbsd-tests: Fix the libc stat_socket testMark Johnston2022-01-141-7/+4
| | | | | | | | | | | The test tries to connect a socket to a closed port at 127.0.0.1. It sets O_NONBLOCK on the socket first and expects to get EINPROGRESS from connect(2), but this is not guaranteed, ECONNREFUSED is possible. Handle both cases, and re-enable the test. PR: 240621 MFC after: 1 week Sponsored by: The FreeBSD Foundation
* Revert "Disable flaky test lib.libc.sys.setrlimit_test.setrlimit_stack"Mark Johnston2022-01-141-3/+0
| | | | | | | | | | | The stack gap implementation is disabled by default now, so the test passes. This reverts commit dad71022bd7a8f95ab2ba656bec61e2424a1c3c5. PR: 259969 MFC after: 1 week Sponsored by: The FreeBSD Foundation
* Revert "t_setrlimit: Adjust resource limit to 20M"Marcin Wojtas2021-12-201-4/+0
| | | | | | | This reverts commit 4f741801d86089a1c5d631ba1e0f1421cdcf7a7e. As per discussion in PR: 260303 the reverted patch covered the real issue with a fixed address of the top of the stack.
* t_setrlimit: Adjust resource limit to 20MDawid Gorecki2021-12-201-0/+4
| | | | | | | | | | | | | With ASLR enabled by default, RLIMIT_STACK test fails due to the fact that default stack gap can be as big as 15M. Because of that the resource limit of 4M results in test program receiving SIGSEGV immediately after exiting the setrlimit syscall. Since the idea of this test is to check if rlim_cur does not extend past rlim_max, adjusting the resource limit to 20M should not invalidate the test results. Obtained from: Semihalf Sponsored by: Alstom Group Differential revision: https://reviews.freebsd.org/D33116
* Add tests for posix_spawn_file_actions_add{chdir,fchdir}_np(3)Konstantin Belousov2021-11-301-0/+75
| | | | | | | Reviewed by: kevans, ngie (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33143
* netbsd h_raw.c test: fake use of sum to avoid warningKonstantin Belousov2021-11-291-0/+2
| | | | | Sponsored by: The FreeBSD Foundation MFC after: 1 week
* t_mlock.c: Remove null_errno, it is write-onlyKonstantin Belousov2021-11-291-8/+0
| | | | | Sponsored by: The FreeBSD Foundation MFC after: 1 week
* Disable flaky test lib.libc.sys.setrlimit_test.setrlimit_stackLi-Wen Hsu2021-11-281-0/+3
| | | | | PR: 259969 Sponsored by: The FreeBSD Foundation
* time_t is pathological: use %j + cast to print it.Warner Losh2021-10-011-1/+1
| | | | Sponsored by: Netflix
* sem_clockwait_np test: fix usage of ATF APIEric van Gyzen2021-10-011-2/+4
| | | | | | | | | | ATF_REQUIRE_ERRNO requires the given errno iff the given expression is true. These test cases used it incorrectly, potentially allowing sem_clockwait_np to succeed when it was expected to fail. Use separate ATF calls to require failure and the expected errno. MFC after: 1 week Sponsored by: Dell EMC Isilon
* sem test: move sem_clockwait_np tests into individual casesEric van Gyzen2021-10-011-24/+102
| | | | | | | | Move these tests into individual test cases for all the usual reasons. No functional change intended. MFC after: 1 week Sponsored by: Dell EMC Isilon
* sem_clockwait_np test: relax time constraint on VMsEric van Gyzen2021-10-011-6/+25
| | | | | | | | | In a guest on a busy hypervisor, the time remaining after an interrupted sleep could be much lower than other environments. Relax the lower bound on VMs. MFC after: 1 week Sponsored by: Dell EMC Isilon
* libc/tests: Correctly compare si_status from wait6()Jilles Tjoelker2021-07-251-1/+1
| | | | | | | | Fix erroneous = that was meant to be ==. Revision 1.10 from NetBSD t_wait.c Obtained from: NetBSD
* t_getgroups: No longer expected to failWarner Losh2021-06-021-3/+0
| | | | Sponsored by: Netflix
* sort: Make NetBSD sort tests compatible with our sortCyril Zhang2021-05-131-22/+35
| | | | | | | | | | | This diff primarily adds/removes flags to make the tests compatible with sort. Two tests are removed. One test is changed to expect fail due to a bug. Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30217
* lib/msun: Allow building tests with WARNS=6Alex Richardson2021-03-224-14/+13
| | | | The only change needed is to mark a few variables as static.
* Allow ssp_test:read to pass more reliablyAlex Richardson2021-03-011-1/+1
| | | | | | | | | | It appears that the stackframe layout can be slightly different depending on compiler and target architecture. For example, when using CHERI LLVM for RISC-V we can actually overflow the buffer by up to 8 bytes without SSP detecting it. Fix this by increasing the overflow to 15 bytes. Reviewed By: ngie, emaste Differential Revision: https://reviews.freebsd.org/D28997
* Update libm tests from NetBSDAlex Richardson2021-02-2221-321/+944
| | | | | | | | | I did this without a full vendor update since that would cause too many conflicts. Since these files now almost match the NetBSD sources the next git subtree merge should work just fine. Reviewed By: lwhsu Differential Revision: https://reviews.freebsd.org/D28797
* libc: Fix t_spawn_fileactions test after ATF updateAlex Richardson2021-02-182-24/+45
| | | | | | | | | | | | | | | | | Since https://github.com/freebsd/atf/commit/4581cefc1e3811dd3c926b5dd4b15fd63d2e19da ATF opens the results file on startup. This fixes problems like capsicumized tests not being able to open the file on exit. However, this test closes all file descriptors above 3 to get a deterministic fd table allocation for the child. Instead of using closefrom (which will close the ATF output file FD) I've changed this test use the lowest available fd and pass that to the helper program as a string. We could also try to re-open the results file in ATF if we get a EBADF error, but that will fail when running under Capsicum. Reviewed By: cem Differential Revision: https://reviews.freebsd.org/D28684
* Fix two failing tests after ATF updateAlex Richardson2021-02-152-6/+23
| | | | | | | | | | | | | | | | | | | | | Since https://github.com/freebsd/atf/commit/4581cefc1e3811dd3c926b5dd4b15fd63d2e19da ATF opens the results file on startup. This fixes problems like capsicumized tests not being able to open the file on exit. However, this test closes all file descriptors just to check that socketpair returns fd 3+4 and thereby also closes the ATF results file. This then results in an EBADF when writing the result so the test is reported as broken. While system calls that create new file descriptors (must?) use the lowest available file descriptor number, it does not seem useful to test this property here. Drop the check for FD==3/4 to unbreak the testsuite. We could also try to re-open the results file in ATF if we get a EBADF error, but that will fail when running under Capsicum. Reviewed By: cem Differential Revision: https://reviews.freebsd.org/D28683
* lib/libc/tests/rpc: Correctly set timeoutAlex Richardson2021-02-131-0/+10
| | | | | | | | | | | | The rpc_control() API does not accept the CLCR_SET_RPCB_TIMEOUT command, it only accepts RPC_SVC_CONNMAXREC_GET/RPC_SVC_CONNMAXREC_SET, so it was not doing anything. Instead of incorrectly calling this API, use clnt_create_timed() instead. I noticed this because the test was timing out after 120s in the CheriBSD CI. Reviewed By: ngie Differential Revision: https://reviews.freebsd.org/D28478
* Fix lib/msun/test builds on platforms without 80-bit long doublesDimitry Andric2021-02-111-0/+4
| | | | | | | | | | | After d3338f3355a612cf385632291f46c5777bba8d18, the lib/msun test case 'hypotl_near_underflow' would fail to compile on platforms where long doubles weren't 80 bit, like on x86. Disable this particular test on such platforms for now. PR: 253313 MFC after: 1 week X-MFC-With: d3338f3355a612cf385632291f46c5777bba8d18
* Fix incorrect hypotl(3) result with subnormal numbersDimitry Andric2021-02-101-0/+20
| | | | | | | | | | | This adjusts the factor used to scale the subnormal numbers, so it becomes the right value after adjusting its exponent. Thanks to Steve Kargl for finding the most elegant fix. Also enable the hypot tests, and add a test case for this bug. PR: 253313 MFC after: 1 week
* Add test case for 93fc67896550 (incorrect powf(3) result)Dimitry Andric2021-02-091-0/+22
| | | | | | | This adds the test case to contrib/netbsd-tests/lib/libm/t_pow.c, as it is currently the only place testing pow(3) and friends. MFC after: 1 week
* grep: fix -A handling in conjunction with -m match limitationKyle Evans2021-02-081-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The basic issue here is that grep, when given -m 1, would stop all line processing once it hit the match count and exit immediately. The problem with exiting immediately is that -A processing only happens when subsequent lines are processed and do not match. The fix here is relatively easy; when bsdgrep matches a line, it resets the 'tail' of the matching context to the value supplied to -A and dumps anything that's been queued up for -B. After the current line has been printed and tail is reset, we check our mcount and do what's needed. Therefore, at the time that we decide we're doing nothing, we know that 'tail' of the context is correct and we can simply continue on if there's still more to pick up. With this change, we still bail out immediately if there's been no -A flag. If -A was supplied, we signal that we should continue on. However, subsequent lines will not even bothere to try and process the line. We have reached the match count, so even if the next line would match then we must process it if it hadn't. Thus, the loop in procfile() can short-circuit and just process the line as a non-match until procmatches() indicates that it's safe to stop. A test has been added to reflect both that we should be picking up the next line and that the next line should be considered a non-match even if it should have been. PR: 253350 MFC-after: 3 days
* grep: fix null pattern and empty pattern file behaviorKyle Evans2021-02-051-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | The null pattern semantics were terrible because I tried to match gnugrep, but I got it wrong. Let's unwind that: - The null pattern should match every line if neither -w nor -x. - The null pattern should match empty lines if -x. - The null pattern should not match any lines if -w. The first two will stop processing (shortcut) even if additional patterns are specified. In any other case, we will continue processing other patterns. If no other patterns are specified beside a null pattern, then we match if neither -w nor -x or set and do not match if either of those are specified. The justification for -w is that it should match on a whole word, but the null pattern deos not have a whole word to match on. Empty pattern files should never match anything, and more importantly, -v should cause everything to be written. PR: 253209 MFC-after: 4 days