moblab: <Hack> Split a certain CTS test module per ABI on x86_64.

To reduce the load for each single session.

BUG=b:138622686
TEST=cheets_CTS_P.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic.32
TEST=cheets_CTS_P.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic.64

Change-Id: Ieea01685ee2a852cd9cf12c8cf27e0e02f0b019b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/1752226
Tested-by: Kazuhiro Inaba <kinaba@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Li-jen Chen <lijen@google.com>
Reviewed-by: Kazuhiro Inaba <kinaba@chromium.org>
Commit-Queue: Kazuhiro Inaba <kinaba@chromium.org>
(cherry picked from commit eeb3cb382575a6222c82ea07f77fd98b3a3ef110)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/1753906
diff --git a/server/site_tests/cheets_CTS_P/control.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic b/server/site_tests/cheets_CTS_P/control.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic.32
similarity index 78%
rename from server/site_tests/cheets_CTS_P/control.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic
rename to server/site_tests/cheets_CTS_P/control.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic.32
index 464dd4f..d8a38de 100644
--- a/server/site_tests/cheets_CTS_P/control.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic
+++ b/server/site_tests/cheets_CTS_P/control.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic.32
@@ -5,7 +5,7 @@
 # This file has been automatically generated. Do not edit!
 
 AUTHOR = 'ARC++ Team'
-NAME = 'cheets_CTS_P.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic'
+NAME = 'cheets_CTS_P.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic.32'
 ATTRIBUTES = 'suite:cts_P'
 DEPENDENCIES = 'arc, cts_abi_x86'
 JOB_RETRIES = 1
@@ -13,7 +13,7 @@
 TIME = 'MEDIUM'
 MAX_RESULT_SIZE_KB = 512000
 PRIORITY = 50
-DOC = 'Run module CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic of the Android Compatibility Test Suite (CTS) using x86 ABI in the ARC++ container.'
+DOC = 'Run module CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic.32 of the Android Compatibility Test Suite (CTS) using x86 ABI in the ARC++ container.'
 
 def run_CTS(machine):
     host_list = [hosts.create_host(machine)]
@@ -22,9 +22,9 @@
         hosts=host_list,
         iterations=1,
         needs_push_media=False,
-        tag='x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic',
-        test_name='cheets_CTS_P.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic',
-        run_template=['run', 'commandAndExit', 'cts', '--include-filter', 'CtsDeqpTestCases', '--module', 'CtsDeqpTestCases', '--test', 'dEQP-VK.subgroups.arithmetic#*'],
+        tag='x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic.32',
+        test_name='cheets_CTS_P.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic.32',
+        run_template=['run', 'commandAndExit', 'cts', '--include-filter', 'CtsDeqpTestCases', '--module', 'CtsDeqpTestCases', '--test', 'dEQP-VK.subgroups.arithmetic#*', '--abi', 'x86'],
         retry_template=['run', 'commandAndExit', 'retry', '--retry', '{session_id}'],
         target_module='CtsDeqpTestCases',
         target_plan=None,
diff --git a/server/site_tests/cheets_CTS_P/control.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic b/server/site_tests/cheets_CTS_P/control.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic.64
similarity index 78%
copy from server/site_tests/cheets_CTS_P/control.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic
copy to server/site_tests/cheets_CTS_P/control.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic.64
index 464dd4f..918df4c 100644
--- a/server/site_tests/cheets_CTS_P/control.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic
+++ b/server/site_tests/cheets_CTS_P/control.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic.64
@@ -5,7 +5,7 @@
 # This file has been automatically generated. Do not edit!
 
 AUTHOR = 'ARC++ Team'
-NAME = 'cheets_CTS_P.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic'
+NAME = 'cheets_CTS_P.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic.64'
 ATTRIBUTES = 'suite:cts_P'
 DEPENDENCIES = 'arc, cts_abi_x86'
 JOB_RETRIES = 1
@@ -13,7 +13,7 @@
 TIME = 'MEDIUM'
 MAX_RESULT_SIZE_KB = 512000
 PRIORITY = 50
-DOC = 'Run module CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic of the Android Compatibility Test Suite (CTS) using x86 ABI in the ARC++ container.'
+DOC = 'Run module CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic.64 of the Android Compatibility Test Suite (CTS) using x86 ABI in the ARC++ container.'
 
 def run_CTS(machine):
     host_list = [hosts.create_host(machine)]
@@ -22,9 +22,9 @@
         hosts=host_list,
         iterations=1,
         needs_push_media=False,
-        tag='x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic',
-        test_name='cheets_CTS_P.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic',
-        run_template=['run', 'commandAndExit', 'cts', '--include-filter', 'CtsDeqpTestCases', '--module', 'CtsDeqpTestCases', '--test', 'dEQP-VK.subgroups.arithmetic#*'],
+        tag='x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic.64',
+        test_name='cheets_CTS_P.x86.CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic.64',
+        run_template=['run', 'commandAndExit', 'cts', '--include-filter', 'CtsDeqpTestCases', '--module', 'CtsDeqpTestCases', '--test', 'dEQP-VK.subgroups.arithmetic#*', '--abi', 'x86_64'],
         retry_template=['run', 'commandAndExit', 'retry', '--retry', '{session_id}'],
         target_module='CtsDeqpTestCases',
         target_plan=None,
diff --git a/server/site_tests/cheets_CTS_P/generate_controlfiles.py b/server/site_tests/cheets_CTS_P/generate_controlfiles.py
index 2d3e13f..58a5ae1 100755
--- a/server/site_tests/cheets_CTS_P/generate_controlfiles.py
+++ b/server/site_tests/cheets_CTS_P/generate_controlfiles.py
@@ -397,6 +397,15 @@
         'CtsDeqpTestCases.dEQP-VK.ycbcr'
     ]
 }
+# TODO(haddowk,kinaba): Hack for b/138622686. Clean up later.
+_EXTRA_SUBMODULE_OVERRIDE = {
+    'x86': {
+         'CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic': [
+             'CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic.32',
+             'CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic.64',
+         ]
+    }
+}
 
 _EXTRA_COMMANDLINE = {
     'CtsDeqpTestCases.dEQP-EGL': [
@@ -538,6 +547,16 @@
         '--include-filter', 'CtsDeqpTestCases', '--module', 'CtsDeqpTestCases',
         '--test', 'dEQP-VK.subgroups.arithmetic#*'
     ],
+    # TODO(haddowk,kinaba): Hack for b/138622686. Clean up later.
+    'CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic.32': [
+        '--include-filter', 'CtsDeqpTestCases', '--module', 'CtsDeqpTestCases',
+        '--test', 'dEQP-VK.subgroups.arithmetic#*', '--abi', 'x86'
+    ],
+    # TODO(haddowk,kinaba): Hack for b/138622686. Clean up later.
+    'CtsDeqpTestCases.dEQP-VK.subgroups.arithmetic.64': [
+        '--include-filter', 'CtsDeqpTestCases', '--module', 'CtsDeqpTestCases',
+        '--test', 'dEQP-VK.subgroups.arithmetic#*', '--abi', 'x86_64'
+    ],
     'CtsDeqpTestCases.dEQP-VK.subgroups.clustered': [
         '--include-filter', 'CtsDeqpTestCases', '--module', 'CtsDeqpTestCases',
         '--test', 'dEQP-VK.subgroups.clustered#*'
@@ -1010,23 +1029,32 @@
     return get_run_template(modules, is_public, retry=True)
 
 
-def get_extra_modules_dict(is_public):
+def get_extra_modules_dict(is_public, abi):
     if is_public:
+        if abi in _EXTRA_SUBMODULE_OVERRIDE:
+            new_dict  = dict()
+            for module, submodules in _PUBLIC_EXTRA_MODULES.items():
+                submodules = submodules[:]
+                for old, news in _EXTRA_SUBMODULE_OVERRIDE[abi].items():
+                    submodules.remove(old)
+                    submodules.extend(news)
+                new_dict[module] = submodules
+            return new_dict
         return _PUBLIC_EXTRA_MODULES
     return _EXTRA_MODULES
 
 
-def get_extra_modules(is_public):
-    extra_modules_dict = get_extra_modules_dict(is_public)
+def get_extra_modules(is_public, abi):
+    extra_modules_dict = get_extra_modules_dict(is_public, abi)
     modules = []
     for _, extra_modules in extra_modules_dict.items():
         modules += extra_modules
     return set(modules)
 
 
-def get_modules_to_remove(is_public):
+def get_modules_to_remove(is_public, abi):
     if is_public:
-        return get_extra_modules_dict(is_public).keys()
+        return get_extra_modules_dict(is_public, abi).keys()
     return []
 
 
@@ -1106,7 +1134,7 @@
     target_module = None
     if combined not in get_collect_modules(is_public):
         target_module = combined
-    for target, m in get_extra_modules_dict(is_public).items():
+    for target, m in get_extra_modules_dict(is_public, abi).items():
         if combined in m:
             target_module = target
     return _CONTROLFILE_TEMPLATE.render(
@@ -1140,7 +1168,7 @@
         camera_facing=camera_facing)
 
 
-def get_tradefed_data(path, is_public):
+def get_tradefed_data(path, is_public, abi):
     """Queries tradefed to provide us with a list of modules.
 
     Notice that the parsing gets broken at times with major new CTS drops.
@@ -1179,7 +1207,7 @@
             logging.warning('Ignoring "%s"', line)
     p.kill()
     p.wait()
-    for module in get_modules_to_remove(is_public):
+    for module in get_modules_to_remove(is_public, abi):
         modules.remove(module)
     return modules, build, revision
 
@@ -1399,7 +1427,7 @@
     This is used in particular by moblab to load balance. A similar approach
     was also used during bringup of grunt to split media tests.
     """
-    submodules = get_extra_modules_dict(is_public)['CtsDeqpTestCases']
+    submodules = get_extra_modules_dict(is_public, abi)['CtsDeqpTestCases']
     suites = ['suite:arc-cts-deqp', 'suite:graphics_per-day']
     if is_public:
         suites = ['suite:cts_P']
@@ -1436,7 +1464,7 @@
             bundle = os.path.join(tmp, os.path.basename(uri))
             logging.info('Extracting %s.', bundle)
             unzip(bundle, tmp)
-            modules, build, revision = get_tradefed_data(tmp, is_public)
+            modules, build, revision = get_tradefed_data(tmp, is_public, abi)
             if not revision:
                 raise Exception('Could not determine revision.')