graphics_Drm: check vk_glow

1) Add control.vk_glow_test to check vk_glow landed on CL:387199
2) Modified graphics_Drm.py to check Vulkan support before running
3) Use **kargs as input parameter for infinite args support

BUG=chromium:714967
TEST=test_that on veyron_minnie board only
CQ-DEPEND=CL:387199,CL:486161

Change-Id: I5d0d101c6d4efc78af3187a780465d3cd8c2d6eb
Reviewed-on: https://chromium-review.googlesource.com/487081
Commit-Ready: Ilja H. Friedel <ihf@chromium.org>
Tested-by: Ilja H. Friedel <ihf@chromium.org>
Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
diff --git a/client/site_tests/graphics_Drm/control.vk_glow_test b/client/site_tests/graphics_Drm/control.vk_glow_test
new file mode 100644
index 0000000..1fc6cf1
--- /dev/null
+++ b/client/site_tests/graphics_Drm/control.vk_glow_test
@@ -0,0 +1,25 @@
+# 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.
+
+NAME = 'graphics_Drm.vk_glow_test'
+AUTHOR = 'chromeos-gfx'
+PURPOSE = 'Uses drm-tests to sanity check DRM graphics output'
+CRITERIA = """
+Runs drm-tests. All tests must run without error.
+"""
+ATTRIBUTES = 'suite:graphics_per-day, suite:drm, suite:graphics, suite:graphics_system'
+TIME='FAST'
+TEST_CATEGORY = 'Functional'
+TEST_CLASS = "gl"
+TEST_TYPE = 'client'
+BUG_TEMPLATE = {
+    'components': ['OS>Kernel>Graphics'],
+}
+
+DOC = """
+Runs vk_glow.
+"""
+
+job.run_test('graphics_Drm', tag='vk_glow', cmd='vk_glow',
+             stop_ui=True, display_required=True, vulkan_required=True)
diff --git a/client/site_tests/graphics_Drm/graphics_Drm.py b/client/site_tests/graphics_Drm/graphics_Drm.py
index eb0b52f..a4b331f 100644
--- a/client/site_tests/graphics_Drm/graphics_Drm.py
+++ b/client/site_tests/graphics_Drm/graphics_Drm.py
@@ -20,6 +20,7 @@
 
     def initialize(self):
         self.GSC = graphics_utils.GraphicsStateChecker()
+        self._supported_apis = graphics_utils.GraphicsApiHelper().get_supported_apis()
         self._services = service_stopper.ServiceStopper(['ui'])
 
     def cleanup(self):
@@ -28,17 +29,32 @@
         if self._services:
             self._services.restore_services()
 
-    def run_once(self, cmd, stop_ui=True, display_required=True):
+    def run_once(self, cmd, **kargs):
+        opts = {
+            'stop_ui': True,
+            'display_required': True,
+            'vulkan_required': False,
+            'min_kernel_version': None
+        }
+        opts.update(kargs)
+
         num_displays = graphics_utils.get_num_outputs_on()
         # Sanity check to guard against incorrect silent passes.
         if num_displays == 0 and utils.get_device_type() == 'CHROMEBOOK':
             raise error.TestFail('Error: found Chromebook without display.')
-        if display_required and num_displays == 0:
+        if opts['display_required'] and num_displays == 0:
             # If a test needs a display and we don't have a display,
             # consider it a pass.
             logging.warning('No display connected, skipping test.')
             return
-        if stop_ui:
+        if opts['vulkan_required'] and 'vk' not in self._supported_apis:
+            # If a test needs vulkan to run and we don't have it,
+            # consider it a pass
+            logging.warning('Vulkan is required by test but is not available '
+                            'on system. Skipping test.')
+            return
+
+        if opts['stop_ui']:
             self._services.stop_services()
         try:
             result = utils.run(cmd,
@@ -55,4 +71,4 @@
         # Last but not least check return code and use it for triage.
         if result.exit_status != 0:
             raise error.TestFail('Failed: %s (exit=%d)' %
-                                    (cmd, result.exit_status))
+                                 (cmd, result.exit_status))