arb_framebuffer_object: add missing MSAA alpha-to-coverage and alpha-to-one tests
[piglit.git] / unittests / generators / test_generators.py
blob7207e2643746fe3ade5b57752c559588dcb44fa0
1 # coding=utf-8
2 # Copyright (c) 2015-2016, 2019 Intel Corporation
4 # Permission is hereby granted, free of charge, to any person obtaining a copy
5 # of this software and associated documentation files (the "Software"), to deal
6 # in the Software without restriction, including without limitation the rights
7 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 # copies of the Software, and to permit persons to whom the Software is
9 # furnished to do so, subject to the following conditions:
11 # The above copyright notice and this permission notice shall be included in
12 # all copies or substantial portions of the Software.
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 # SOFTWARE.
22 """Generate tests for running the generators.
24 This needs to be compatible with both python2 and python3.
26 Tests that take more than ~10 seconds should be marked as "slow" and tests that
27 take more than ~30 seconds should be marked as "very_slow".
28 """
30 import importlib
31 from unittest import mock
33 import pytest
36 @pytest.mark.parametrize('name', [
37 'gen_builtin_packing_tests',
38 'gen_builtin_uniform_tests_fp64',
39 'gen_cl_common_builtins',
40 'gen_cl_int_builtins',
41 'gen_cl_math_builtins',
42 'gen_cl_relational_builtins',
43 'gen_cl_shuffle2_builtins',
44 'gen_cl_shuffle_builtins',
45 'gen_cl_store_tests',
46 'gen_cl_vload_tests',
47 'gen_cl_vstore_tests',
48 'gen_const_builtin_equal_tests',
49 'gen_constant_array_size_tests_fp64',
50 'gen_conversion',
51 'gen_extensions_defined',
52 'gen_flat_interpolation_qualifier',
53 'gen_inout_fp64',
54 'gen_interpolation_tests',
55 'gen_non-lvalue_tests',
56 'gen_outerproduct_invalid_params',
57 'gen_outerproduct_tests',
58 'gen_shader_bit_encoding_tests',
59 'gen_shader_framebuffer_fetch_tests',
60 'gen_shader_image_load_store_tests',
61 'gen_shader_image_nv_image_formats_tests',
62 'gen_shader_intel_conservative_rasterization',
63 'gen_shader_precision_tests',
64 'gen_tcs_input_tests',
65 'gen_tes_input_tests',
66 'gen_texture_lod_tests',
67 'gen_texture_query_lod_tests',
68 'gen_uniform_initializer_tests',
69 'gen_variable_index_read_tests',
70 'gen_variable_index_write_tests',
71 'gen_vp_tex',
72 'interpolation-qualifier-built-in-variable',
73 pytest.param('gen_builtin_uniform_tests', marks=pytest.mark.slow),
74 pytest.param('gen_constant_array_size_tests', marks=pytest.mark.slow),
75 pytest.param('gen_vs_in_fp64', marks=pytest.mark.slow),
77 def test_generators(name, tmpdir):
78 """Teat each generator."""
79 mod = importlib.import_module('generated_tests.' + name)
80 tmpdir.chdir()
82 # Some tests do checks for sys.argv, so mock that out. Also mock out
83 # print since we don't want a giant list of tests printed on an error.
84 with mock.patch('sys.argv', [name]), \
85 mock.patch.object(mod, 'print', mock.Mock(), create=True):
86 mod.main()