From 105a70418ffe6c44bde5d73a87aef67cae15f271 Mon Sep 17 00:00:00 2001 From: Sam Delmerico Date: Mon, 29 Aug 2022 22:24:10 +0000 Subject: [PATCH] Revert "add bp2build unit tests for aidl_interface" This reverts commit 1fa2672be9d9feeab83125b75f82bd994a0972ba. Reason for revert: breaks tradefed branch Change-Id: I69bba531774031890baece1796df24d5534b93a9 --- bp2build/Android.bp | 2 - bp2build/aidl_interface_conversion_test.go | 249 --------------------- go.mod | 10 +- tests/lib.sh | 1 - 4 files changed, 3 insertions(+), 259 deletions(-) delete mode 100644 bp2build/aidl_interface_conversion_test.go diff --git a/bp2build/Android.bp b/bp2build/Android.bp index d327157d5..cb25627b2 100644 --- a/bp2build/Android.bp +++ b/bp2build/Android.bp @@ -18,7 +18,6 @@ bootstrap_go_package { "testing.go", ], deps: [ - "aidl-soong-rules", "soong-android", "soong-android-allowlists", "soong-android-soongconfig", @@ -37,7 +36,6 @@ bootstrap_go_package { ], testSrcs: [ "aar_conversion_test.go", - "aidl_interface_conversion_test.go", "android_app_certificate_conversion_test.go", "android_app_conversion_test.go", "apex_conversion_test.go", diff --git a/bp2build/aidl_interface_conversion_test.go b/bp2build/aidl_interface_conversion_test.go deleted file mode 100644 index 38d902d3b..000000000 --- a/bp2build/aidl_interface_conversion_test.go +++ /dev/null @@ -1,249 +0,0 @@ -package bp2build - -import ( - "android/soong/aidl" - "android/soong/android" - "testing" -) - -func runAidlInterfaceTestCase(t *testing.T, tc Bp2buildTestCase) { - t.Helper() - RunBp2BuildTestCase( - t, - func(ctx android.RegistrationContext) { - ctx.RegisterModuleType("aidl_interface", aidl.AidlInterfaceFactory) - ctx.RegisterModuleType("aidl_interface_headers", aidl.AidlInterfaceHeadersFactory) - }, - tc, - ) -} - -func TestAidlInterfaceHeaders(t *testing.T) { - runAidlInterfaceTestCase(t, Bp2buildTestCase{ - Description: `aidl_interface_headers`, - Blueprint: ` -aidl_interface_headers { - name: "aidl-interface-headers", - include_dir: "src", - srcs: [ - "src/A.aidl", - ], -} -`, - ExpectedBazelTargets: []string{ - MakeBazelTargetNoRestrictions("aidl_library", "aidl-interface-headers", AttrNameToString{ - "strip_import_prefix": `"src"`, - "hdrs": `["src/A.aidl"]`, - }), - }, - }) -} - -func TestAidlInterface(t *testing.T) { - runAidlInterfaceTestCase(t, Bp2buildTestCase{ - Description: `aidl_interface with single "latest" aidl_interface import`, - Blueprint: ` -aidl_interface_headers { - name: "aidl-interface-headers", -} -aidl_interface { - name: "aidl-interface-import", - versions: [ - "1", - "2", - ], -} -aidl_interface { - name: "aidl-interface1", - flags: ["--flag1"], - imports: [ - "aidl-interface-import-V1", - ], - headers: [ - "aidl-interface-headers", - ], - versions: [ - "1", - "2", - "3", - ], -}`, - ExpectedBazelTargets: []string{ - MakeBazelTargetNoRestrictions("aidl_library", "aidl-interface-headers", AttrNameToString{}), - MakeBazelTargetNoRestrictions("aidl_interface", "aidl-interface-import", AttrNameToString{ - "backends": `[ - "cpp", - "java", - "ndk", - ]`, - "versions": `[ - "1", - "2", - ]`, - }), - MakeBazelTargetNoRestrictions("aidl_interface", "aidl-interface1", AttrNameToString{ - "backends": `[ - "cpp", - "java", - "ndk", - ]`, - "deps": `[ - ":aidl-interface-import-V1", - ":aidl-interface-headers", - ]`, - "flags": `["--flag1"]`, - "versions": `[ - "1", - "2", - "3", - ]`, - }), - }, - }) -} - -func TestAidlInterfaceWithNoProperties(t *testing.T) { - runAidlInterfaceTestCase(t, Bp2buildTestCase{ - Description: `aidl_interface no properties set`, - Blueprint: ` -aidl_interface { - name: "aidl-interface1", -} -`, - ExpectedBazelTargets: []string{ - MakeBazelTargetNoRestrictions("aidl_interface", "aidl-interface1", AttrNameToString{ - "backends": `[ - "cpp", - "java", - "ndk", - ]`, - }), - }, - }) -} - -func TestAidlInterfaceWithDisabledBackends(t *testing.T) { - runAidlInterfaceTestCase(t, Bp2buildTestCase{ - Description: `aidl_interface with some backends disabled`, - Blueprint: ` -aidl_interface { - name: "aidl-interface1", - backend: { - ndk: { - enabled: false, - }, - cpp: { - enabled: false, - }, - }, -} -`, - ExpectedBazelTargets: []string{ - MakeBazelTargetNoRestrictions("aidl_interface", "aidl-interface1", AttrNameToString{ - "backends": `["java"]`, - }), - }, - }) -} - -func TestAidlInterfaceWithLatestImport(t *testing.T) { - runAidlInterfaceTestCase(t, Bp2buildTestCase{ - Description: `aidl_interface with single "latest" aidl_interface import`, - Blueprint: ` -aidl_interface { - name: "aidl-interface-import", - versions: [ - "1", - "2", - ], -} -aidl_interface { - name: "aidl-interface1", - imports: [ - "aidl-interface-import", - ], - versions: [ - "1", - "2", - "3", - ], -}`, - ExpectedBazelTargets: []string{ - MakeBazelTargetNoRestrictions("aidl_interface", "aidl-interface-import", AttrNameToString{ - "backends": `[ - "cpp", - "java", - "ndk", - ]`, - "versions": `[ - "1", - "2", - ]`, - }), - MakeBazelTargetNoRestrictions("aidl_interface", "aidl-interface1", AttrNameToString{ - "backends": `[ - "cpp", - "java", - "ndk", - ]`, - "deps": `[":aidl-interface-import-latest"]`, - "versions": `[ - "1", - "2", - "3", - ]`, - }), - }, - }) -} - -func TestAidlInterfaceWithVersionedImport(t *testing.T) { - runAidlInterfaceTestCase(t, Bp2buildTestCase{ - Description: `aidl_interface with single versioned aidl_interface import`, - Blueprint: ` -aidl_interface { - name: "aidl-interface-import", - versions: [ - "1", - "2", - ], -} -aidl_interface { - name: "aidl-interface1", - imports: [ - "aidl-interface-import-V2", - ], - versions: [ - "1", - "2", - "3", - ], -}`, - ExpectedBazelTargets: []string{ - MakeBazelTargetNoRestrictions("aidl_interface", "aidl-interface-import", AttrNameToString{ - "backends": `[ - "cpp", - "java", - "ndk", - ]`, - "versions": `[ - "1", - "2", - ]`, - }), - MakeBazelTargetNoRestrictions("aidl_interface", "aidl-interface1", AttrNameToString{ - "backends": `[ - "cpp", - "java", - "ndk", - ]`, - "deps": `[":aidl-interface-import-V2"]`, - "versions": `[ - "1", - "2", - "3", - ]`, - }), - }, - }) -} diff --git a/go.mod b/go.mod index 2e28ab677..8c1a9f011 100644 --- a/go.mod +++ b/go.mod @@ -1,17 +1,13 @@ module android/soong -require ( - google.golang.org/protobuf v0.0.0 - github.com/google/blueprint v0.0.0 - android/soong/aidl v0.0.0 -) +require google.golang.org/protobuf v0.0.0 + +require github.com/google/blueprint v0.0.0 replace google.golang.org/protobuf v0.0.0 => ../../external/golang-protobuf replace github.com/google/blueprint v0.0.0 => ../blueprint -replace android/soong/aidl v0.0.0 => ../../system/tools/aidl/build - // Indirect deps from golang-protobuf exclude github.com/golang/protobuf v1.5.0 diff --git a/tests/lib.sh b/tests/lib.sh index 643b46ac9..6210e779e 100644 --- a/tests/lib.sh +++ b/tests/lib.sh @@ -93,7 +93,6 @@ function create_mock_soong { symlink_directory external/go-cmp symlink_directory external/golang-protobuf symlink_directory external/starlark-go - symlink_directory system/tools/aidl touch "$MOCK_TOP/Android.bp" }