From c16c2c49e2fa98ae551fc6335215fadd62d33542 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Tue, 10 Jan 2023 15:59:12 -0500 Subject: [PATCH] cmd/go: shorten TestScript/test_shuffle and skip it in short mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/cmd/go/testdata/script/test_shuffle.txt | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) 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' -- 2.50.0