diff options
Diffstat (limited to 'compiler_wrapper/clang_tidy_flag_test.go')
-rw-r--r-- | compiler_wrapper/clang_tidy_flag_test.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/compiler_wrapper/clang_tidy_flag_test.go b/compiler_wrapper/clang_tidy_flag_test.go index 9c0fc928..9ca37d8f 100644 --- a/compiler_wrapper/clang_tidy_flag_test.go +++ b/compiler_wrapper/clang_tidy_flag_test.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "io" + "path" "strings" "testing" ) @@ -234,6 +235,40 @@ func TestOmitCCacheWithClangTidy(t *testing.T) { }) } +func TestPartiallyOmitGomaWithClangTidy(t *testing.T) { + withClangTidyTestContext(t, func(ctx *testContext) { + gomaPath := path.Join(ctx.tempDir, "gomacc") + // Create a file so the gomacc path is valid. + ctx.writeFile(gomaPath, "") + ctx.env = append(ctx.env, "GOMACC_PATH="+gomaPath) + + ctx.cmdMock = func(cmd *command, stdout io.Writer, stderr io.Writer) error { + switch ctx.cmdCount { + case 1: + if err := verifyPath(cmd, "usr/bin/clang"); err != nil { + t.Error(err) + } + return nil + case 2: + if err := verifyPath(cmd, "usr/bin/clang-tidy"); err != nil { + return err + } + return nil + default: + return nil + } + } + cmd := ctx.must(callCompiler(ctx, ctx.cfg, + ctx.newCommand(clangX86_64, mainCc))) + if ctx.cmdCount != 3 { + t.Errorf("expected 3 calls. Got: %d", ctx.cmdCount) + } + if err := verifyPath(cmd, gomaPath); err != nil { + t.Error(err) + } + }) +} + func withClangTidyTestContext(t *testing.T, work func(ctx *testContext)) { withTestContext(t, func(ctx *testContext) { ctx.env = []string{"WITH_TIDY=1"} |