summaryrefslogtreecommitdiff
path: root/apex/apex_test.go
diff options
context:
space:
mode:
author Jooyung Han <jooyung@google.com> 2024-11-22 14:05:20 +0900
committer Jooyung Han <jooyung@google.com> 2024-11-25 12:56:15 +0900
commitb9518073037aee71b0ed71cbcd930e44cde0a592 (patch)
treeab94eceee4407f25ac7b7c23dbd94ea7e38c2c07 /apex/apex_test.go
parent1a6f176ce066fc39574db6b7bcb69da82e579199 (diff)
Add apex_test.skip_validations
Run validations for apex_test modules as well. If a test apex needs to be invalid for testing, it needs to specify which validation it needs to skip. This is to prevent cases like using apex_test to avoid a certain validation, but accidentally skipping all validations. For now, host_apex_verifier/apex_sepolicy_tests can be skipped. Bug: 363090062 Test: m nothing --no-skip-soong-tests Test: mmma system/apex Change-Id: I2d14f25f579eabe92ed2bd0e28b5ed19583df99d
Diffstat (limited to 'apex/apex_test.go')
-rw-r--r--apex/apex_test.go45
1 files changed, 45 insertions, 0 deletions
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 5b5fe5ff1..6e9295911 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -7101,6 +7101,51 @@ func TestApexAvailable_PrefixMatch(t *testing.T) {
`)
}
+func TestApexValidation_TestApexCanSkipInitRcCheck(t *testing.T) {
+ t.Parallel()
+ ctx := testApex(t, `
+ apex_test {
+ name: "myapex",
+ key: "myapex.key",
+ skip_validations: {
+ host_apex_verifier: true,
+ },
+ updatable: false,
+ }
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ `)
+
+ validations := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("signapk").Validations.Strings()
+ if android.SuffixInList(validations, "host_apex_verifier.timestamp") {
+ t.Error("should not run host_apex_verifier")
+ }
+}
+
+func TestApexValidation_TestApexCheckInitRc(t *testing.T) {
+ t.Parallel()
+ ctx := testApex(t, `
+ apex_test {
+ name: "myapex",
+ key: "myapex.key",
+ updatable: false,
+ }
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ `)
+
+ validations := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("signapk").Validations.Strings()
+ if !android.SuffixInList(validations, "host_apex_verifier.timestamp") {
+ t.Error("should run host_apex_verifier")
+ }
+}
+
func TestOverrideApex(t *testing.T) {
t.Parallel()
ctx := testApex(t, `