]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/vet: use testenv
authorDavid Crawshaw <crawshaw@golang.org>
Wed, 4 Nov 2015 15:41:05 +0000 (10:41 -0500)
committerDavid Crawshaw <crawshaw@golang.org>
Wed, 4 Nov 2015 15:59:10 +0000 (15:59 +0000)
Fix for iOS builder.

Change-Id: I5b6c977b187446c848182a9294d5bed6b5f9f6e4
Reviewed-on: https://go-review.googlesource.com/16633
Run-TryBot: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
src/cmd/vet/vet_test.go

index ea402ff9b2850a5a0c4b755030abba8f20462360..c1026a3fa165a70cf06e15f009e8972b578e23a6 100644 (file)
@@ -2,16 +2,13 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// No testdata on Android.
-
-// +build !android
-
 package main_test
 
 import (
        "bytes"
        "flag"
        "fmt"
+       "internal/testenv"
        "os"
        "os/exec"
        "path/filepath"
@@ -32,16 +29,11 @@ func TestMain(m *testing.M) {
        os.Exit(result)
 }
 
-func CanRun() bool {
+func MustHavePerl(t *testing.T) {
        switch runtime.GOOS {
        case "plan9", "windows":
-               // No Perl installed, can't run errcheck.
-               return false
-       case "nacl":
-               // Minimal and problematic file system.
-               return false
+               t.Skipf("skipping test: perl not available on %s", runtime.GOOS)
        }
-       return true
 }
 
 var (
@@ -53,9 +45,10 @@ func Build(t *testing.T) {
        if built {
                return
        }
-       if !CanRun() || failed {
+       testenv.MustHaveGoBuild(t)
+       MustHavePerl(t)
+       if failed {
                t.Skip("cannot run on this environment")
-               return
        }
        cmd := exec.Command("go", "build", "-o", binary)
        output, err := cmd.CombinedOutput()