summaryrefslogtreecommitdiff
path: root/check
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2019-03-19 17:44:42 -0700
committerEryu Guan <guaneryu@gmail.com>2019-03-23 21:27:12 +0800
commit07094a9652c0ce002138fef69a0d8c973e539bde (patch)
treeac8af4cead0040e9650cc305cdb45711ccc9ec59 /check
parent2caa208e3ab52474dabb5b7b78f802330a17be89 (diff)
check: improve test list randomization
awk doesn't have a particularly good random number generator -- it seeds from the Unix epoch time in seconds, which means that the run order across a bunch of VMs started at exactly the same time are unsettlingly predictable. Therefore, at least try to seed it with bash's $RANDOM, which is slightly less predictable. 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>
Diffstat (limited to 'check')
-rwxr-xr-xcheck12
1 files changed, 6 insertions, 6 deletions
diff --git a/check b/check
index 20e95302..ecd1d39a 100755
--- a/check
+++ b/check
@@ -242,13 +242,13 @@ _prepare_test_list()
done
# sort the list of tests into numeric order
- list=`sort -n $tmp.list | uniq`
- rm -f $tmp.list
-
- if $randomize
- then
- list=`echo $list | awk -f randomize.awk`
+ if $randomize; then
+ sorter="awk -v seed=$RANDOM -f randomize.awk"
+ else
+ sorter="cat"
fi
+ list=`sort -n $tmp.list | uniq | $sorter`
+ rm -f $tmp.list
}
# Process command arguments first.