[PATCH 02/12] check: really improve test list randomization

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

coreutils provides the shuf(1) utility that randomizes the order of a
list and seeds its random number generator with /dev/urandom.  It's a
bit speedier than awk, so use it if available.

Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
 check |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)


diff --git a/check b/check
index ecd1d39a..a2c5ba21 100755
--- a/check
+++ b/check
@@ -243,7 +243,11 @@ _prepare_test_list()
 
 	# sort the list of tests into numeric order
 	if $randomize; then
-		sorter="awk -v seed=$RANDOM -f randomize.awk"
+		if type shuf >& /dev/null; then
+			sorter="shuf"
+		else
+			sorter="awk -v seed=$RANDOM -f randomize.awk"
+		fi
 	else
 		sorter="cat"
 	fi




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux