Commit dc9ad586 authored by David Crawshaw's avatar David Crawshaw

cmd/vet: use testenv

Fix for iOS builder.

Change-Id: I5b6c977b187446c848182a9294d5bed6b5f9f6e4
Reviewed-on: https://go-review.googlesource.com/16633
Run-TryBot: David Crawshaw <crawshaw@golang.org>
Reviewed-by: default avatarHyang-Ah Hana Kim <hyangah@gmail.com>
parent 8c827c04
...@@ -2,16 +2,13 @@ ...@@ -2,16 +2,13 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// No testdata on Android.
// +build !android
package main_test package main_test
import ( import (
"bytes" "bytes"
"flag" "flag"
"fmt" "fmt"
"internal/testenv"
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
...@@ -32,16 +29,11 @@ func TestMain(m *testing.M) { ...@@ -32,16 +29,11 @@ func TestMain(m *testing.M) {
os.Exit(result) os.Exit(result)
} }
func CanRun() bool { func MustHavePerl(t *testing.T) {
switch runtime.GOOS { switch runtime.GOOS {
case "plan9", "windows": case "plan9", "windows":
// No Perl installed, can't run errcheck. t.Skipf("skipping test: perl not available on %s", runtime.GOOS)
return false
case "nacl":
// Minimal and problematic file system.
return false
} }
return true
} }
var ( var (
...@@ -53,9 +45,10 @@ func Build(t *testing.T) { ...@@ -53,9 +45,10 @@ func Build(t *testing.T) {
if built { if built {
return return
} }
if !CanRun() || failed { testenv.MustHaveGoBuild(t)
MustHavePerl(t)
if failed {
t.Skip("cannot run on this environment") t.Skip("cannot run on this environment")
return
} }
cmd := exec.Command("go", "build", "-o", binary) cmd := exec.Command("go", "build", "-o", binary)
output, err := cmd.CombinedOutput() output, err := cmd.CombinedOutput()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment