Loading androidmk/androidmk/androidmk_test.go +15 −0 Original line number Diff line number Diff line Loading @@ -1688,6 +1688,21 @@ android_app { name: "foo", privileged: true } `, }, { desc: "convert android_app to android_test when having test_suites", in: ` include $(CLEAR_VARS) LOCAL_MODULE := foo LOCAL_COMPATIBILITY_SUITE := bar include $(BUILD_PACKAGE) `, expected: ` android_test { name: "foo", test_suites: ["bar"], } `, }, } Loading bpfix/bpfix/bpfix.go +3 −8 Original line number Diff line number Diff line Loading @@ -449,6 +449,7 @@ func rewriteTestModuleTypes(f *Fixer) error { } hasInstrumentationFor := hasNonEmptyLiteralStringProperty(mod, "instrumentation_for") hasTestSuites := hasNonEmptyLiteralListProperty(mod, "test_suites") tags, _ := getLiteralListPropertyValue(mod, "tags") var hasTestsTag bool Loading @@ -458,7 +459,7 @@ func rewriteTestModuleTypes(f *Fixer) error { } } isTest := hasInstrumentationFor || hasTestsTag isTest := hasInstrumentationFor || hasTestsTag || hasTestSuites if isTest { switch mod.Type { Loading @@ -470,13 +471,7 @@ func rewriteTestModuleTypes(f *Fixer) error { mod.Type = "java_test" case "java_library_host": mod.Type = "java_test_host" } } // when a cc_binary module has a nonempty test_suites field, modify the type to cc_test if mod.Type == "cc_binary" { hasTestSuites := hasNonEmptyLiteralListProperty(mod, "test_suites") if hasTestSuites { case "cc_binary": mod.Type = "cc_test" } } Loading bpfix/bpfix/bpfix_test.go +32 −0 Original line number Diff line number Diff line Loading @@ -1436,6 +1436,38 @@ func TestRewriteTestModuleTypes(t *testing.T) { } `, }, { name: "android_app with android_test", in: ` android_app { name: "foo", srcs: ["srcs"], test_suites: ["test_suite1"], } `, out: ` android_test { name: "foo", srcs: ["srcs"], test_suites: ["test_suite1"], } `, }, { name: "android_app without test_suites", in: ` android_app { name: "foo", srcs: ["srcs"], } `, out: ` android_app { name: "foo", srcs: ["srcs"], } `, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { Loading Loading
androidmk/androidmk/androidmk_test.go +15 −0 Original line number Diff line number Diff line Loading @@ -1688,6 +1688,21 @@ android_app { name: "foo", privileged: true } `, }, { desc: "convert android_app to android_test when having test_suites", in: ` include $(CLEAR_VARS) LOCAL_MODULE := foo LOCAL_COMPATIBILITY_SUITE := bar include $(BUILD_PACKAGE) `, expected: ` android_test { name: "foo", test_suites: ["bar"], } `, }, } Loading
bpfix/bpfix/bpfix.go +3 −8 Original line number Diff line number Diff line Loading @@ -449,6 +449,7 @@ func rewriteTestModuleTypes(f *Fixer) error { } hasInstrumentationFor := hasNonEmptyLiteralStringProperty(mod, "instrumentation_for") hasTestSuites := hasNonEmptyLiteralListProperty(mod, "test_suites") tags, _ := getLiteralListPropertyValue(mod, "tags") var hasTestsTag bool Loading @@ -458,7 +459,7 @@ func rewriteTestModuleTypes(f *Fixer) error { } } isTest := hasInstrumentationFor || hasTestsTag isTest := hasInstrumentationFor || hasTestsTag || hasTestSuites if isTest { switch mod.Type { Loading @@ -470,13 +471,7 @@ func rewriteTestModuleTypes(f *Fixer) error { mod.Type = "java_test" case "java_library_host": mod.Type = "java_test_host" } } // when a cc_binary module has a nonempty test_suites field, modify the type to cc_test if mod.Type == "cc_binary" { hasTestSuites := hasNonEmptyLiteralListProperty(mod, "test_suites") if hasTestSuites { case "cc_binary": mod.Type = "cc_test" } } Loading
bpfix/bpfix/bpfix_test.go +32 −0 Original line number Diff line number Diff line Loading @@ -1436,6 +1436,38 @@ func TestRewriteTestModuleTypes(t *testing.T) { } `, }, { name: "android_app with android_test", in: ` android_app { name: "foo", srcs: ["srcs"], test_suites: ["test_suite1"], } `, out: ` android_test { name: "foo", srcs: ["srcs"], test_suites: ["test_suite1"], } `, }, { name: "android_app without test_suites", in: ` android_app { name: "foo", srcs: ["srcs"], } `, out: ` android_app { name: "foo", srcs: ["srcs"], } `, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { Loading