aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/testdata/testprogcgo/exec.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2018-09-18 07:58:11 -0700
committerIan Lance Taylor <iant@golang.org>2018-09-18 15:16:14 +0000
commit19ac6a82d3be818572881d60026109946a5a69e6 (patch)
tree41a8f20fb766ed4e3b92bbb42e9eedbaeca224f4 /src/runtime/testdata/testprogcgo/exec.go
parent014901c5bab2f99af3b1019d5776fa5da6f5bef7 (diff)
downloadgo-19ac6a82d3be818572881d60026109946a5a69e6.tar.xz
runtime: ignore EAGAIN from exec in TestCgoExecSignalMask
Fixes #27731 Change-Id: Ifb4d57923b1bba0210ec1f623d779d7b5f442812 Reviewed-on: https://go-review.googlesource.com/135995 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Munday <mike.munday@ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/testdata/testprogcgo/exec.go')
-rw-r--r--src/runtime/testdata/testprogcgo/exec.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/runtime/testdata/testprogcgo/exec.go b/src/runtime/testdata/testprogcgo/exec.go
index 2e948401c8..94da5dc526 100644
--- a/src/runtime/testdata/testprogcgo/exec.go
+++ b/src/runtime/testdata/testprogcgo/exec.go
@@ -75,6 +75,14 @@ func CgoExecSignalMask() {
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
+ // An overloaded system
+ // may fail with EAGAIN.
+ // This doesn't tell us
+ // anything useful; ignore it.
+ // Issue #27731.
+ if isEAGAIN(err) {
+ return
+ }
fmt.Printf("iteration %d: %v\n", j, err)
os.Exit(1)
}
@@ -87,3 +95,11 @@ func CgoExecSignalMask() {
fmt.Println("OK")
}
+
+// isEAGAIN reports whether err is an EAGAIN error from a process execution.
+func isEAGAIN(err error) bool {
+ if p, ok := err.(*os.PathError); ok {
+ err = p.Err
+ }
+ return err == syscall.EAGAIN
+}