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

Commit f4426488 authored by Serdar Kocdemir's avatar Serdar Kocdemir Committed by Android (Google) Code Review
Browse files

Merge "Add Android version check to GpuWorkTracepointTest" into udc-dev

parents 401615e0 2b8cecd2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ java_test_host {
    libs: [
        "tradefed",
        "vts-core-tradefed-harness",
        "compatibility-host-util",
    ],
    test_suites: [
        "general-tests",
+16 −3
Original line number Diff line number Diff line
@@ -19,11 +19,16 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;

import android.platform.test.annotations.RestrictedBuildTest;

import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
import com.android.tradefed.util.CommandResult;
import com.android.tradefed.util.CommandStatus;

import com.android.compatibility.common.util.PropertyUtil;
import com.android.compatibility.common.util.GmsTest;

import org.junit.Test;
import org.junit.runner.RunWith;

@@ -57,15 +62,23 @@ public class GpuWorkTracepointTest extends BaseHostJUnit4Test {
                commandResult.getStatus(), CommandStatus.SUCCESS);
    }

    @GmsTest(requirement = "VSR-3.3-004")
    @RestrictedBuildTest
    @Test
    public void testGpuWorkPeriodTracepointFormat() throws Exception {
        CommandResult commandResult = getDevice().executeShellV2Command(
                String.format("cat %s", GPU_WORK_PERIOD_TRACEPOINT_FORMAT_PATH));

        // If we failed to cat the tracepoint format then the test ends here.
        assumeTrue(String.format("Failed to cat the gpu_work_period tracepoint format at %s",
                        GPU_WORK_PERIOD_TRACEPOINT_FORMAT_PATH),
                commandResult.getStatus().equals(CommandStatus.SUCCESS));
        if (!commandResult.getStatus().equals(CommandStatus.SUCCESS)) {
            String message = String.format(
                "Failed to cat the gpu_work_period tracepoint format at %s\n",
                GPU_WORK_PERIOD_TRACEPOINT_FORMAT_PATH);

            // Tracepoint MUST exist on devices released with Android 14 or later
            assumeTrue(message, PropertyUtil.getVsrApiLevel(getDevice()) >= 34);
            fail(message);
        }

        // Otherwise, we check that the fields match the expected fields.
        String actualFields = Arrays.stream(