summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* xtime: Call tzset() from main() instead of lazilyTavian Barnes2024-03-074-13/+18
| | | | | | | | | | | | | POSIX specifies[1] that If a thread accesses tzname, daylight, or timezone directly while another thread is in a call to tzset(), or to any function that is required or allowed to set timezone information as if by calling tzset(), the behavior is undefined. So calling it lazily from arbitrary threads is risky. [1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/tzset.html
* tests: Change the timezone for -daystart testsTavian Barnes2024-03-072-2/+2
| | | | | | | Otherwise, if the test files are created just before midnight, and the test runs just after midnight, -daystart will consider them one day old. Fixes #132
* tests/ioq: Check that we push and pop the same number of timesTavian Barnes2024-03-021-3/+5
|
* tests: New bfs_check() macroTavian Barnes2024-02-296-234/+247
| | | | | We now report failures and continue, rather than aborting after the first failure.
* tests: Add more datetime parsing integration testsTavian Barnes2024-02-292-4/+6
|
* xtime: Fix some xgetdate() bugsTavian Barnes2024-02-281-9/+93
| | | | And add some more test cases.
* tests/ioq: New unit testTavian Barnes2024-02-283-0/+77
|
* tests/bfs/D_opt: Don't rely on directory link countsTavian Barnes2024-02-282-12/+1
| | | | Fixes: https://github.com/tavianator/bfs/issues/131
* tests: Redirect stdin in bfs_pty()Tavian Barnes2024-02-171-1/+1
| | | | Otherwise bfs will think it's interactive.
* bftw: stat() files asynchronouslyTavian Barnes2024-02-061-1/+1
|
* tests: Fix --stopTavian Barnes2024-02-051-1/+1
|
* tests: Implement jobserver inheritanceTavian Barnes2024-02-034-35/+125
|
* tests: Don't clobber inherited FDsTavian Barnes2024-02-0111-52/+45
| | | | | Rather than attempting to close any unexpected FDs, just count them and adjust our ulimit -n calls to account for them.
* tests: Use variable redirections to dup std{out,err}Tavian Barnes2024-02-012-28/+15
| | | | | | | | | | | Previously, we hardcoded file descriptors 3 and 4 for duplicating stdandard output/error respectively. In preparation for keeping inherited FDs open, switch to using bash's variable redirection feature to dynamically assign FDs. This feature is only available from bash 4.1 onwards, so this marks the end of our support for bash 3. macOS users will need to install a modern bash version to run our tests.
* bftw: Actually stop if the callback returns BFTW_STOPTavian Barnes2024-01-312-0/+5
| | | | | | Otherwise, bftw_ids() or bftw_eds() might keep going! Fixes: 5f16169 ("bftw: Share the bftw_state between iterations of ids/eds")
* tests/posix: Avoid catastrophic backtrackingTavian Barnes2024-01-172-11/+2
| | | | | | Using -path 'deep/*/*/.../*' to simulate -mindepth 18 falls off a performance cliff on systems that use backtracking for fnmatch(). This was observed on macOS 12.4. Instead, just use -type f.
* tests: Properly filter escape sequences with --verbose=testsTavian Barnes2024-01-131-1/+1
|
* bfstd: New {error,errno}_is_like() functionsTavian Barnes2024-01-131-14/+3
| | | | | | | We used to have is_nonexistence_error() to consistently treat ENOENT and ENOTDIR the same. Recently, we started considering EFAULT the same as ENAMETOOLONG on DragonFly BSD to work around a kernel bug. Unify both of these behind a more generic interface.
* tests.h: Add a header guardTavian Barnes2024-01-131-0/+5
|
* tests: Merge unit test executables into oneTavian Barnes2024-01-127-13/+149
|
* tests: New output formatTavian Barnes2024-01-111-13/+28
|
* tests: Don't do chmod +sTavian Barnes2024-01-091-2/+3
| | | | | | | | | | | | | | | | | | POSIX says > When using the symbolic mode form on a regular file, it is > implementation-defined whether or not: > > - Requests to set the set-user-ID-on-execution or set-group-ID-on- > execution bit when all execute bits are currently clear and none > are being set are ignored. And indeed, illumos ignores them with a warning: chmod: WARNING: /tmp/bfs.XXXX7KaGWb/rainbow/suid: Execute permission required for set-ID on execution Link: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/chmod.html
* tests/bfs/D_opt: New test for more -D opt coverageTavian Barnes2024-01-072-0/+19
|
* Work around DragonFly BSD kernel bugTavian Barnes2024-01-041-0/+6
| | | | | | | | | DragonFly's x86_64 assembly implementation of copyinstr() checks the wrong pointer when deciding whether to return EFAULT or ENAMETOOLONG, causing it to always return EFAULT for overlong paths. Work around it by treating EFAULT the same as ENAMETOOLONG on DragonFly. Link: https://twitter.com/tavianator/status/1742991411203485713
* tests/posix/name_bracket: Skip on NetBSD tooTavian Barnes2024-01-031-2/+6
|
* tests/bsd/type_w: Check for truncate(1) before using itTavian Barnes2024-01-031-1/+5
|
* tests: Remove unneeded command -v unbuffer || skipTavian Barnes2024-01-012-4/+0
|
* parse: Reject integers that start with whitespaceTavian Barnes2023-12-091-0/+1
|
* tests: Set abort_on_error for the sanitizersTavian Barnes2023-11-231-1/+1
|
* tests: Fix --stopTavian Barnes2023-11-231-0/+6
|
* tests: Fix a possible infinite loopTavian Barnes2023-11-151-2/+4
| | | | | | | | | | | | | | | | | | | The POSIX spec for readdir() [1] says: > If a file is removed from or added to the directory after the most > recent call to opendir() or rewinddir(), whether a subsequent call > to readdir() returns an entry for that file is unspecified. which implies that a loop of readdir()/unlink()/creat() may continue to return new files unendingly. This was even observed on a Linux 6.6 tmpfs mount [2]. It's not clear whether find(1) is also permitted to loop endlessly in this case, but in case it is, let's avoid the whole problem by limiting the -exec to happen at most once. [1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/readdir.html [2]: https://lore.kernel.org/linux-fsdevel/20231113180616.2831430-1-tavianator@tavianator.com/
* tests: Fix --verbose=commands with --bfs="wrapper bfs"Tavian Barnes2023-11-131-1/+1
|
* Revert "bit: Implement a branchless has_single_bit()"Tavian Barnes2023-11-111-0/+1
| | | | | | Doesn't work for the highest bit due to overflow. This reverts commit 208376ef99da243545efcd6fb02d3469b4c068ed.
* bit: Implement a branchless has_single_bit()Tavian Barnes2023-11-101-0/+3
|
* config: Add (de)allocator attributesTavian Barnes2023-11-091-0/+4
|
* parse: Reject -{exec,ok}dir if $PATH contains a relative pathTavian Barnes2023-11-076-0/+6
| | | | This matches the behaviour of GNU find.
* tests: Fix output interleaving with -j1Tavian Barnes2023-11-071-5/+5
|
* Treat NO_COLOR="" the same as unsetTavian Barnes2023-11-062-0/+32
| | | | | | | | | | | | | | The docs say > Command-line software which adds ANSI color to its output by default > should check for a NO_COLOR environment variable that, when present > and not an empty string (regardless of its value), prevents the > addition of ANSI color. but we were not checking for the empty string. Link: https://no-color.org/ Link: https://github.com/sharkdp/fd/pull/1421
* tests: Add tests for ulimit -n after -execTavian Barnes2023-11-024-0/+36
|
* tests/bfs/help: Fix exit statusTavian Barnes2023-10-231-4/+4
|
* tests/bfs/help: Use ... && fail instead of ! ...Tavian Barnes2023-10-232-5/+4
| | | | ! false doesn't trigger an error with set -e.
* tests/bfs/printf_color: Fix race conditionTavian Barnes2023-10-232-1/+2
| | | | | Invoking bfs in the top directory can lead it to explore other tests' scratch directories, so explicitly exclude them.
* tests: Document -jTavian Barnes2023-10-231-21/+20
|
* tests: Clean up verbose logging a bitTavian Barnes2023-10-231-20/+36
|
* tests: Fix Bash 3 compatibilityTavian Barnes2023-10-237-37/+47
|
* tests: Run test cases in parallelTavian Barnes2023-10-232-15/+58
|
* tests: Use test-specific scratch directoriesTavian Barnes2023-10-2277-368/+330
|
* tests: Fix column detection with redirected stderrTavian Barnes2023-10-201-1/+1
|
* tests/color: Remove some useless catsTavian Barnes2023-10-204-53/+50
|
* tests: Use xtouch to create the whole deep tree at onceTavian Barnes2023-10-201-15/+6
|