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
&& 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