Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 105a7041 authored by Sam Delmerico's avatar Sam Delmerico
Browse files

Revert "add bp2build unit tests for aidl_interface"

This reverts commit 1fa2672b.

Reason for revert: breaks tradefed branch

Change-Id: I69bba531774031890baece1796df24d5534b93a9
parent 1fa2672b
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -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",
+0 −249
Original line number Diff line number Diff line
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",
    ]`,
			}),
		},
	})
}
+3 −7
Original line number Diff line number Diff line
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

+0 −1
Original line number Diff line number Diff line
@@ -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"
}