aboutsummaryrefslogtreecommitdiff
path: root/src/os/exec
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2015-06-05 11:01:53 -0400
committerRuss Cox <rsc@golang.org>2015-06-16 18:07:36 +0000
commit7bc3e5880675ce4aae245f46d193924cff5efdfb (patch)
treebc5991015f83aa4852edaf31b096fc968c3f6369 /src/os/exec
parent047f07a285edbc60f64018973be7ce6b341fe22d (diff)
downloadgo-7bc3e5880675ce4aae245f46d193924cff5efdfb.tar.xz
all: extract "can I exec?" check from tests into internal/testenv
Change-Id: I7b54be9d8b50b39e01c6be21f310ae9a10404e9d Reviewed-on: https://go-review.googlesource.com/10753 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/os/exec')
-rw-r--r--src/os/exec/exec_test.go21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/os/exec/exec_test.go b/src/os/exec/exec_test.go
index db84eabf26..3773963cb0 100644
--- a/src/os/exec/exec_test.go
+++ b/src/os/exec/exec_test.go
@@ -11,6 +11,7 @@ import (
"bufio"
"bytes"
"fmt"
+ "internal/testenv"
"io"
"io/ioutil"
"log"
@@ -27,13 +28,9 @@ import (
"time"
)
-// iOS cannot fork
-var iOS = runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64")
-
func helperCommand(t *testing.T, s ...string) *exec.Cmd {
- if runtime.GOOS == "nacl" || iOS {
- t.Skipf("skipping on %s/%s, cannot fork", runtime.GOOS, runtime.GOARCH)
- }
+ testenv.MustHaveExec(t)
+
cs := []string{"-test.run=TestHelperProcess", "--"}
cs = append(cs, s...)
cmd := exec.Command(os.Args[0], cs...)
@@ -52,9 +49,7 @@ func TestEcho(t *testing.T) {
}
func TestCommandRelativeName(t *testing.T) {
- if iOS {
- t.Skip("skipping on darwin/%s, cannot fork", runtime.GOARCH)
- }
+ testenv.MustHaveExec(t)
// Run our own binary as a relative path
// (e.g. "_test/exec.test") our parent directory.
@@ -427,13 +422,11 @@ func TestExtraFilesFDShuffle(t *testing.T) {
}
func TestExtraFiles(t *testing.T) {
- switch runtime.GOOS {
- case "nacl", "windows":
+ testenv.MustHaveExec(t)
+
+ if runtime.GOOS == "windows" {
t.Skipf("skipping test on %q", runtime.GOOS)
}
- if iOS {
- t.Skipf("skipping test on %s/%s, cannot fork", runtime.GOOS, runtime.GOARCH)
- }
// Ensure that file descriptors have not already been leaked into
// our environment.