Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c953f35a authored by Victor Hsieh's avatar Victor Hsieh
Browse files

Reimplement ApkVerityTest

This is a regression/end-to-end test of fs-verity. The original test
setup uses ".fsv_sig" to enable fs-verity on APK then use them as the
target to tamper with.

Now that an app API exists, switch the test setup to use the API. We
can also avoid the placeholder app and signature now.

Since the test is almost a complete rewrite, move it from presubmit to
postsubmit until it's proven stable enough.

Bug: 277916185
Bug: 296465999
Test: atest FsVerityTest
Change-Id: I1bbeb5d6adc960bf3fe4e9c1262ffc7538062f61
parent 62bfbf7b
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -47,9 +47,6 @@
        {
            "name":"CarrierAppIntegrationTestCases"
        },
        {
            "name":"ApkVerityTest"
        },
        {
            "name":"CtsSilentUpdateHostTestCases"
        },
+6 −4
Original line number Diff line number Diff line
@@ -11,10 +11,6 @@
        }
      ]
    },
    {
      "name": "ApkVerityTest",
      "file_patterns": ["VerityUtils\\.java"]
    },
    {
      "name": "UpdatableSystemFontTest",
      "file_patterns": ["VerityUtils\\.java"]
@@ -23,5 +19,11 @@
      "name": "CtsApkVerityInstallHostTestCases",
      "file_patterns": ["VerityUtils\\.java"]
    }
  ],
  "postsubmit": [
    {
      "name": "FsVerityTest",
      "file_patterns": ["VerityUtils\\.java"]
    }
  ]
}
+4 −10
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ package {
}

java_test_host {
    name: "ApkVerityTest",
    name: "FsVerityTest",
    srcs: ["src/**/*.java"],
    libs: [
        "tradefed",
@@ -30,8 +30,10 @@ java_test_host {
        "compatibility-host-util",
    ],
    static_libs: [
        "android.security.flags-aconfig-java-host",
        "block_device_writer_jar",
        "frameworks-base-hostutils",
        "flag-junit-host",
    ],
    test_suites: [
        "general-tests",
@@ -41,14 +43,6 @@ java_test_host {
        "block_device_writer",
    ],
    data: [
        ":ApkVerityTestCertDer",
        ":ApkVerityTestApp",
        ":ApkVerityTestAppFsvSig",
        ":ApkVerityTestAppDm",
        ":ApkVerityTestAppDmFsvSig",
        ":ApkVerityTestAppSplit",
        ":ApkVerityTestAppSplitFsvSig",
        ":ApkVerityTestAppSplitDm",
        ":ApkVerityTestAppSplitDmFsvSig",
        ":FsVerityTestApp",
    ],
}
+5 −17
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<configuration description="APK fs-verity integration/regression test">
<configuration description="fs-verity end-to-end test">
    <option name="test-suite-tag" value="apct" />

    <object type="module_controller" class="com.android.tradefed.testtype.suite.module.ShippingApiLevelModuleController">
@@ -24,19 +24,9 @@
    <!-- This test requires root to write against block device. -->
    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" />

    <target_preparer class="com.android.tradefed.targetprep.DeviceSetup">
        <!-- Disable package verifier prevents it holding the target APK's fd that prevents cache
             eviction. -->
        <option name="set-global-setting" key="verifier_verify_adb_installs" value="0" />
        <option name="restore-settings" value="true" />

        <!-- Skip in order to prevent reboot that confuses the test flow. -->
        <option name="force-skip-system-props" value="true" />
    </target_preparer>

    <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
        <option name="cleanup" value="true" />
        <option name="push" value="ApkVerityTestCert.der->/data/local/tmp/ApkVerityTestCert.der" />
    <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">
        <option name="test-file-name" value="FsVerityTestApp.apk"/>
        <option name="cleanup-apks" value="true"/>
    </target_preparer>

    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
@@ -48,9 +38,7 @@
        <option name="push" value="block_device_writer->/data/local/tmp/block_device_writer" />
    </target_preparer>

    <!-- Skip on HWASan. TODO(b/232288278): Re-enable -->
    <object type="module_controller" class="com.android.tradefed.testtype.suite.module.SkipHWASanModuleController" />
    <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
        <option name="jar" value="ApkVerityTest.jar" />
        <option name="jar" value="FsVerityTest.jar" />
    </test>
</configuration>
+0 −25
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  -->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.android.apkverity"
    android:isFeatureSplit="true"
    split="feature_x">
    <application>
        <activity android:name=".feature_x.DummyActivity"/>
    </application>
</manifest>
Loading