cheets_CTS: add control files to run all tests.

Add control files to run all tests for each of the ABIs at once. This
should allow us to circumvent infra flakes, but only if the DUT is
very stable. Real results will have to come from the lab. I will
monitor DUT utilization via viceroy.

BUG=b:33186907
TEST=1) old tests still work
test_that $DUT cheets_CTS.arm.android.core.tests.libcore.package.harmony_java_math
2) new tests get run
test_that $DUT cheets_CTS.arm.all

Change-Id: I9e93605ee7fc374a3bcbfd48125a7abe70aa0482
Reviewed-on: https://chromium-review.googlesource.com/451940
Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
Tested-by: Ilja H. Friedel <ihf@chromium.org>
diff --git a/server/site_tests/cheets_CTS/cheets_CTS.py b/server/site_tests/cheets_CTS/cheets_CTS.py
index e8c5cb3..3a554e5 100644
--- a/server/site_tests/cheets_CTS/cheets_CTS.py
+++ b/server/site_tests/cheets_CTS/cheets_CTS.py
@@ -96,7 +96,7 @@
         logging.info('Cleaning up repository.')
         repository = os.path.join(self._android_cts, 'android-cts',
                 'repository')
-        for directory in ['logs', 'plans', 'results']:
+        for directory in ['logs', 'results']:
             path = os.path.join(repository, directory)
             if os.path.exists(path):
                 shutil.rmtree(path)
@@ -219,7 +219,8 @@
             if test_method is not None:
                 cmd += ['-m', test_method]
         else:
-            raise error.TestFail('Error: Need to provide an argument.')
+            logging.warning('Running all tests. This can take several days.')
+            cmd = ['run', 'commandAndExit', 'cts', '--plan', 'CTS']
         # Automated media download is broken, so disable it. Instead we handle
         # this explicitly via _push_media(). This has the benefit of being
         # cached on the dev server. b/27245577
@@ -369,7 +370,8 @@
         # Don't download media for tests that don't need it. b/29371037
         # TODO(ihf): This can be removed once the control file generator is
         # aware of this constraint.
-        if target_package.startswith('android.mediastress'):
+        if target_package is not None and target_package.startswith(
+                'android.mediastress'):
             needs_push_media = True
 
         # On dev and beta channels timeouts are sharp, lenient on stable.
@@ -398,8 +400,8 @@
             test_command = self._tradefed_run_command(
                 test_class=target_class, test_method=target_method)
         else:
-            raise error.TestFail(
-                'Error: should assign a package, a plan, or a class name')
+            test_command = self._tradefed_run_command()
+            test_name = 'all_CTS'
 
         # Unconditionally run CTS package until we see some tests executed.
         while steps < self._max_retry and total_tests == 0:
diff --git a/server/site_tests/cheets_CTS/control.arm.all b/server/site_tests/cheets_CTS/control.arm.all
new file mode 100644
index 0000000..171eef2
--- /dev/null
+++ b/server/site_tests/cheets_CTS/control.arm.all
@@ -0,0 +1,27 @@
+# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+AUTHOR = 'ARC Team'
+NAME = 'cheets_CTS.arm.all'
+ATTRIBUTES = 'suite:arc-cts-stable'
+DEPENDENCIES = 'arc'
+TEST_TYPE = 'server'
+TIME = 'LENGTHY'
+
+DOC = ('Run all tests in the Compatibility Test Suite (CTS),'
+       'using arm ABI in the ARC container.')
+
+def run_CTS(machine):
+    host = hosts.create_host(machine)
+    job.run_test(
+        'cheets_CTS',
+        host=host,
+        iterations=1,
+        tag='all',
+        bundle='arm',
+        needs_push_media=True,
+        max_retry = 9,
+        timeout=3600 * 24 * 1.5)
+
+parallel_simple(run_CTS, machines)
diff --git a/server/site_tests/cheets_CTS/control.x86.all b/server/site_tests/cheets_CTS/control.x86.all
new file mode 100644
index 0000000..3b0afb4
--- /dev/null
+++ b/server/site_tests/cheets_CTS/control.x86.all
@@ -0,0 +1,27 @@
+# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+AUTHOR = 'ARC Team'
+NAME = 'cheets_CTS.x86.all'
+ATTRIBUTES = 'suite:arc-cts-stable'
+DEPENDENCIES = 'arc, cts_abi_x86'
+TEST_TYPE = 'server'
+TIME = 'LENGTHY'
+
+DOC = ('Run all tests in the Compatibility Test Suite (CTS),'
+       'using arm ABI in the ARC container.')
+
+def run_CTS(machine):
+    host = hosts.create_host(machine)
+    job.run_test(
+        'cheets_CTS',
+        host=host,
+        iterations=1,
+        tag='all',
+        bundle='x86',
+        needs_push_media=True,
+        max_retry = 9,
+        timeout=3600 * 24 * 1.5)
+
+parallel_simple(run_CTS, machines)