export common bp2build testing functions
bp2buildTestCase
attrNameToString
runBp2BuildTestCase
makeBazelTargetNoRestrictions
The testing framework defined in the bp2build package can only be used
from within the package because many common testing functions are
private to the package. This prevents modules defined in Soong
plugins (e.g. system/tools/aidl/build) from testing bp2build conversions.
Test: go test ./bp2build
Change-Id: Ia867081327c5181d04687b13c4550e68e6a11f86
diff --git a/bp2build/apex_key_conversion_test.go b/bp2build/apex_key_conversion_test.go
index dfa96a2..15bccf7 100644
--- a/bp2build/apex_key_conversion_test.go
+++ b/bp2build/apex_key_conversion_test.go
@@ -21,28 +21,28 @@
"testing"
)
-func runApexKeyTestCase(t *testing.T, tc bp2buildTestCase) {
+func runApexKeyTestCase(t *testing.T, tc Bp2buildTestCase) {
t.Helper()
- runBp2BuildTestCase(t, registerApexKeyModuleTypes, tc)
+ RunBp2BuildTestCase(t, registerApexKeyModuleTypes, tc)
}
func registerApexKeyModuleTypes(ctx android.RegistrationContext) {
}
func TestApexKeySimple(t *testing.T) {
- runApexKeyTestCase(t, bp2buildTestCase{
- description: "apex key - simple example",
- moduleTypeUnderTest: "apex_key",
- moduleTypeUnderTestFactory: apex.ApexKeyFactory,
- filesystem: map[string]string{},
- blueprint: `
+ runApexKeyTestCase(t, Bp2buildTestCase{
+ Description: "apex key - simple example",
+ ModuleTypeUnderTest: "apex_key",
+ ModuleTypeUnderTestFactory: apex.ApexKeyFactory,
+ Filesystem: map[string]string{},
+ Blueprint: `
apex_key {
name: "com.android.apogee.key",
public_key: "com.android.apogee.avbpubkey",
private_key: "com.android.apogee.pem",
}
`,
- expectedBazelTargets: []string{makeBazelTargetNoRestrictions("apex_key", "com.android.apogee.key", attrNameToString{
+ ExpectedBazelTargets: []string{MakeBazelTargetNoRestrictions("apex_key", "com.android.apogee.key", AttrNameToString{
"private_key": `"com.android.apogee.pem"`,
"public_key": `"com.android.apogee.avbpubkey"`,
}),