[Piglit] [PATCH 7/8] framework: Add a vulkan tests profile

Dylan Baker dylan at pnwbakers.com
Thu Apr 5 18:18:32 UTC 2018


Quoting Neil Roberts (2018-04-04 15:56:54)
> 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. """
> +

future imports please

> +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)

With how minimal this is you might just put in in piglit_test, shader and glsl
parser are split out for historical reasons and because the parsers are
gigantic. But I don't care either way.

> 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."""

future imports here as well.

> +
> +import os
> +
> +from framework.profile import TestProfile
> +from framework.test import PiglitCLTest

unused import

otherwise this is:
Reviewed-by: Dylan Baker <dylan at pnwbakers.com>

> +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
> 
> _______________________________________________
> 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/20180405/1f3c21af/attachment.sig>


More information about the Piglit mailing list