Check runners in device-tests too

Test: unit tests
Bug: 150008527
Change-Id: Ia0f2761c95b8005ba4fed152b4102321ef199a31
diff --git a/tests/src/com/android/tradefed/presubmit/DeviceTestsConfigValidation.java b/tests/src/com/android/tradefed/presubmit/DeviceTestsConfigValidation.java
index aa94674..f84f7b8 100644
--- a/tests/src/com/android/tradefed/presubmit/DeviceTestsConfigValidation.java
+++ b/tests/src/com/android/tradefed/presubmit/DeviceTestsConfigValidation.java
@@ -76,6 +76,8 @@
                 // All configurations in device-tests.zip should be module since they are generated
                 // from AndroidTest.xml
                 ValidateSuiteConfigHelper.validateConfig(c);
+                // Check that all the tests runners are well supported.
+                GeneralTestsConfigValidation.checkRunners(c.getTests());
                 // Add more checks if necessary
             } catch (ConfigurationException e) {
                 errors.add(String.format("\t%s: %s", config.getName(), e.getMessage()));
diff --git a/tests/src/com/android/tradefed/presubmit/GeneralTestsConfigValidation.java b/tests/src/com/android/tradefed/presubmit/GeneralTestsConfigValidation.java
index 1f21aa9..87c47f8 100644
--- a/tests/src/com/android/tradefed/presubmit/GeneralTestsConfigValidation.java
+++ b/tests/src/com/android/tradefed/presubmit/GeneralTestsConfigValidation.java
@@ -66,7 +66,6 @@
                             "com.android.compatibility.testtype.LibcoreTest",
                             "com.drawelements.deqp.runner.DeqpTestRunner",
                             // Tradefed runners
-                            "com.android.tradefed.testtype.InstrumentationTest",
                             "com.android.tradefed.testtype.AndroidJUnitTest",
                             "com.android.tradefed.testtype.HostTest",
                             "com.android.tradefed.testtype.GTest",
@@ -106,18 +105,9 @@
                 ValidateSuiteConfigHelper.validateConfig(c);
 
                 ensureApkUninstalled(configName, c.getTargetPreparers());
+                // Check that all the tests runners are well supported.
+                checkRunners(c.getTests());
 
-                for (IRemoteTest test : c.getTests()) {
-                    // Check that all the tests runners are well supported.
-                    if (!SUPPORTED_TEST_RUNNERS.contains(test.getClass().getCanonicalName())) {
-                        throw new ConfigurationException(
-                                String.format(
-                                        "testtype %s is not officially supported in general-tests. "
-                                                + "The supported ones are: %s",
-                                        test.getClass().getCanonicalName(),
-                                        SUPPORTED_TEST_RUNNERS));
-                    }
-                }
                 // Add more checks if necessary
             } catch (ConfigurationException e) {
                 errors.add(String.format("\t%s: %s", configName, e.getMessage()));
@@ -143,4 +133,17 @@
             }
         }
     }
+
+    public static void checkRunners(List<IRemoteTest> tests) throws ConfigurationException {
+        for (IRemoteTest test : tests) {
+            // Check that all the tests runners are well supported.
+            if (!SUPPORTED_TEST_RUNNERS.contains(test.getClass().getCanonicalName())) {
+                throw new ConfigurationException(
+                        String.format(
+                                "testtype %s is not officially supported in general-tests. "
+                                        + "The supported ones are: %s",
+                                test.getClass().getCanonicalName(), SUPPORTED_TEST_RUNNERS));
+            }
+        }
+    }
 }