Add GPU kevin Skylab bot

Adds a copy of the existing GPU kevin bot that triggers tests in Skylab
instead of via swarming.

Bug: 1363802
Change-Id: Id0566c2155033ed10a4cd39d5c0b51912a424d91
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3905216
Reviewed-by: Struan Shrimpton <[email protected]>
Commit-Queue: Brian Sheedy <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1051389}
diff --git a/testing/buildbot/generate_buildbot_json.py b/testing/buildbot/generate_buildbot_json.py
index bbdae68..b87166ee 100755
--- a/testing/buildbot/generate_buildbot_json.py
+++ b/testing/buildbot/generate_buildbot_json.py
@@ -108,6 +108,18 @@
     return sorted(tests, key=lambda x: x['name'])
 
 
+class SkylabGPUTelemetryTestGenerator(GPUTelemetryTestGenerator):
+  def generate(self, *args, **kwargs):
+    # This should be identical to a regular GPU Telemetry test, but with any
+    # swarming arguments removed.
+    isolated_scripts = super(SkylabGPUTelemetryTestGenerator,
+                             self).generate(*args, **kwargs)
+    for test in isolated_scripts:
+      if 'swarming' in test:
+        test['swarming'] = {'can_use_on_swarming_builders': False}
+    return isolated_scripts
+
+
 class GTestGenerator(BaseGenerator):
   def __init__(self, bb_gen):
     super(GTestGenerator, self).__init__(bb_gen)
@@ -916,14 +928,15 @@
       'gpu_vendor_id': '0',
       'gpu_device_id': '0',
     }
-    dimension_set = swarming_config['dimension_sets'][0]
-    if 'gpu' in dimension_set:
-      # First remove the driver version, then split into vendor and device.
-      gpu = dimension_set['gpu']
-      if gpu != 'none':
-        gpu = gpu.split('-')[0].split(':')
-        substitutions['gpu_vendor_id'] = gpu[0]
-        substitutions['gpu_device_id'] = gpu[1]
+    if swarming_config.get('dimension_sets'):
+      dimension_set = swarming_config['dimension_sets'][0]
+      if 'gpu' in dimension_set:
+        # First remove the driver version, then split into vendor and device.
+        gpu = dimension_set['gpu']
+        if gpu != 'none':
+          gpu = gpu.split('-')[0].split(':')
+          substitutions['gpu_vendor_id'] = gpu[0]
+          substitutions['gpu_device_id'] = gpu[1]
     return [string.Template(arg).safe_substitute(substitutions) for arg in args]
 
   def generate_gpu_telemetry_test(self, waterfall, tester_name, tester_config,
@@ -1032,6 +1045,8 @@
         ScriptGenerator(self),
         'skylab_tests':
         SkylabGenerator(self),
+        'skylab_gpu_telemetry_tests':
+        SkylabGPUTelemetryTestGenerator(self),
     }
 
   def get_test_type_remapper(self):
@@ -1041,6 +1056,9 @@
         'android_webview_gpu_telemetry_tests': 'isolated_scripts',
         'cast_streaming_tests': 'isolated_scripts',
         'gpu_telemetry_tests': 'isolated_scripts',
+        # These are the same as existing test types, just configured to run
+        # in Skylab instead of via normal swarming.
+        'skylab_gpu_telemetry_tests': 'skylab_tests',
     }
 
   def check_composition_type_test_suites(self, test_type,