diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2021-06-21 15:08:08 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2021-06-21 15:08:08 +0000 |
commit | 4c3de78dab9c67d41c0f2ba73cb4868885cd7ea1 (patch) | |
tree | 73936aba47fe1dc71e9cc05af9747036e935608c /compiler_wrapper/compile_with_fallback_test.go | |
parent | b75f321fc8978b92ce3db6886ccb966768f0c7a8 (diff) | |
parent | 4e4201457e5f51a132101c611c79ccff9f713c8b (diff) | |
download | toolchain-utils-4c3de78dab9c67d41c0f2ba73cb4868885cd7ea1.tar.gz |
Snap for 7478067 from 4e4201457e5f51a132101c611c79ccff9f713c8b to mainline-ipsec-releaseandroid-mainline-12.0.0_r88android-mainline-12.0.0_r73android-mainline-12.0.0_r61android-mainline-12.0.0_r45android-mainline-12.0.0_r28android-mainline-12.0.0_r118android-mainline-12.0.0_r103android-mainline-12.0.0_r10android12-mainline-ipsec-release
Change-Id: I1a48a66c54fe2d52748d1edcc260236dda4f655e
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()) } }) |