]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: shuf: ensure we handle unsupported getrandom syscall gracefully
authoroech3 <79379754+oech3@users.noreply.github.com>
Fri, 27 Feb 2026 22:15:48 +0000 (07:15 +0900)
committerPádraig Brady <P@draigBrady.com>
Sat, 28 Feb 2026 12:16:25 +0000 (12:16 +0000)
* tests/shuf/shuf.sh: Check we fail normally or succeed where
the getrandom syscall is not available.
https://github.com/coreutils/coreutils/pull/205

tests/shuf/shuf.sh

index 662d1a5f2addbf34a4cde8abca495cc06571dd77..6a1833b1f55c2ad9c2c402156d92b60790b565ec 100755 (executable)
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ shuf
 getlimits_
+uses_strace_
+
+# Ensure we handle unsupported getrandom syscall gracefully
+strace -o /dev/null -e inject=getrandom:error=ENOSYS shuf -i 1-9
+ret=$?
+test $? = 0 || test $? = 1 || fail=1
 
 # ensure randomization doesn't depend solely on ASLR
 # This is a probabilistic test :-)