diff options
Diffstat (limited to 'compiler_wrapper/compile_with_fallback_test.go')
-rw-r--r-- | compiler_wrapper/compile_with_fallback_test.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/compiler_wrapper/compile_with_fallback_test.go b/compiler_wrapper/compile_with_fallback_test.go index 4ea847f6..a67f3eb9 100644 --- a/compiler_wrapper/compile_with_fallback_test.go +++ b/compiler_wrapper/compile_with_fallback_test.go @@ -12,9 +12,18 @@ import ( "os" "path/filepath" "strings" + "syscall" "testing" ) +// Save this off before goroutines start running, since this necessarily involves modifying the +// value for our umask, and that screams subtle race conditions. :) +var umaskAtStartup = func() os.FileMode { + umask := syscall.Umask(0) + syscall.Umask(umask) + return os.FileMode(umask) +}() + func TestOmitFallbackCompileForSuccessfulCall(t *testing.T) { withCompileWithFallbackTestContext(t, func(ctx *testContext) { ctx.must(callCompiler(ctx, ctx.cfg, ctx.newCommand(clangAndroid, mainCc))) @@ -229,7 +238,7 @@ func TestCompileWithFallbackLogCommandAndErrors(t *testing.T) { log := readCompileWithFallbackErrorLog(ctx) if log != `==================COMMAND:==================== -clang.real main.cc -fno-color-diagnostics -a -b +./clang.real main.cc -fno-color-diagnostics -a -b someerror ============================================== @@ -239,7 +248,7 @@ someerror } entry, _ := os.Lstat(filepath.Join(ctx.tempDir, "fallback_stderr")) - if entry.Mode()&0777 != 0644 { + if entry.Mode()&0777 != 0644 & ^umaskAtStartup { t.Errorf("unexpected mode for logfile. Got: %#o", entry.Mode()) } }) |