From: Bryan C. Mills Date: Tue, 10 Jan 2023 20:59:12 +0000 (-0500) Subject: cmd/go: shorten TestScript/test_shuffle and skip it in short mode X-Git-Tag: go1.21rc1~1887 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c16c2c49e2fa98ae551fc6335215fadd62d33542;p=gostls13.git cmd/go: shorten TestScript/test_shuffle and skip it in short mode 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 Auto-Submit: Bryan Mills Run-TryBot: Bryan Mills Reviewed-by: Damien Neil --- diff --git a/src/cmd/go/testdata/script/test_shuffle.txt b/src/cmd/go/testdata/script/test_shuffle.txt index 3a50605c34..98029f552d 100644 --- a/src/cmd/go/testdata/script/test_shuffle.txt +++ b/src/cmd/go/testdata/script/test_shuffle.txt @@ -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'