Skip to content

Commit 12e1fcd

Browse files
dmitshurgopherbot
authored andcommitted
internal/wycheproof: skip all tests in short test mode
The testdata for this package is around 8 MB and downloaded dynamically via 'go mod download' from its canonical source rather than being copied to this repository. We're moving towards disallowing all network use in short test mode, including proxy.golang.org, so add a corresponding test skip. Needing to lookup a go test flag is unfortunate, but I don't know of a less bad available option while the test does the download in TestMain. On balance, it becomes viable to no longer disable the checksum database since the test will only run on builders that permit internet use and so sum.golang.org should just work. Change-Id: Iaffe3899351da375928aaba114c4875f5438336b Reviewed-on: https://go-review.googlesource.com/c/crypto/+/510695 Run-TryBot: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
1 parent 3f8f064 commit 12e1fcd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

internal/wycheproof/wycheproof_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"crypto/x509"
1212
"encoding/hex"
1313
"encoding/json"
14+
"flag"
1415
"fmt"
1516
"log"
1617
"os"
@@ -28,6 +29,11 @@ const wycheproofModVer = "v0.0.0-20191219022705-2196000605e4"
2829
var wycheproofTestVectorsDir string
2930

3031
func TestMain(m *testing.M) {
32+
flag.Parse()
33+
if flag.Lookup("test.short").Value.(flag.Getter).Get().(bool) {
34+
log.Println("skipping test that downloads testdata via 'go mod download' in short mode")
35+
os.Exit(0)
36+
}
3137
if _, err := exec.LookPath("go"); err != nil {
3238
log.Printf("skipping test because 'go' command is unavailable: %v", err)
3339
os.Exit(0)
@@ -42,8 +48,6 @@ func TestMain(m *testing.M) {
4248
// can be used in the following tests.
4349
path := "github.com/google/wycheproof@" + wycheproofModVer
4450
cmd := exec.Command("go", "mod", "download", "-json", path)
45-
// TODO: enable the sumdb once the Trybots proxy supports it.
46-
cmd.Env = append(os.Environ(), "GONOSUMDB=*")
4751
output, err := cmd.Output()
4852
if err != nil {
4953
log.Fatalf("failed to run `go mod download -json %s`, output: %s", path, output)

0 commit comments

Comments
 (0)