[Piglit] [PATCH 4/4] framework: Add support for serializing VkRunner tests

Neil Roberts nroberts at igalia.com
Thu Nov 8 00:52:04 UTC 2018


---
 framework/profile.py        |  4 +++-
 tests/CMakeLists.no_api.txt | 11 +++++++++++
 tests/find_static_tests.py  |  5 ++++-
 tests/serializer.py         |  7 ++++++-
 4 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/framework/profile.py b/framework/profile.py
index 8d6fd0706..b58c3a77f 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -52,7 +52,7 @@ from framework.monitoring import Monitoring
 from framework.test.base import Test, DummyTest
 from framework.test.piglit_test import (
     PiglitCLTest, PiglitGLTest, ASMParserTest, BuiltInConstantsTest,
-    CLProgramTester, ROOT_DIR,
+    CLProgramTester, VkRunnerTest, ROOT_DIR,
 )
 from framework.test.shader_test import ShaderTest, MultiShaderTest
 from framework.test.glsl_parser_test import GLSLParserTest
@@ -331,6 +331,8 @@ def make_test(element):
         return GLSLParserTest(**options)
     if type_ == 'asm_parser':
         return ASMParserTest(**options)
+    if type_ == 'vkrunner':
+        return VkRunnerTest(**options)
     if type_ == 'multi_shader':
         options['skips'] = []
         for e in element.findall('./Skips/Skip/option'):
diff --git a/tests/CMakeLists.no_api.txt b/tests/CMakeLists.no_api.txt
index 455b059d8..b25ee3242 100644
--- a/tests/CMakeLists.no_api.txt
+++ b/tests/CMakeLists.no_api.txt
@@ -42,6 +42,12 @@ add_custom_target(
 	COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/find_static_tests.py ${CMAKE_CURRENT_SOURCE_DIR} program ${CMAKE_CURRENT_BINARY_DIR}/program.list
 	VERBATIM
 )
+add_custom_target(
+	static-vkrunner-tests
+	BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/vkrunner.list
+	COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/find_static_tests.py ${CMAKE_CURRENT_SOURCE_DIR} vkrunner ${CMAKE_CURRENT_BINARY_DIR}/vkrunner.list
+	VERBATIM
+)
 
 function(piglit_generate_xml name profile meta_target extra_args)
 	add_custom_command(
@@ -72,6 +78,9 @@ piglit_generate_xml(shader.no_isolation shader gen-gl-gen-xml "--no-process-isol
 piglit_generate_xml(quick_shader.no_isolation quick_shader gen-gl-gen-xml "--no-process-isolation" gen-gl-tests static-shader-tests)
 piglit_generate_xml(no_error no_error gen-gl-gen-xml "" gen-gl-tests static-shader-tests)
 
+add_custom_target(gen-vulkan-xml)
+piglit_generate_xml(vulkan vulkan gen-vulkan-xml "" static-vkrunner-tests)
+
 add_custom_target(gen-cl-xml)
 piglit_generate_xml(cl cl gen-cl-xml "" gen-cl-tests static-program-tests)
 
@@ -86,4 +95,6 @@ if(${PIGLIT_BUILD_CL_TESTS})
 	add_dependencies(gen-xml gen-cl-xml)
 endif(${PIGLIT_BUILD_CL_TESTS})
 
+add_dependencies(gen-xml gen-vulkan-xml)
+
 # vim: ft=cmake
diff --git a/tests/find_static_tests.py b/tests/find_static_tests.py
index 795a56dc9..c5f24ca18 100644
--- a/tests/find_static_tests.py
+++ b/tests/find_static_tests.py
@@ -36,7 +36,7 @@ def main():
     parser.add_argument('sourcedir')
     parser.add_argument(
         'mode',
-        choices=['shader', 'glslparser', 'asmparser', 'program'])
+        choices=['shader', 'glslparser', 'asmparser', 'program', 'vkrunner'])
     parser.add_argument('output')
     args = parser.parse_args()
 
@@ -49,6 +49,9 @@ def main():
     elif args.mode == 'shader':
         exts = ['.shader_test']
         directory = args.sourcedir
+    elif args.mode == 'vkrunner':
+        exts = ['.vk_shader_test']
+        directory = args.sourcedir
     elif args.mode == 'program':
         exts = ['.program_test']
         directory = args.sourcedir
diff --git a/tests/serializer.py b/tests/serializer.py
index 4c3daa07b..b330eb034 100644
--- a/tests/serializer.py
+++ b/tests/serializer.py
@@ -33,7 +33,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'
 
 from framework.test.piglit_test import (
     PiglitGLTest, PiglitCLTest, ASMParserTest, BuiltInConstantsTest,
-    CLProgramTester,
+    CLProgramTester, VkRunnerTest
 )
 from framework.test.shader_test import ShaderTest, MultiShaderTest
 from framework.test.glsl_parser_test import GLSLParserTest
@@ -121,6 +121,11 @@ def serializer(name, profile, outfile):
             elem = et.SubElement(root, 'Test', type='cl', name=name)
             et.SubElement(elem, 'option', name='command', value=repr(test._command))
             continue
+        elif isinstance(test, VkRunnerTest):
+            elem = et.SubElement(root, 'Test', type='vkrunner', name=name)
+            et.SubElement(elem, 'option', name='filename',
+                          value=repr(test.filename))
+            continue
         else:
             continue
 
-- 
2.17.1



More information about the Piglit mailing list