From 2fa7c464f019f67c5c0494aaf5ac0f5ecc1ee7a7 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Tue, 16 Jan 2018 12:03:31 -0500 Subject: Updated dependencies and added avct/uasurfer (#8089) * Updated dependencies and added avct/uasurfer * Added uasurfer to NOTICE.txt --- vendor/golang.org/x/sys/unix/syscall_unix_test.go | 48 +++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'vendor/golang.org/x/sys/unix/syscall_unix_test.go') diff --git a/vendor/golang.org/x/sys/unix/syscall_unix_test.go b/vendor/golang.org/x/sys/unix/syscall_unix_test.go index d0a09ce88..496e47135 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix_test.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix_test.go @@ -378,6 +378,54 @@ func TestPoll(t *testing.T) { } } +func TestGetwd(t *testing.T) { + fd, err := os.Open(".") + if err != nil { + t.Fatalf("Open .: %s", err) + } + defer fd.Close() + // These are chosen carefully not to be symlinks on a Mac + // (unlike, say, /var, /etc) + dirs := []string{"/", "/usr/bin"} + if runtime.GOOS == "darwin" { + switch runtime.GOARCH { + case "arm", "arm64": + d1, err := ioutil.TempDir("", "d1") + if err != nil { + t.Fatalf("TempDir: %v", err) + } + d2, err := ioutil.TempDir("", "d2") + if err != nil { + t.Fatalf("TempDir: %v", err) + } + dirs = []string{d1, d2} + } + } + oldwd := os.Getenv("PWD") + for _, d := range dirs { + err = os.Chdir(d) + if err != nil { + t.Fatalf("Chdir: %v", err) + } + pwd, err := unix.Getwd() + if err != nil { + t.Fatalf("Getwd in %s: %s", d, err) + } + os.Setenv("PWD", oldwd) + err = fd.Chdir() + if err != nil { + // We changed the current directory and cannot go back. + // Don't let the tests continue; they'll scribble + // all over some other directory. + fmt.Fprintf(os.Stderr, "fchdir back to dot failed: %s\n", err) + os.Exit(1) + } + if pwd != d { + t.Fatalf("Getwd returned %q want %q", pwd, d) + } + } +} + // mktmpfifo creates a temporary FIFO and provides a cleanup function. func mktmpfifo(t *testing.T) (*os.File, func()) { err := unix.Mkfifo("fifo", 0666) -- cgit v1.2.3-1-g7c22