[Piglit] [PATCH v2] framework: Add a vulkan tests profile

Dylan Baker dylan at pnwbakers.com
Fri Apr 6 17:40:22 UTC 2018


Looks good, thank you!

Quoting Neil Roberts (2018-04-06 05:19:57)
> This searches for files named *.vk_shader_test in the tests/vulkan
> directory and runs them with VkRunner.
> 
> Reviewed-by: Dylan Baker <dylan at pnwbakers.com>
> 
> v2: Move VkShaderTest to piglit_test.py and rename to VkRunnerTest.
>     Add future imports. Remove unused import.
> ---
>  framework/test/piglit_test.py | 10 ++++++++++
>  tests/vulkan.py               | 33 +++++++++++++++++++++++++++++++++
>  2 files changed, 43 insertions(+)
>  create mode 100644 tests/vulkan.py
> 
> diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
> index b6cec71cd..d7767cb8b 100644
> --- a/framework/test/piglit_test.py
> +++ b/framework/test/piglit_test.py
> @@ -44,6 +44,7 @@ __all__ = [
>      'PiglitCLTest',
>      'PiglitGLTest',
>      'PiglitBaseTest',
> +    'VkRunnerTest',
>      'CL_CONCURRENT',
>      'TEST_BIN_DIR',
>  ]
> @@ -184,3 +185,12 @@ class PiglitCLTest(PiglitBaseTest):  # pylint: disable=too-few-public-methods
>      """
>      def __init__(self, command, run_concurrent=CL_CONCURRENT, **kwargs):
>          super(PiglitCLTest, self).__init__(command, run_concurrent, **kwargs)
> +
> +
> +class VkRunnerTest(PiglitBaseTest):
> +    """ Make a PiglitTest instance for a VkRunner shader test file """
> +
> +    def __init__(self, filename):
> +        super(VkRunnerTest, self).__init__(
> +            ['vkrunner', filename],
> +            run_concurrent=True)
> 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
> -- 
> 2.14.3
> 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20180406/5fa2e165/attachment.sig>


More information about the Piglit mailing list