From 198a3c9519e5d93ffeb8f5e1b6694c34b178c5c4 Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Wed, 17 Jul 2019 04:22:34 -0700 Subject: Fix minor bugs These bugs were detected while creating golden tests and comparing them to the old wrapper (see next commit). Also makes flag order in old wrapper deterministic by replacing sets with a SetList class that is based on a list. BUG=chromium:773875 TEST=unit test Change-Id: I8e2680f732577f1f590042f1ccd589dfedadd6ce Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1706791 Tested-by: Tobias Bosch Reviewed-by: George Burgess --- compiler_wrapper/clang_syntax_flag_test.go | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'compiler_wrapper/clang_syntax_flag_test.go') diff --git a/compiler_wrapper/clang_syntax_flag_test.go b/compiler_wrapper/clang_syntax_flag_test.go index d2661812..c30d9795 100644 --- a/compiler_wrapper/clang_syntax_flag_test.go +++ b/compiler_wrapper/clang_syntax_flag_test.go @@ -124,10 +124,35 @@ func TestUseGomaForClangSyntaxCheck(t *testing.T) { } return nil } - ctx.must(callCompiler(ctx, ctx.cfg, + cmd := ctx.must(callCompiler(ctx, ctx.cfg, ctx.newCommand(gccX86_64, "-clang-syntax", mainCc))) if ctx.cmdCount != 2 { t.Errorf("expected 2 calls. Got: %d", ctx.cmdCount) } + if err := verifyPath(cmd, gomaPath); err != nil { + t.Error(err) + } + }) +} + +func TestPartiallyOmitCCacheForClangSyntaxCheck(t *testing.T) { + withTestContext(t, func(ctx *testContext) { + ctx.cfg.useCCache = true + ctx.cmdMock = func(cmd *command, stdout io.Writer, stderr io.Writer) error { + if ctx.cmdCount == 1 { + if err := verifyPath(cmd, "usr/bin/clang"); err != nil { + return err + } + } + return nil + } + cmd := ctx.must(callCompiler(ctx, ctx.cfg, + ctx.newCommand(gccX86_64, "-clang-syntax", mainCc))) + if ctx.cmdCount != 2 { + t.Errorf("expected 2 calls. Got: %d", ctx.cmdCount) + } + if err := verifyPath(cmd, "/usr/bin/ccache"); err != nil { + t.Error(err) + } }) } -- cgit v1.2.3