aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/compile_with_fallback_test.go
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2021-06-21 15:08:08 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2021-06-21 15:08:08 +0000
commit4c3de78dab9c67d41c0f2ba73cb4868885cd7ea1 (patch)
tree73936aba47fe1dc71e9cc05af9747036e935608c /compiler_wrapper/compile_with_fallback_test.go
parentb75f321fc8978b92ce3db6886ccb966768f0c7a8 (diff)
parent4e4201457e5f51a132101c611c79ccff9f713c8b (diff)
downloadtoolchain-utils-4c3de78dab9c67d41c0f2ba73cb4868885cd7ea1.tar.gz
Change-Id: I1a48a66c54fe2d52748d1edcc260236dda4f655e
Diffstat (limited to 'compiler_wrapper/compile_with_fallback_test.go')
-rw-r--r--compiler_wrapper/compile_with_fallback_test.go13
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())
}
})