]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
check: really improve test list randomization
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 20 Mar 2019 00:44:49 +0000 (17:44 -0700)
committerEryu Guan <guaneryu@gmail.com>
Sat, 23 Mar 2019 13:27:12 +0000 (21:27 +0800)
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@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
check

diff --git a/check b/check
index ecd1d39ab0c8c759b51d7dc456d7143a65758506..a2c5ba215d077e4b6378d28f2cea8c74706bbfe1 100755 (executable)
--- 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