summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNeil Roberts <nroberts@igalia.com>2018-04-04 23:06:37 +0200
committerNeil Roberts <nroberts@igalia.com>2018-11-07 23:29:14 +0100
commit221d924689e3bb2796cea957b8106bd14fd03e2c (patch)
treec66cbe784d7ac2762e6f3078efa2143a467be144 /tests
parent8fc34a6e875566c1cd2a0ca71971b595b1da6125 (diff)
framework: Add a vulkan tests profile
This searches for files named *.vk_shader_test in the tests/vulkan directory and runs them with VkRunner. VkRunner is executed as an external dependency. It is found either with the vkrunner:bin config option, by setting the PIGLIT_VKRUNNER_BINARY environment variable, or just in the search path. v2: Move VkShaderTest to piglit_test.py and rename to VkRunnerTest. Add future imports. Remove unused import. v3: Support the PIGLIT_VKRUNNER_BINARY variable to specify the location of VkRunner. v4: Add documentation to the README. Add an option in piglit.conf to set the binary location. (Suggested by Samuel Iglesias) Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/vulkan.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/vulkan.py b/tests/vulkan.py
new file mode 100644
index 000000000..7058f3108
--- /dev/null
+++ b/tests/vulkan.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""All Vulkan tests that come with piglit, using default settings."""
+
+from __future__ import (
+ absolute_import, division, print_function, unicode_literals
+)
+
+import os
+
+from framework.profile import TestProfile
+from framework import grouptools
+from framework.test.piglit_test import VkRunnerTest
+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 = VkRunnerTest(os.path.join(dirpath, filename))
+ group = grouptools.join(groupname, testname)
+ assert group not in profile.test_list, group
+
+ profile.test_list[group] = test