diff options
author | 2024-01-05 15:29:48 +0900 | |
---|---|---|
committer | 2024-01-10 16:29:51 +0900 | |
commit | 3dba4d2c60923dde665c11f6cb7ce6e81b987534 (patch) | |
tree | d17aec1a880ca5b0269bbf67c9a730442581a33e /cc/tidy_test.go | |
parent | d06bdb031042ea448cc2a34fae9ccc4a50f63434 (diff) |
Disable tidy checks for generated code
Generated codes like cpp code from *.ll for *.yy files always run
clang-tidy, when generated code has warning, where is no way to fix it.
So, disable clang-tidy for generated code.
Bug: 162909698
Test: go test android/soong/cc
Change-Id: I0fee137d6170ef4bf6cf641abad572e448aceaa1
Diffstat (limited to 'cc/tidy_test.go')
-rw-r--r-- | cc/tidy_test.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/cc/tidy_test.go b/cc/tidy_test.go index 7036ecb1a..9481778a2 100644 --- a/cc/tidy_test.go +++ b/cc/tidy_test.go @@ -244,3 +244,30 @@ func TestWithTidy(t *testing.T) { }) } } + +func TestWithGeneratedCode(t *testing.T) { + bp := ` + cc_library_shared { + name: "libfoo", + srcs: ["foo_1.y", "foo_2.yy", "foo_3.l", "foo_4.ll", "foo_5.proto", + "foo_6.aidl", "foo_7.rscript", "foo_8.fs", "foo_9.sysprop", + "foo_src.cpp"], + tidy: true, + }` + variant := "android_arm64_armv8-a_shared" + + testEnv := map[string]string{} + testEnv["ALLOW_LOCAL_TIDY_TRUE"] = "1" + + ctx := android.GroupFixturePreparers(prepareForCcTest, android.FixtureMergeEnv(testEnv)).RunTestWithBp(t, bp) + + t.Run("tidy should be only run for source code, not for generated code", func(t *testing.T) { + depFiles := ctx.ModuleForTests("libfoo", variant).Rule("ld").Validations.Strings() + + tidyFileForCpp := "out/soong/.intermediates/libfoo/" + variant + "/obj/foo_src.tidy" + + android.AssertArrayString(t, + "only one .tidy file for source code should exist for libfoo", + []string{tidyFileForCpp}, depFiles) + }) +} |