diff options
author | Ryan Beltran <ryanbeltran@chromium.org> | 2021-04-13 08:57:02 +0000 |
---|---|---|
committer | Ryan Beltran <ryanbeltran@chromium.org> | 2021-04-20 16:17:58 +0000 |
commit | 1f5fbfa3cc0abb67d84c0726a6506a8a8adcc86a (patch) | |
tree | 21bb29a11f1687f0e71aa551d14d2b2e6524fde9 | |
parent | 307e66c140ae48a79eafd3e66d8a37a8620f0b5f (diff) | |
download | toolchain-utils-1f5fbfa3cc0abb67d84c0726a6506a8a8adcc86a.tar.gz |
compiler_wrapper: remove useless gomaEnabled var
This CL addresses a comment on CL:2780051 which reenabled Goma with
Rusage. Since 2780051 there was an extraneous variable left over. This
also removes a now obsolete test.
BUG=None
TEST=Ran all package go tests
Change-Id: I784c1d93fc94333e098bf30a8777469379bfef71
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2823244
Reviewed-by: George Burgess <gbiv@chromium.org>
Reviewed-by: Denis Nikitin <denik@chromium.org>
Tested-by: Ryan Beltran <ryanbeltran@chromium.org>
-rw-r--r-- | compiler_wrapper/compiler_wrapper.go | 17 | ||||
-rw-r--r-- | compiler_wrapper/gomacc_flag.go | 4 | ||||
-rw-r--r-- | compiler_wrapper/gomacc_flag_test.go | 17 |
3 files changed, 10 insertions, 28 deletions
diff --git a/compiler_wrapper/compiler_wrapper.go b/compiler_wrapper/compiler_wrapper.go index d2b47691..8538fd49 100644 --- a/compiler_wrapper/compiler_wrapper.go +++ b/compiler_wrapper/compiler_wrapper.go @@ -80,7 +80,6 @@ func callCompilerInternal(env env, cfg *config, inputCmd *command) (exitCode int // Disable CCache for rusage logs // Note: Disabling Goma causes timeout related INFRA_FAILUREs in builders - allowGoma := true allowCCache := !rusageEnabled workAroundKernelBugWithRetries := false @@ -91,7 +90,7 @@ func callCompilerInternal(env env, cfg *config, inputCmd *command) (exitCode int mainBuilder.addPreUserArgs(mainBuilder.cfg.clangFlags...) mainBuilder.addPreUserArgs(mainBuilder.cfg.commonFlags...) mainBuilder.addPostUserArgs(mainBuilder.cfg.clangPostFlags...) - if _, err := processGomaCccFlags(allowGoma, mainBuilder); err != nil { + if _, err := processGomaCccFlags(mainBuilder); err != nil { return 0, err } compilerCmd = mainBuilder.build() @@ -127,14 +126,14 @@ func callCompilerInternal(env env, cfg *config, inputCmd *command) (exitCode int return 0, err } } - if err := processGomaCCacheFlags(allowGoma, allowCCache, mainBuilder); err != nil { + if err := processGomaCCacheFlags(allowCCache, mainBuilder); err != nil { return 0, err } compilerCmd = mainBuilder.build() } else { if clangSyntax { allowCCache = false - clangCmd, err := calcClangCommand(allowGoma, allowCCache, mainBuilder.clone()) + clangCmd, err := calcClangCommand(allowCCache, mainBuilder.clone()) if err != nil { return 0, err } @@ -267,12 +266,12 @@ func prepareClangCommand(builder *commandBuilder) (err error) { return processClangFlags(builder) } -func calcClangCommand(allowGoma bool, allowCCache bool, builder *commandBuilder) (*command, error) { +func calcClangCommand(allowCCache bool, builder *commandBuilder) (*command, error) { err := prepareClangCommand(builder) if err != nil { return nil, err } - if err := processGomaCCacheFlags(allowGoma, allowCCache, builder); err != nil { + if err := processGomaCCacheFlags(allowCCache, builder); err != nil { return nil, err } return builder.build(), nil @@ -286,7 +285,7 @@ func calcGccCommand(enableRusage bool, builder *commandBuilder) (*command, error calcCommonPreUserArgs(builder) processGccFlags(builder) if !builder.cfg.isHostWrapper { - if err := processGomaCCacheFlags(!enableRusage, !enableRusage, builder); err != nil { + if err := processGomaCCacheFlags(!enableRusage, builder); err != nil { return nil, err } } @@ -304,10 +303,10 @@ func calcCommonPreUserArgs(builder *commandBuilder) { processSanitizerFlags(builder) } -func processGomaCCacheFlags(allowGoma bool, allowCCache bool, builder *commandBuilder) (err error) { +func processGomaCCacheFlags(allowCCache bool, builder *commandBuilder) (err error) { gomaccUsed := false if !builder.cfg.isHostWrapper { - gomaccUsed, err = processGomaCccFlags(allowGoma, builder) + gomaccUsed, err = processGomaCccFlags(builder) if err != nil { return err } diff --git a/compiler_wrapper/gomacc_flag.go b/compiler_wrapper/gomacc_flag.go index 1305c60b..ac298b12 100644 --- a/compiler_wrapper/gomacc_flag.go +++ b/compiler_wrapper/gomacc_flag.go @@ -8,7 +8,7 @@ import ( "os" ) -func processGomaCccFlags(allowGoma bool, builder *commandBuilder) (gomaUsed bool, err error) { +func processGomaCccFlags(builder *commandBuilder) (gomaUsed bool, err error) { gomaPath := "" nextArgIsGomaPath := false builder.transformArgs(func(arg builderArg) string { @@ -31,7 +31,7 @@ func processGomaCccFlags(allowGoma bool, builder *commandBuilder) (gomaUsed bool if gomaPath == "" { gomaPath, _ = builder.env.getenv("GOMACC_PATH") } - if allowGoma && gomaPath != "" { + if gomaPath != "" { if _, err := os.Lstat(gomaPath); err == nil { builder.wrapPath(gomaPath) return true, nil diff --git a/compiler_wrapper/gomacc_flag_test.go b/compiler_wrapper/gomacc_flag_test.go index e2aa4420..d7b2b0b7 100644 --- a/compiler_wrapper/gomacc_flag_test.go +++ b/compiler_wrapper/gomacc_flag_test.go @@ -6,7 +6,6 @@ package main import ( "path" - "path/filepath" "testing" ) @@ -93,19 +92,3 @@ func TestOmitGomaccByDefault(t *testing.T) { } }) } - -func TestRusagePreventsGoma(t *testing.T) { - withTestContext(t, func(ctx *testContext) { - gomaPath := path.Join(ctx.tempDir, "gomacc") - ctx.writeFile(gomaPath, "") - ctx.env = []string{ - "GOMACC_PATH=" + gomaPath, - "TOOLCHAIN_RUSAGE_OUTPUT=" + filepath.Join(ctx.tempDir, "rusage.log"), - } - cmd := ctx.must(callCompiler(ctx, ctx.cfg, - ctx.newCommand(gccX86_64, mainCc))) - if err := verifyPath(cmd, gccX86_64+".real"); err != nil { - t.Error(err) - } - }) -} |