1 // Copyright 2015 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // +build darwin dragonfly freebsd linux netbsd openbsd solaris
15 func TestGoBuildUmask(t
*testing
.T
) {
16 // Do not use tg.parallel; avoid other tests seeing umask manipulation.
17 mask
:= syscall
.Umask(0077) // prohibit low bits
18 defer syscall
.Umask(mask
)
21 tg
.tempFile("x.go", `package main; func main() {}`)
22 // Make sure artifact will be output to /tmp/... in case the user
23 // has POSIX acl's on their go source tree.
27 tg
.run("build", "-o", exe
, tg
.path("x.go"))
28 fi
, err
:= os
.Stat(exe
)
32 if mode
:= fi
.Mode(); mode
&0077 != 0 {
33 t
.Fatalf("wrote x with mode=%v, wanted no 0077 bits", mode
)