]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: shorten TestScript/test_shuffle and skip it in short mode
authorBryan C. Mills <bcmills@google.com>
Tue, 10 Jan 2023 20:59:12 +0000 (15:59 -0500)
committerGopher Robot <gobot@golang.org>
Thu, 19 Jan 2023 20:46:11 +0000 (20:46 +0000)
test_shuffle was added in CL 310033. It takes about 4½ seconds on my
workstation prior to this CL, most of which is spent linking and
running test binaries in 'go test'.

We can reduce that time somewhat (to 3¾ seconds) by simply running the
test fewer times (cases of 'off', 'on', positive, zero, and negative
values seem sufficient), but we should also avoid that linking
overhead at all in short mode.

Fixes #57709.

Change-Id: I908a70435ccfb1ca16ed23aec17512bf2b267b21
Reviewed-on: https://go-review.googlesource.com/c/go/+/461455
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
src/cmd/go/testdata/script/test_shuffle.txt

index 3a50605c3444923b425a7a208bbe81e4975da250..98029f552d4c888e1b330130bf60e4c27143a697 100644 (file)
@@ -1,5 +1,7 @@
 # Shuffle order of tests and benchmarks
 
+[short] skip 'builds and repeatedly runs a test binary'
+
 # Run tests
 go test -v foo_test.go
 ! stdout '-test.shuffle '
@@ -13,14 +15,6 @@ go test -v -shuffle=42 foo_test.go
 stdout '^-test.shuffle 42'
 stdout '(?s)TestThree(.*)TestOne(.*)TestTwo'
 
-go test -v -shuffle=43 foo_test.go
-stdout '^-test.shuffle 43'
-stdout '(?s)TestThree(.*)TestTwo(.*)TestOne'
-
-go test -v -shuffle=44 foo_test.go
-stdout '^-test.shuffle 44'
-stdout '(?s)TestOne(.*)TestThree(.*)TestTwo'
-
 go test -v -shuffle=0 foo_test.go
 stdout '^-test.shuffle 0'
 stdout '(?s)TestTwo(.*)TestOne(.*)TestThree'
@@ -49,14 +43,6 @@ go test -v -bench=. -shuffle=42 foo_test.go
 stdout '^-test.shuffle 42'
 stdout '(?s)TestThree(.*)TestOne(.*)TestTwo(.*)BenchmarkThree(.*)BenchmarkOne(.*)BenchmarkTwo'
 
-go test -v -bench=. -shuffle=43 foo_test.go
-stdout '^-test.shuffle 43'
-stdout '(?s)TestThree(.*)TestTwo(.*)TestOne(.*)BenchmarkThree(.*)BenchmarkOne(.*)BenchmarkTwo'
-
-go test -v -bench=. -shuffle=44 foo_test.go
-stdout '^-test.shuffle 44'
-stdout '(?s)TestOne(.*)TestThree(.*)TestTwo(.*)BenchmarkTwo(.*)BenchmarkOne(.*)BenchmarkThree'
-
 go test -v -bench=. -shuffle=0 foo_test.go
 stdout '^-test.shuffle 0'
 stdout '(?s)TestTwo(.*)TestOne(.*)TestThree(.*)BenchmarkThree(.*)BenchmarkOne(.*)BenchmarkTwo'