aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/rusage_flag.go
diff options
context:
space:
mode:
authorGeorge Burgess IV <gbiv@google.com>2021-06-11 11:35:21 -0700
committerGeorge Burgess <gbiv@chromium.org>2021-06-18 19:23:47 +0000
commitbe8490a664854cf8ce7b2960f0be19f6f8838f91 (patch)
tree4a6c3dbafbd30f1f1ed5a5441f342b4cb0db19f3 /compiler_wrapper/rusage_flag.go
parent24accd96f5dbb5c793cfac8f41b275848c261950 (diff)
downloadtoolchain-utils-be8490a664854cf8ce7b2960f0be19f6f8838f91.tar.gz
compiler_wrapper: fix flaky tests
We're running many tests in parallel that have dependencies on the `umask` global. We shouldn't be running these in parallel with each other, since they may read values for this that're set by other goroutines. Since these are difficult to spot, this CL does two things: - Requiring that all tests mark themselves as either readers of or writers to umask. Any test that does this gets run in serial with other tests that do it. - Requires code that modifies/reads the umask to go through `env.umask`, rather than `syscall.Umask`. This allows us to cheaply and accurately verify that a test's dependency on the process' umask was stated. BUG=b:186801841 TEST=`go test -count=100` passed Change-Id: Ifa871cfa48c005646499b21c1bfa1a4799ca641b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2956692 Reviewed-by: Ryan Beltran <ryanbeltran@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'compiler_wrapper/rusage_flag.go')
-rw-r--r--compiler_wrapper/rusage_flag.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler_wrapper/rusage_flag.go b/compiler_wrapper/rusage_flag.go
index 4aa40b4d..63469602 100644
--- a/compiler_wrapper/rusage_flag.go
+++ b/compiler_wrapper/rusage_flag.go
@@ -101,8 +101,8 @@ func maybeCaptureRusage(env env, compilerCmd *command, action func(willLogRusage
// We need to temporarily set umask to 0 to ensure 777 permissions are actually 777
// This effects builderbots in particular
- oldMask := syscall.Umask(0)
- defer syscall.Umask(oldMask)
+ oldMask := env.umask(0)
+ defer env.umask(oldMask)
// We want to know what package is being compiled. The working directory gives us a good clue.
cwd, err := os.Getwd()