diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2022-12-13 15:44:17 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2022-12-13 15:44:17 -0500 |
commit | f3ba6a3e40d72e00d13e943d9338b60b4bee2e40 (patch) | |
tree | a898a272dfa433701e6836a4793351566b42d39c /tests/posix/readdir_error.sh | |
parent | 7f303bec64c7a300f0f38e9938a8327cac9591e0 (diff) | |
download | bfs-f3ba6a3e40d72e00d13e943d9338b60b4bee2e40.tar.xz |
tests: Add a test for readdir() errors
Diffstat (limited to 'tests/posix/readdir_error.sh')
-rw-r--r-- | tests/posix/readdir_error.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/posix/readdir_error.sh b/tests/posix/readdir_error.sh new file mode 100644 index 0000000..cca71f0 --- /dev/null +++ b/tests/posix/readdir_error.sh @@ -0,0 +1,21 @@ +clean_scratch +mkfifo scratch/{pid,hup} + +( + # Create a zombie process + echo >/dev/null & + # Write the PID to scratch/pid + echo $! >scratch/pid + # Don't wait on the processes + exec cat scratch/hup >/dev/null +) & + +# Kill cat on exit +trap "echo >scratch/hup" EXIT + +# Read the zombie PID +read -r pid <scratch/pid + +# On Linux, open(/proc/$pid/net) will succeed but readdir() will fail +skip_unless test -r "/proc/$pid/net" +fail invoke_bfs "/proc/$pid/net" >/dev/null |