]> Cypherpunks.ru repositories - gostls13.git/commit
testing: add -shuffle=off|on|N to alter the execution order of tests and benchmarks
authorPaschalis Tsilias <paschalis.tsilias@gmail.com>
Wed, 14 Apr 2021 20:55:38 +0000 (23:55 +0300)
committerIan Lance Taylor <iant@golang.org>
Wed, 28 Apr 2021 16:06:21 +0000 (16:06 +0000)
commitcbb3f090477de92a7e158050803ef71a5ea825ee
treef8cb18236c1fb9ca9d19db1c2586086516b8a9b8
parente51246c8819f16cd78d3da01162ca14b432d30bc
testing: add -shuffle=off|on|N to alter the execution order of tests and benchmarks

This CL adds a new flag to the testing package and the go test command
which randomizes the execution order for tests and benchmarks.
This can be useful for identifying unwanted dependencies
between test or benchmark functions.
The flag is off by default. If `-shuffle` is set to `on` then the system
clock will be used as the seed value. If `-shuffle` is set to an integer
N, then N will be used as the seed value. In both cases, the seed will
be reported for failed runs so that they can reproduced later on.

Fixes #28592

Change-Id: I62e7dfae5f63f97a0cbd7830ea844d9f7beac335
Reviewed-on: https://go-review.googlesource.com/c/go/+/310033
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Bryan C. Mills <bcmills@google.com>
src/cmd/go/alldocs.go
src/cmd/go/internal/test/flagdefs.go
src/cmd/go/internal/test/test.go
src/cmd/go/internal/test/testflag.go
src/cmd/go/testdata/script/test_shuffle.txt [new file with mode: 0644]
src/go/build/deps_test.go
src/math/rand/export_test.go [new file with mode: 0644]
src/math/rand/race_test.go
src/math/rand/rand_test.go
src/testing/testing.go