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

Commit be04ce1b authored by Igor Murashkin's avatar Igor Murashkin
Browse files

startop: Re-enable iorapd presubmit tests

This works-around the issue of the device rebooting by using shell
commands in DeviceSetup.

The downside is that this leaves the device in a semi-bad state
(there's no way to run shell commands *after* a test to restore
the regular iorapd). We assume it's ok because the TF harness
will reboot the devices for each new type of test.

Bug: 136200738
Bug: 134774708
Change-Id: I0e5efad4a1c76c5abc89c3bec77e2c6babcba261
parent 95eab8ae
Loading
Loading
Loading
Loading
+19 −3
Original line number Diff line number Diff line
@@ -33,18 +33,34 @@
    <target_preparer class="com.android.tradefed.targetprep.DisableSELinuxTargetPreparer">
    </target_preparer>

    <!-- do not use DeviceSetup#set-property because it reboots the device b/136200738.
         furthermore the changes in /data/local.prop don't actually seem to get picked up.
    -->
    <target_preparer
        class="com.android.tradefed.targetprep.DeviceSetup">
        <!-- we need this magic flag, otherwise it always reboots and breaks the selinux -->
        <option name="force-skip-system-props" value="true" />

        <!-- Crash instead of using Log.wtf within the system_server iorap code. -->
        <option name="set-property" key="iorapd.forwarding_service.wtf_crash" value="true" />
        <option name="run-command" value="setprop iorapd.forwarding_service.wtf_crash true" />
        <!-- IIorapd has fake behavior: it doesn't do anything but reply with 'DONE' status -->
        <option name="set-property" key="iorapd.binder.fake" value="true" />
        <option name="restore-properties" value="true" />
        <option name="run-command" value="setprop iorapd.binder.fake true" />

        <!-- iorapd does not pick up the above changes until we restart it -->
        <option name="run-command" value="stop iorapd" />
        <option name="run-command" value="start iorapd" />
        <!-- give it some time to restart the service; otherwise the first unit test might fail -->
        <option name="run-command" value="sleep 1" />
    </target_preparer>

    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
        <option name="package" value="com.google.android.startop.iorap.tests" />
        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
    </test>

    <!-- using DeviceSetup again does not work. we simply leave the device in a semi-bad
         state. there is no way to clean this up as far as I know.
         -->

</configuration>
+5 −2
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@

package com.google.android.startop.iorap

import android.net.Uri
import android.os.ServiceManager
import androidx.test.filters.MediumTest
import org.junit.Test
@@ -85,6 +86,9 @@ class IIorapIntegrationTest {

    @Test
    fun testOnPackageEvent() {
        // FIXME (b/137134253): implement PackageEvent parsing on the C++ side.
        // This is currently (silently: b/137135024) failing because IIorap is 'oneway' and the
        // C++ PackageEvent un-parceling fails since its not implemented fully.
        /*
        testAnyMethod { requestId : RequestId ->
            iorapService.onPackageEvent(requestId,
@@ -92,7 +96,6 @@ class IIorapIntegrationTest {
                            Uri.parse("https://www.google.com"), "com.fake.package"))
        }
        */
        // FIXME: Broken for some reason. C++ side never sees this call.
    }

    @Test
@@ -107,7 +110,7 @@ class IIorapIntegrationTest {
    @Test
    fun testOnAppLaunchEvent() {
        testAnyMethod { requestId : RequestId ->
            // iorapService.onAppLaunchEvent(requestId, AppLaunchEvent.IntentStarted())
            iorapService.onAppLaunchEvent(requestId, AppLaunchEvent.IntentFailed(/*sequenceId*/123))
        }
    }