Commit 95919328 authored by Russ Cox's avatar Russ Cox

cmd/vet: skip exec tests on systems that can't exec

Change-Id: I09257b8f5482cba10b5f4d3813c778d6e9e74d40
Reviewed-on: https://go-review.googlesource.com/10752Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
parent 3e2fc94f
...@@ -10,6 +10,7 @@ import ( ...@@ -10,6 +10,7 @@ import (
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"runtime" "runtime"
"strings"
"testing" "testing"
) )
...@@ -24,10 +25,16 @@ const ( ...@@ -24,10 +25,16 @@ const (
// rm testvet // rm testvet
// //
func TestVet(t *testing.T) { func TestVet(t *testing.T) {
// Plan 9 and Windows systems can't be guaranteed to have Perl and so can't run errchk.
switch runtime.GOOS { switch runtime.GOOS {
case "plan9", "windows": case "plan9", "windows":
// Plan 9 and Windows systems can't be guaranteed to have Perl and so can't run errchk.
t.Skip("skipping test; no Perl on %q", runtime.GOOS) t.Skip("skipping test; no Perl on %q", runtime.GOOS)
case "nacl":
t.Skip("skipping test; no command execution on nacl")
case "darwin":
if strings.HasPrefix(runtime.GOARCH, "arm") {
t.Skip("skipping test; no command execution on darwin/%s", runtime.GOARCH)
}
} }
// go build // go build
...@@ -75,6 +82,15 @@ func run(c *exec.Cmd, t *testing.T) bool { ...@@ -75,6 +82,15 @@ func run(c *exec.Cmd, t *testing.T) bool {
// TestTags verifies that the -tags argument controls which files to check. // TestTags verifies that the -tags argument controls which files to check.
func TestTags(t *testing.T) { func TestTags(t *testing.T) {
switch runtime.GOOS {
case "nacl":
t.Skip("skipping test; no command execution on nacl")
case "darwin":
if strings.HasPrefix(runtime.GOARCH, "arm") {
t.Skip("skipping test; no command execution on darwin/%s", runtime.GOARCH)
}
}
// go build // go build
cmd := exec.Command("go", "build", "-o", binary) cmd := exec.Command("go", "build", "-o", binary)
run(cmd, t) run(cmd, t)
......
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