From 7294469a7f5059e15a532bf3d0e34c6d13697d04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Thu, 1 Apr 2021 15:21:07 +0100 Subject: [PATCH] testdata: reduce the cost of short tests Reduces "go test -short" with a warm build cache from ~9s to ~4s. The main offender was the use of "-a" in the "garble test" call; I think I added that flag to rebuild all packages when debugging an error, and forgot to remove it. --- testdata/scripts/basic.txt | 2 +- testdata/scripts/reverse.txt | 2 ++ testdata/scripts/test.txt | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/testdata/scripts/basic.txt b/testdata/scripts/basic.txt index 78539e7..7df231e 100644 --- a/testdata/scripts/basic.txt +++ b/testdata/scripts/basic.txt @@ -28,7 +28,7 @@ stdout 'unknown' [short] stop # checking that the build is reproducible is slow # Check that we fail if the user used "go build -toolexec garble" instead of "garble build" -! go build -a -toolexec=garble main.go +! go build -toolexec=garble main.go stderr 'not running "garble \[command\]"' # Also check that the binary is reproducible. diff --git a/testdata/scripts/reverse.txt b/testdata/scripts/reverse.txt index 5471412..856ffc4 100644 --- a/testdata/scripts/reverse.txt +++ b/testdata/scripts/reverse.txt @@ -18,6 +18,8 @@ stdin main.stderr garble reverse cmp stdout reverse.stdout +[short] stop # no need to verify this with -short + # Ensure that the reversed output matches the non-garbled output. go build -trimpath exec ./main diff --git a/testdata/scripts/test.txt b/testdata/scripts/test.txt index db834a7..0e3e08e 100644 --- a/testdata/scripts/test.txt +++ b/testdata/scripts/test.txt @@ -1,5 +1,5 @@ # build the test binary -garble test -c -a +garble test -c ! stdout 'PASS' binsubstr bar.test$exe 'TestFoo' 'TestSeparateFoo' ! binsubstr bar.test$exe 'LocalFoo|ImportedVar|OriginalFuncName'