Run boringssl tests according to ro.zygote

If ro.zygote is zygote64, don't bother running 32-bit test.
Otherwise abilist{32,64} decides what tests to run.

Bug: 291874369
Test: make gsi_arm64-user; Check /vendor/etc
(cherry picked from https://android-review.googlesource.com/q/commit:1c332ee60edc7c64e1a4c0cd5accd0d9e6245c0d)
Merged-In: Ib8e4cbb10ff768d4c72364885bee2b9577eedafe
Change-Id: Ib8e4cbb10ff768d4c72364885bee2b9577eedafe
diff --git a/selftest/Android.bp b/selftest/Android.bp
index 013a128..d746daf 100644
--- a/selftest/Android.bp
+++ b/selftest/Android.bp
@@ -62,4 +62,24 @@
     stem: "boringssl_self_test",
     vendor: true,
     init_rc: ["boringssl_self_test.rc"],
+    required: [
+        "boringssl_self_test.zygote64.rc",
+        "boringssl_self_test.zygote64_32.rc",
+    ],
+}
+
+prebuilt_etc {
+    name: "boringssl_self_test.zygote64_32.rc",
+    src: "boringssl_self_test.zygote64_32.rc",
+    vendor: true,
+    symlinks: [
+        "boringssl_self_test.zygote32.rc",
+        "boringssl_self_test.no_zygote.rc",
+    ],
+}
+
+prebuilt_etc {
+    name: "boringssl_self_test.zygote64.rc",
+    src: "boringssl_self_test.zygote64.rc",
+    vendor: true,
 }
diff --git a/selftest/boringssl_self_test.rc b/selftest/boringssl_self_test.rc
index 18e99ad..2f20f80 100644
--- a/selftest/boringssl_self_test.rc
+++ b/selftest/boringssl_self_test.rc
@@ -1,8 +1,5 @@
 # Run boringssl self test for each ABI so that later processes can skip it. http://b/139348610
-on early-init && property:ro.product.cpu.abilist32=*
-    exec_start boringssl_self_test32_vendor
-on early-init && property:ro.product.cpu.abilist64=*
-    exec_start boringssl_self_test64_vendor
+import /vendor/etc/boringssl_self_test.${ro.zygote}.rc
 
 service boringssl_self_test32_vendor /vendor/bin/boringssl_self_test32
     setenv BORINGSSL_SELF_TEST_CREATE_FLAG true # Any nonempty value counts as true
diff --git a/selftest/boringssl_self_test.zygote64.rc b/selftest/boringssl_self_test.zygote64.rc
new file mode 100644
index 0000000..a6bbbe2
--- /dev/null
+++ b/selftest/boringssl_self_test.zygote64.rc
@@ -0,0 +1,2 @@
+on early-init && property:ro.product.cpu.abilist64=*
+    exec_start boringssl_self_test64_vendor
diff --git a/selftest/boringssl_self_test.zygote64_32.rc b/selftest/boringssl_self_test.zygote64_32.rc
new file mode 100644
index 0000000..6971bd5
--- /dev/null
+++ b/selftest/boringssl_self_test.zygote64_32.rc
@@ -0,0 +1,4 @@
+on early-init && property:ro.product.cpu.abilist32=*
+    exec_start boringssl_self_test32_vendor
+on early-init && property:ro.product.cpu.abilist64=*
+    exec_start boringssl_self_test64_vendor