diff --git a/internal/testenv/testenv.go b/internal/testenv/testenv.go index b036aa6..5cb1327 100644 --- a/internal/testenv/testenv.go +++ b/internal/testenv/testenv.go @@ -13,6 +13,7 @@ package testenv import ( "errors" "flag" + "fmt" "internal/cfg" "os" "os/exec" @@ -32,6 +33,14 @@ func Builder() string { return os.Getenv("GO_BUILDER_NAME") } +func MainMust(cond func() bool) { + if !cond() { + fmt.Println("testenv: warning: can't run any tests") + fmt.Println("SKIP") + os.Exit(0) + } +} + // HasGoBuild reports whether the current system can build programs with ``go build'' // and then run them with os.StartProcess or exec.Command. func HasGoBuild() bool {