aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/compiler_wrapper_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'compiler_wrapper/compiler_wrapper_test.go')
-rw-r--r--compiler_wrapper/compiler_wrapper_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/compiler_wrapper/compiler_wrapper_test.go b/compiler_wrapper/compiler_wrapper_test.go
index dc2a9dd5..fd59cfe1 100644
--- a/compiler_wrapper/compiler_wrapper_test.go
+++ b/compiler_wrapper/compiler_wrapper_test.go
@@ -10,6 +10,7 @@ import (
"fmt"
"io"
"os"
+ "path"
"path/filepath"
"strings"
"syscall"
@@ -96,6 +97,33 @@ func TestLogMissingCCacheExecError(t *testing.T) {
})
}
+func TestGomaDisablesRusage(t *testing.T) {
+ withTestContext(t, func(ctx *testContext) {
+ gomaPath := path.Join(ctx.tempDir, "gomacc")
+ ctx.writeFile(gomaPath, "")
+ ctx.env = []string{"GOMACC_PATH=" + gomaPath}
+ logFileName := filepath.Join(ctx.tempDir, "rusage.log")
+ ctx.env = []string{
+ "TOOLCHAIN_RUSAGE_OUTPUT=" + logFileName,
+ "GOMACC_PATH=" + gomaPath,
+ }
+ cmd := ctx.must(callCompiler(ctx, ctx.cfg, ctx.newCommand(gccX86_64, mainCc)))
+ // Ensure Goma was used
+ if err := verifyPath(cmd, gomaPath); err != nil {
+ t.Fatal(err)
+ }
+ if err := verifyArgOrder(cmd, gccX86_64+".real", mainCc); err != nil {
+ t.Error(err)
+ }
+ // Ensure rusage log was not created
+ if _, err := os.Stat(logFileName); err == nil {
+ t.Errorf("Logfile shouldn't have been created at TOOLCHAIN_RUSAGE_OUTPUT path %q but was", logFileName)
+ } else if !os.IsNotExist(err) {
+ t.Fatalf("error checking for rusage logfile at %q: %v", logFileName, err)
+ }
+ })
+}
+
func TestLogRusageAndForceDisableWError(t *testing.T) {
withTestContext(t, func(ctx *testContext) {
logFileName := filepath.Join(ctx.tempDir, "rusage.log")