diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2019-03-19 17:44:42 -0700 |
---|---|---|
committer | Eryu Guan <guaneryu@gmail.com> | 2019-03-23 21:27:12 +0800 |
commit | 07094a9652c0ce002138fef69a0d8c973e539bde (patch) | |
tree | ac8af4cead0040e9650cc305cdb45711ccc9ec59 /check | |
parent | 2caa208e3ab52474dabb5b7b78f802330a17be89 (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-x | check | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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. |