diff options
Diffstat (limited to 'libgo/go/syscall/syscall_test.go')
-rw-r--r-- | libgo/go/syscall/syscall_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libgo/go/syscall/syscall_test.go b/libgo/go/syscall/syscall_test.go index 846c4873d2..c3fffda2df 100644 --- a/libgo/go/syscall/syscall_test.go +++ b/libgo/go/syscall/syscall_test.go @@ -6,6 +6,9 @@ package syscall_test import ( "fmt" + "internal/testenv" + "os" + "runtime" "syscall" "testing" ) @@ -45,3 +48,28 @@ func TestItoa(t *testing.T) { t.Fatalf("itoa(%d) = %s, want %s", i, s, f) } } + +// Check that permuting child process fds doesn't interfere with +// reporting of fork/exec status. See Issue 14979. +func TestExecErrPermutedFds(t *testing.T) { + testenv.MustHaveExec(t) + + attr := &os.ProcAttr{Files: []*os.File{os.Stdin, os.Stderr, os.Stdout}} + _, err := os.StartProcess("/", []string{"/"}, attr) + if err == nil { + t.Fatalf("StartProcess of invalid program returned err = nil") + } +} + +func TestGettimeofday(t *testing.T) { + if runtime.GOOS == "nacl" { + t.Skip("not implemented on nacl") + } + tv := &syscall.Timeval{} + if err := syscall.Gettimeofday(tv); err != nil { + t.Fatal(err) + } + if tv.Sec == 0 && tv.Usec == 0 { + t.Fatal("Sec and Usec both zero") + } +} |