diff options
author | Xin Li <delphij@google.com> | 2024-01-17 22:14:59 -0800 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2024-01-17 22:14:59 -0800 |
commit | 597d45bd227dd3c2f8b7e012a30b51104b3b732a (patch) | |
tree | a9cca53b197b68421e0ff9ee9b10faa3a2453233 | |
parent | dff4645881bd88c62c37f96fa81347bfad8068a8 (diff) | |
parent | ce8bbe52020a4cc3192b23223e2ac04868ef12ff (diff) | |
download | catbox-597d45bd227dd3c2f8b7e012a30b51104b3b732a.tar.gz |
Merge Android 24Q1 Release (ab/11220357)temp_319669529
Bug: 319669529
Merged-In: I5c7bba550b1396e16966eaaf7b77a76193ac41e5
Change-Id: Iab1690f204a75078593f2ba0e3a8702897ce004e
5 files changed, 127 insertions, 19 deletions
diff --git a/runner/src/com/android/catbox/runner/MopedRunner.java b/runner/src/com/android/catbox/runner/MopedRunner.java index c1148b6..90d84bd 100644 --- a/runner/src/com/android/catbox/runner/MopedRunner.java +++ b/runner/src/com/android/catbox/runner/MopedRunner.java @@ -24,6 +24,9 @@ import com.android.tradefed.result.ITestInvocationListener; import com.android.tradefed.testtype.IRemoteTest; import java.net.URISyntaxException; import com.android.tradefed.device.ITestDevice; +import java.util.Map; +import java.util.HashMap; +import java.util.Collections; @OptionClass(alias = "aaos-moped-test") public class MopedRunner implements IRemoteTest { @@ -46,6 +49,8 @@ public class MopedRunner implements IRemoteTest { private File mLocalSrcFile; private String mArtifactLocation; + private static final Map<String, String> autoDic = initDeviceMap(); + private void unTarTestArtifact(TestInformation testInfo) throws TargetSetupError, TimeoutException, URISyntaxException { if (test_artifact != null && artifact_str == null) { artifact_str = test_artifact.toPath().toString(); @@ -76,14 +81,30 @@ public class MopedRunner implements IRemoteTest { } } + private static Map<String, String> initDeviceMap() { + Map<String, String> map = new HashMap<>(); + map.put("seahawk", "AUTO"); + map.put("seahawk_hwasan", "AUTO"); + map.put("cf_x86_auto", "AUTO"); + return Collections.unmodifiableMap(map); + } + + private String checkDevice(ITestDevice device) throws DeviceNotAvailableException { + String buildFlavor = device.getBuildFlavor().split("-")[0]; + return autoDic.get(buildFlavor); + } + private String getDevicesString(TestInformation testInfo) throws DeviceNotAvailableException { StringBuilder deviceString = new StringBuilder(); int deviceNum = 0; + int companionDeviceNum = 0; for(ITestDevice device : testInfo.getDevices()) { - if (deviceNum==0) { // by default the first device is head unit. + String deviceType = checkDevice(device); + if (deviceType.equals("AUTO")) { deviceString.append(String.format(" --hu %s", device.getSerialNumber())); } else { - deviceString.append(String.format(" --phone%s %s", String.valueOf(deviceNum), device.getSerialNumber())); + companionDeviceNum++; + deviceString.append(String.format(" --phone%s %s", String.valueOf(companionDeviceNum), device.getSerialNumber())); } deviceNum++; } diff --git a/tools/catbox-tradefed/res/config/catbox-functional-admin-user-grant-permissions.xml b/tools/catbox-tradefed/res/config/catbox-functional-admin-user-grant-permissions.xml new file mode 100644 index 0000000..ea1afcd --- /dev/null +++ b/tools/catbox-tradefed/res/config/catbox-functional-admin-user-grant-permissions.xml @@ -0,0 +1,34 @@ +<!-- + Copyright (C) 2023 Google Inc. + + 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. +--> +<configuration description="Complete Automotive Tests - AdminUserGrantPermissions Functional Tests."> + <!-- Common Base --> + <include name="catbox-common"/> + + <!-- Device Preparers --> + <include name="catbox-preparer"/> + + <!-- Plan --> + <option name="plan" value=" functional_tests.catbox_functional_admin_user_grant_permissions +"/> + + <!-- Test Args --> + <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:runner:androidx.test.runner.AndroidJUnitRunner" /> + <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:package:android.platform.tests" /> + <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:no-rerun:true" /> + + <!-- Tests --> + <option name="compatibility:include-filter" value="AndroidAutomotiveAdminUserGrantPermissionsTests android.platform.tests.GrantPermissionsToNonAdminUserTest" /> +</configuration>
\ No newline at end of file diff --git a/tools/catbox-tradefed/res/config/catbox-functional-bluetooth-tests.xml b/tools/catbox-tradefed/res/config/catbox-functional-bluetooth-tests.xml index 7630707..b1dcd97 100644 --- a/tools/catbox-tradefed/res/config/catbox-functional-bluetooth-tests.xml +++ b/tools/catbox-tradefed/res/config/catbox-functional-bluetooth-tests.xml @@ -35,21 +35,8 @@ <!-- Default ABI --> <option name="compatibility:primary-abi-only" value="true" /> - <device name="auto" > - <!-- Build Provider --> - <build_provider class="com.android.compatibility.common.tradefed.build.CompatibilityBuildProvider" /> - <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller" > - <option name="test-file-name" value="AutomotiveSnippet.apk" /> - </target_preparer> - </device> - - <device name="phone"> - <!-- Build Provider --> - <build_provider class="com.android.compatibility.common.tradefed.build.CompatibilityBuildProvider" /> - <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller" > - <option name="test-file-name" value="PhoneSnippet.apk" /> - </target_preparer> - </device> + <!-- Template for Device Configuration --> + <template-include name="device-config" default="device-config/two-devices" /> <!-- CATBox Runs all modules if it is not specified. @@ -59,9 +46,9 @@ <option name="compatibility:reverse-exclude-filters" value="true" /> <test class="com.android.tradefed.testtype.mobly.MoblyBinaryHostTest"> - <!-- The mobly-par-file-name should match the module name --> + <!-- The mobly-par-file-name should match the module name , it is passed on runtime--> <!-- Timeout limit in milliseconds for all test cases of the python binary --> - <option name="mobly-test-timeout" value="180000" /> + <option name="mobly-test-timeout" value="300000" /> <!-- Testbed config file --> <option name="mobly-config-file-name" value="bt_discovery_config.yaml" /> </test> diff --git a/tools/catbox-tradefed/res/config/device-config/three-devices.xml b/tools/catbox-tradefed/res/config/device-config/three-devices.xml new file mode 100644 index 0000000..ebf0151 --- /dev/null +++ b/tools/catbox-tradefed/res/config/device-config/three-devices.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2023 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. +--> +<configuration description="Bluetooth Device Configuration For Threee Devices"> + <device name="auto" > + <!-- Build Provider --> + <build_provider class="com.android.compatibility.common.tradefed.build.CompatibilityBuildProvider" /> + <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller" > + <option name="test-file-name" value="AutomotiveSnippet.apk" /> + </target_preparer> + </device> + + <device name="phone"> + <!-- Build Provider --> + <build_provider class="com.android.compatibility.common.tradefed.build.CompatibilityBuildProvider" /> + <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller" > + <option name="test-file-name" value="PhoneSnippet.apk" /> + </target_preparer> + </device> + + <device name="phone_notpaired"> + <!-- Build Provider --> + <build_provider class="com.android.compatibility.common.tradefed.build.CompatibilityBuildProvider" /> + <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller" > + <option name="test-file-name" value="PhoneSnippet.apk" /> + </target_preparer> + </device> +</configuration>
\ No newline at end of file diff --git a/tools/catbox-tradefed/res/config/device-config/two-devices.xml b/tools/catbox-tradefed/res/config/device-config/two-devices.xml new file mode 100644 index 0000000..9c2ab57 --- /dev/null +++ b/tools/catbox-tradefed/res/config/device-config/two-devices.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2023 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. +--> +<configuration description="Bluetooth Device Configuration For Two Devices"> + <device name="auto" > + <!-- Build Provider --> + <build_provider class="com.android.compatibility.common.tradefed.build.CompatibilityBuildProvider" /> + <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller" > + <option name="test-file-name" value="AutomotiveSnippet.apk" /> + </target_preparer> + </device> + + <device name="phone"> + <!-- Build Provider --> + <build_provider class="com.android.compatibility.common.tradefed.build.CompatibilityBuildProvider" /> + <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller" > + <option name="test-file-name" value="PhoneSnippet.apk" /> + </target_preparer> + </device> +</configuration>
\ No newline at end of file |