When extra_args aren't set in piglit.conf and the envrionment variable isn't set either, there is a bug that causes the deqp tests to not run. This patch corrects that by providing a mechanism for setting an appropriate fallback value.
Signed-off-by: Dylan Baker <dylanx.c.ba...@intel.com> --- framework/test/deqp.py | 6 +++--- framework/tests/deqp_tests.py | 9 +++++++++ tests/deqp_gles2.py | 3 ++- tests/deqp_gles3.py | 4 +++- tests/deqp_gles31.py | 3 ++- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/framework/test/deqp.py b/framework/test/deqp.py index a63611d..843cde8 100644 --- a/framework/test/deqp.py +++ b/framework/test/deqp.py @@ -46,10 +46,10 @@ def make_profile(test_list, test_class): return profile -def get_option(env_varname, config_option): +def get_option(env_varname, config_option, default=None): """Query the given environment variable and then piglit.conf for the option. - Return None if the option is unset. + Return the value of the default argument if opt is None. """ opt = os.environ.get(env_varname, None) @@ -58,7 +58,7 @@ def get_option(env_varname, config_option): opt = core.PIGLIT_CONFIG.safe_get(config_option[0], config_option[1]) - return opt + return opt or default def gen_caselist_txt(bin_, caselist): diff --git a/framework/tests/deqp_tests.py b/framework/tests/deqp_tests.py index d472c75..1225523 100644 --- a/framework/tests/deqp_tests.py +++ b/framework/tests/deqp_tests.py @@ -59,6 +59,15 @@ def test_get_option_conf(): @utils.set_env(_PIGLIT_TEST_ENV=None) +def test_get_option_default(): + """deqp.get_option: default value is returned when env and conf are unset + """ + nt.eq_(deqp.get_option('_PIGLIT_TEST_ENV', ('deqp_test', 'test_env'), + 'foobar'), + 'foobar') + + +@utils.set_env(_PIGLIT_TEST_ENV=None) def test_get_option_conf_no_section(): """deqp.get_option: if a no_section error is raised and env is unset None is return """ diff --git a/tests/deqp_gles2.py b/tests/deqp_gles2.py index 0b7fbd3..b97cb5d 100644 --- a/tests/deqp_gles2.py +++ b/tests/deqp_gles2.py @@ -33,7 +33,8 @@ _DEQP_GLES2_BIN = deqp.get_option('PIGLIT_DEQP_GLES2_BIN', class DEQPGLES2Test(deqp.DEQPBaseTest): deqp_bin = _DEQP_GLES2_BIN extra_args = deqp.get_option('PIGLIT_DEQP_GLES2_EXTRA_ARGS', - ('deqp-gles2', 'extra_args')).split() or [] + ('deqp-gles2', 'extra_args'), + default='').split() profile = deqp.make_profile( # pylint: disable=invalid-name diff --git a/tests/deqp_gles3.py b/tests/deqp_gles3.py index 574a5e5..dfb82c9 100644 --- a/tests/deqp_gles3.py +++ b/tests/deqp_gles3.py @@ -74,7 +74,9 @@ def filter_mustpass(caselist_path): class DEQPGLES3Test(deqp.DEQPBaseTest): deqp_bin = _DEQP_GLES3_EXE extra_args = deqp.get_option('PIGLIT_DEQP_GLES3_EXTRA_ARGS', - ('deqp-gles3', 'extra_args')).split() or [] + ('deqp-gles3', 'extra_args'), + default='').split() + def __init__(self, *args, **kwargs): super(DEQPGLES3Test, self).__init__(*args, **kwargs) diff --git a/tests/deqp_gles31.py b/tests/deqp_gles31.py index ba148f8..423c1bf 100644 --- a/tests/deqp_gles31.py +++ b/tests/deqp_gles31.py @@ -33,7 +33,8 @@ _DEQP_GLES31_BIN = deqp.get_option('PIGLIT_DEQP_GLES31_BIN', class DEQPGLES31Test(deqp.DEQPBaseTest): deqp_bin = _DEQP_GLES31_BIN extra_args = deqp.get_option('PIGLIT_DEQP_GLES31_EXTRA_ARGS', - ('deqp-gles31', 'extra_args')).split() or [] + ('deqp-gles31', 'extra_args'), + default='').split() profile = deqp.make_profile( # pylint: disable=invalid-name -- 2.4.3 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit