Split DeviceFuncTests out of FuncTests

Split tests that requires a device and those that don't

Test: run_tradefed_func_tests.sh
Bug: 63834732
Change-Id: I7a431ec8360be90cc342432bdbde47468efdf132
diff --git a/tests/run_tradefed_func_tests.sh b/tests/run_tradefed_func_tests.sh
index 50ff881..b0a5845 100755
--- a/tests/run_tradefed_func_tests.sh
+++ b/tests/run_tradefed_func_tests.sh
@@ -14,18 +14,21 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# A simple helper script that runs the Trade Federation unit tests
+# A simple helper script that runs the Trade Federation func tests
 
 TF_DIR=`dirname $0`/..
 
 TEST_CLASS="com.android.tradefed.FuncTests"
+DEVICE_TEST_CLASS="com.android.tradefed.DeviceFuncTests"
+
+CLASS_FILTER="--class ${TEST_CLASS} --class ${DEVICE_TEST_CLASS}"
 
 FORWARDED_ARGS=()
 while [[ $# -gt 0 ]]; do
   next="$1"
   case ${next} in
   --class)
-    TEST_CLASS="$2"
+    CLASS_FILTER="--class $2"
     shift
     ;;
   *)
@@ -36,6 +39,6 @@
 done
 
 
-${TF_DIR}/tradefed.sh run singleCommand host -n \
+${TF_DIR}/tradefed.sh run singleCommand host \
   --console-result-reporter:suppress-passed-tests \
-  --class ${TEST_CLASS} ${FORWARDED_ARGS[*]}
+  ${CLASS_FILTER} ${FORWARDED_ARGS[*]}
diff --git a/tests/src/com/android/tradefed/DeviceFuncTests.java b/tests/src/com/android/tradefed/DeviceFuncTests.java
new file mode 100644
index 0000000..000f8fa
--- /dev/null
+++ b/tests/src/com/android/tradefed/DeviceFuncTests.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+package com.android.tradefed;
+
+import com.android.tradefed.device.TestDeviceFuncTest;
+import com.android.tradefed.proto.PlatformProtosFuncTest;
+import com.android.tradefed.targetprep.AppSetupFuncTest;
+import com.android.tradefed.targetprep.DeviceSetupFuncTest;
+import com.android.tradefed.targetprep.UserCleanerFuncTest;
+import com.android.tradefed.testtype.DeviceSuite;
+import com.android.tradefed.testtype.InstrumentationTestFuncTest;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+/** A test suite for all Trade Federation functional tests that requires a device. */
+@RunWith(DeviceSuite.class)
+@SuiteClasses({
+    // device
+    TestDeviceFuncTest.class,
+    // proto
+    PlatformProtosFuncTest.class,
+    // targetprep
+    AppSetupFuncTest.class,
+    DeviceSetupFuncTest.class,
+    UserCleanerFuncTest.class,
+    // testtype
+    InstrumentationTestFuncTest.class,
+})
+public class DeviceFuncTests {}
diff --git a/tests/src/com/android/tradefed/FuncTests.java b/tests/src/com/android/tradefed/FuncTests.java
index dbf9b45..2d89296 100644
--- a/tests/src/com/android/tradefed/FuncTests.java
+++ b/tests/src/com/android/tradefed/FuncTests.java
@@ -18,14 +18,7 @@
 import com.android.tradefed.build.FileDownloadCacheFuncTest;
 import com.android.tradefed.command.CommandSchedulerFuncTest;
 import com.android.tradefed.command.remote.RemoteManagerFuncTest;
-import com.android.tradefed.device.TestDeviceFuncTest;
 import com.android.tradefed.device.metric.DeviceMetricDataFuncTest;
-import com.android.tradefed.proto.PlatformProtosFuncTest;
-import com.android.tradefed.targetprep.AppSetupFuncTest;
-import com.android.tradefed.targetprep.DeviceSetupFuncTest;
-import com.android.tradefed.targetprep.UserCleanerFuncTest;
-import com.android.tradefed.testtype.DeviceSuite;
-import com.android.tradefed.testtype.InstrumentationTestFuncTest;
 import com.android.tradefed.util.FileUtilFuncTest;
 import com.android.tradefed.util.GCSBucketUtilFuncTest;
 import com.android.tradefed.util.GCSFileDownloaderFuncTest;
@@ -33,14 +26,11 @@
 import com.android.tradefed.util.net.HttpHelperFuncTest;
 
 import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
 import org.junit.runners.Suite.SuiteClasses;
 
-/**
- * A test suite for all Trade Federation functional tests.
- *
- * <p>This suite requires a device.
- */
-@RunWith(DeviceSuite.class)
+/** A test suite for all Trade Federation functional tests that do not require a device. */
+@RunWith(Suite.class)
 @SuiteClasses({
     // build
     FileDownloadCacheFuncTest.class,
@@ -48,24 +38,12 @@
     CommandSchedulerFuncTest.class,
     // command.remote
     RemoteManagerFuncTest.class,
-    // device
-    TestDeviceFuncTest.class,
     // device.metric
     DeviceMetricDataFuncTest.class,
-    // proto
-    PlatformProtosFuncTest.class,
-    // targetprep
-    AppSetupFuncTest.class,
-    DeviceSetupFuncTest.class,
-    UserCleanerFuncTest.class,
-    // testtype
-    InstrumentationTestFuncTest.class,
     // util
     FileUtilFuncTest.class,
     GCSFileDownloaderFuncTest.class,
     GCSBucketUtilFuncTest.class,
-    // TODO: temporarily remove from suite until we figure out how to install gtest data
-    //this.addTestSuite(GTestFuncTest.class);
     HttpHelperFuncTest.class,
     RunUtilFuncTest.class,
 })