summaryrefslogtreecommitdiff
path: root/tests/misc/sort-merge-fdlimit
diff options
context:
space:
mode:
authorPaul R. Eggert <eggert@cs.ucla.edu>2010-07-16 11:27:42 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2010-07-23 23:44:25 -0700
commit9a3c600f11b254bc601a96ee607129cba69c8029 (patch)
tree057c28e687d275b4ca0f7ded1566315e541d9070 /tests/misc/sort-merge-fdlimit
parentdf906d2e75d6822c88999b8cc537166371f2da6e (diff)
downloadcoreutils-9a3c600f11b254bc601a96ee607129cba69c8029.tar.xz
tests/misc/sort-merge-fdlimit: don't assume -R opens /dev/urandom
* tests/misc/sort-merge-fdlimit: This test was written assuming that -R typically opens /dev/urandom, but that's no longer the case. Redo test to specify a random source; this resurrects the point of checking for file descriptor exhaustion. Also try plain -R, since that implementation may change in the future too.
Diffstat (limited to 'tests/misc/sort-merge-fdlimit')
-rwxr-xr-xtests/misc/sort-merge-fdlimit14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/misc/sort-merge-fdlimit b/tests/misc/sort-merge-fdlimit
index d1736f50c..56b851811 100755
--- a/tests/misc/sort-merge-fdlimit
+++ b/tests/misc/sort-merge-fdlimit
@@ -31,6 +31,7 @@ mkdir in err || framework_failure
for i in `seq 17`; do
echo $i >in/$i
done
+seq 17 >some-data
# When these tests are run inside the automated testing framework, they
# have one less available file descriptor than when run outside the
@@ -43,11 +44,14 @@ done
&& sort -m --batch-size=16 in/* 2>err/merge-default-err \
|| ! grep "open failed" err/merge-default-err) || fail=1
-# If sort opens a file (/dev/urandom) to sort by random hashes of keys,
+# If sort opens a file to sort by random hashes of keys,
# it needs to consider this file against its limit on open file
-# descriptors.
-(ulimit -n 20 \
- && sort -mR --batch-size=16 in/* 2>err/merge-random-err \
- || ! grep "open failed" err/merge-random-err) || fail=1
+# descriptors. Test once with the default random source
+# and once with an explicit source.
+for randsource in '' --random-source=some-data; do
+ (ulimit -n 20 \
+ && sort -mR $randsource --batch-size=16 in/* 2>err/merge-random-err \
+ || ! grep "open failed" err/merge-random-err) || fail=1
+done
Exit $fail