Add a checker to help optimizing sharding
Test: presubmit
Bug: 201822981
Change-Id: I6e85936fa7eff419e86579e48bac231f26fa7cb2
diff --git a/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/CtsConfigLoadingTest.java b/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/CtsConfigLoadingTest.java
index 7946a21..8e2eba2 100644
--- a/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/CtsConfigLoadingTest.java
+++ b/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/CtsConfigLoadingTest.java
@@ -33,6 +33,7 @@
import com.android.tradefed.targetprep.DeviceSetup;
import com.android.tradefed.targetprep.ITargetPreparer;
import com.android.tradefed.testtype.AndroidJUnitTest;
+import com.android.tradefed.testtype.GTest;
import com.android.tradefed.testtype.HostTest;
import com.android.tradefed.testtype.IRemoteTest;
import com.android.tradefed.testtype.ITestFilterReceiver;
@@ -262,6 +263,13 @@
config.getName(), test));
}
}
+ if (test instanceof GTest) {
+ if (((GTest) test).isRebootBeforeTestEnabled()) {
+ throw new ConfigurationException(String.format(
+ "%s: instead of reboot-before-test use a RebootTargetPreparer "
+ + "which is more optimized during sharding.", config.getName()));
+ }
+ }
// Tests are expected to implement that interface.
if (!(test instanceof ITestFilterReceiver)) {
throw new IllegalArgumentException(String.format(