summaryrefslogtreecommitdiff
path: root/apex/apex.go
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-11-25 18:53:06 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-11-25 18:53:06 +0000
commitfc7b83d32b7fdd3fa1cef232640534c94ad8c080 (patch)
tree6b1f941ab38c1acdb04e810d68b77c553392b6a7 /apex/apex.go
parent5d6bcfa99b7482d7b3dbb094ea7a6e47e8b08f0f (diff)
parentb9518073037aee71b0ed71cbcd930e44cde0a592 (diff)
Merge "Add apex_test.skip_validations" into main
Diffstat (limited to 'apex/apex.go')
-rw-r--r--apex/apex.go31
1 files changed, 27 insertions, 4 deletions
diff --git a/apex/apex.go b/apex/apex.go
index 0b56bf890..0e40d7c0e 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -434,6 +434,7 @@ type apexBundle struct {
archProperties apexArchBundleProperties
overridableProperties overridableProperties
vndkProperties apexVndkProperties // only for apex_vndk modules
+ testProperties apexTestProperties // only for apex_test modules
///////////////////////////////////////////////////////////////////////////////////////////
// Inputs
@@ -1296,6 +1297,23 @@ func (a *apexBundle) UsePlatformApis() bool {
return proptools.BoolDefault(a.properties.Platform_apis, false)
}
+type apexValidationType int
+
+const (
+ hostApexVerifier apexValidationType = iota
+ apexSepolicyTests
+)
+
+func (a *apexBundle) skipValidation(validationType apexValidationType) bool {
+ switch validationType {
+ case hostApexVerifier:
+ return proptools.Bool(a.testProperties.Skip_validations.Host_apex_verifier)
+ case apexSepolicyTests:
+ return proptools.Bool(a.testProperties.Skip_validations.Apex_sepolicy_tests)
+ }
+ panic("Unknown validation type")
+}
+
// getCertString returns the name of the cert that should be used to sign this APEX. This is
// basically from the "certificate" property, but could be overridden by the device config.
func (a *apexBundle) getCertString(ctx android.BaseModuleContext) string {
@@ -2427,10 +2445,14 @@ func newApexBundle() *apexBundle {
return module
}
-func ApexBundleFactory(testApex bool) android.Module {
- bundle := newApexBundle()
- bundle.testApex = testApex
- return bundle
+type apexTestProperties struct {
+ // Boolean flags for validation checks. Test APEXes can turn on/off individual checks.
+ Skip_validations struct {
+ // Skips `Apex_sepolicy_tests` check if true
+ Apex_sepolicy_tests *bool
+ // Skips `Host_apex_verifier` check if true
+ Host_apex_verifier *bool
+ }
}
// apex_test is an APEX for testing. The difference from the ordinary apex module type is that
@@ -2438,6 +2460,7 @@ func ApexBundleFactory(testApex bool) android.Module {
func TestApexBundleFactory() android.Module {
bundle := newApexBundle()
bundle.testApex = true
+ bundle.AddProperties(&bundle.testProperties)
return bundle
}