diff options
Diffstat (limited to 'tests/misc/shuf')
-rwxr-xr-x | tests/misc/shuf | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/misc/shuf b/tests/misc/shuf index cdfe7052b..10d285846 100755 --- a/tests/misc/shuf +++ b/tests/misc/shuf @@ -18,6 +18,7 @@ . "${srcdir=.}/init.sh"; path_prepend_ ../src print_ver_ shuf +getlimits_ seq 100 > in || framework_failure @@ -51,4 +52,9 @@ shuf --zero-terminated -i 1-1 > out || fail=1 printf '1\0' > exp || framework_failure cmp out exp || { fail=1; echo "missing NUL terminator?" 1>&2; } +# Ensure shuf -n operates efficiently for small n. Before coreutils-8.13 +# this would try to allocate $SIZE_MAX * sizeof(size_t) +timeout 10 shuf -i1-$SIZE_MAX -n2 >/dev/null || + { fail=1; echo "couldn't get a small subset" >&2; } + Exit $fail |