[Piglit] [PATCH 7/8] framework: Add a vulkan tests profile
Neil Roberts
nroberts at igalia.com
Wed Apr 4 22:56:54 UTC 2018
This searches for files named *.vk_shader_test in the tests/vulkan
directory and runs them with VkRunner.
---
framework/test/vk_shader_test.py | 39 +++++++++++++++++++++++++++++++++++++++
tests/vulkan.py | 30 ++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+)
create mode 100644 framework/test/vk_shader_test.py
create mode 100644 tests/vulkan.py
diff --git a/framework/test/vk_shader_test.py b/framework/test/vk_shader_test.py
new file mode 100644
index 000000000..e6eab0e15
--- /dev/null
+++ b/framework/test/vk_shader_test.py
@@ -0,0 +1,39 @@
+# Copyright (C) 2018 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation
+# files (the "Software"), to deal in the Software without
+# restriction, including without limitation the rights to use,
+# copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following
+# conditions:
+#
+# This permission notice shall be included in all copies or
+# substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR(S) BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+""" This module enables running VkRunner shader tests. """
+
+from .piglit_test import PiglitBaseTest
+
+__all__ = [
+ 'VkShaderTest',
+]
+
+
+class VkShaderTest(PiglitBaseTest):
+ """ Make a PiglitTest instance for a VkRunner shader test file """
+
+ def __init__(self, filename):
+ super(VkShaderTest, self).__init__(
+ ['vkrunner', filename],
+ run_concurrent=True)
diff --git a/tests/vulkan.py b/tests/vulkan.py
new file mode 100644
index 000000000..e9c48f6a4
--- /dev/null
+++ b/tests/vulkan.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""All Vulkan tests that come with piglit, using default settings."""
+
+import os
+
+from framework.profile import TestProfile
+from framework.test import PiglitCLTest
+from framework import grouptools
+from framework.test.vk_shader_test import VkShaderTest
+from .py_modules.constants import TESTS_DIR, GENERATED_TESTS_DIR
+
+__all__ = ['profile']
+
+profile = TestProfile()
+
+# Find and add all shader tests.
+for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
+ _basedir = os.path.join(basedir, 'vulkan')
+ for dirpath, _, filenames in os.walk(_basedir):
+ groupname = grouptools.from_path(os.path.relpath(dirpath, _basedir))
+ for filename in filenames:
+ testname, ext = os.path.splitext(filename)
+ if ext != '.vk_shader_test':
+ continue
+ test = VkShaderTest(os.path.join(dirpath, filename))
+ group = grouptools.join(groupname, testname)
+ assert group not in profile.test_list, group
+
+ profile.test_list[group] = test
--
2.14.3
More information about the Piglit
mailing list