From 8b082eaed2a0c760d4b510c2762f9320e5b07c20 Mon Sep 17 00:00:00 2001 From: Chun-Wei Wang Date: Thu, 25 Aug 2022 08:28:52 +0000 Subject: [PATCH] Fix incompatible APK container signature Somehow this issue is only reproducible on TH. In the pushTestApex() method, buildHelper.getTestFile() will reference a file like: /tmp/tf-workfolder10675344980669124774/tests-zip_4606121987780006706/host/testcases/StagedRollbackTest/test.rebootless_apex_v1.apex while installPackage(REBOOTLESS_V2) will reference a file like: /tmp/tf-workfolder10675344980669124774/tests-zip_4606121987780006706/target/testcases/ApexTestCases/x86_64/test.rebootless_apex_v2.apex Those 2 files have incompatible signatures. This CL ensures both v1 and v2 are accessed by buildHelper.getTestFile() so they have compatible signatures. Bug: 242639590 Test: atest StagedInstallInternalTest Change-Id: I8dfafa5754b714867e0c60f7ccb8689c9471da01 --- .../host/StagedInstallInternalTest.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/StagedInstallTest/src/com/android/tests/stagedinstallinternal/host/StagedInstallInternalTest.java b/tests/StagedInstallTest/src/com/android/tests/stagedinstallinternal/host/StagedInstallInternalTest.java index 44265511ee500..f1fc503c85560 100644 --- a/tests/StagedInstallTest/src/com/android/tests/stagedinstallinternal/host/StagedInstallInternalTest.java +++ b/tests/StagedInstallTest/src/com/android/tests/stagedinstallinternal/host/StagedInstallInternalTest.java @@ -169,6 +169,12 @@ public class StagedInstallInternalTest extends BaseHostJUnit4Test { assertTrue(getDevice().pushFile(apex, "/" + partition + "/apex/" + fileName)); } + private void installTestApex(String fileName, String... extraArgs) throws Exception { + CompatibilityBuildHelper buildHelper = new CompatibilityBuildHelper(getBuild()); + final File apex = buildHelper.getTestFile(fileName); + getDevice().installPackage(apex, false, extraArgs); + } + private void pushTestVendorApexAllowList(String installerPackageName) throws Exception { if (!getDevice().isAdbRoot()) { getDevice().enableAdbRoot(); @@ -551,7 +557,7 @@ public class StagedInstallInternalTest extends BaseHostJUnit4Test { pushTestApex(REBOOTLESS_V1, "vendor"); getDevice().reboot(); runPhase("testVendorApex_VerifyFactory"); - installPackage(REBOOTLESS_V2, "--staged"); + installTestApex(REBOOTLESS_V2, "--staged"); getDevice().reboot(); runPhase("testVendorApex_VerifyData"); } @@ -565,7 +571,7 @@ public class StagedInstallInternalTest extends BaseHostJUnit4Test { pushTestApex(REBOOTLESS_V1, "vendor"); getDevice().reboot(); runPhase("testVendorApex_VerifyFactory"); - installPackage(REBOOTLESS_V2, "--force-non-staged"); + installTestApex(REBOOTLESS_V2, "--force-non-staged"); runPhase("testVendorApex_VerifyData"); }