]> Cypherpunks repositories - gostls13.git/commitdiff
os: use /tmp again
authorRuss Cox <rsc@golang.org>
Thu, 15 Jul 2010 00:25:46 +0000 (17:25 -0700)
committerRuss Cox <rsc@golang.org>
Thu, 15 Jul 2010 00:25:46 +0000 (17:25 -0700)
R=adg
CC=golang-dev
https://golang.org/cl/1823041

src/pkg/os/os_test.go

index 65a99355ff12aaf45a936a085cbb416c9dce367c..9b206d0c6f56d2388ac69eb313d2e0f132b6a529 100644 (file)
@@ -11,6 +11,7 @@ import (
        "io/ioutil"
        . "os"
        "strings"
+       "syscall"
        "testing"
 )
 
@@ -56,7 +57,13 @@ func size(name string, t *testing.T) int64 {
 
 func newFile(testName string, t *testing.T) (f *File) {
        // Use a local file system, not NFS.
-       f, err := ioutil.TempFile("", "_Go_"+testName)
+       // On Unix, override $TMPDIR in case the user
+       // has it set to an NFS-mounted directory.
+       dir := ""
+       if syscall.OS != "windows" {
+               dir = "/tmp"
+       }
+       f, err := ioutil.TempFile(dir, "_Go_"+testName)
        if err != nil {
                t.Fatalf("open %s: %s", testName, err)
        }