Re: [Piglit] [PATCH 2/2] framework/glslparsertest: Don't add exclude extensions to the required list
Reviewed-by: Mark Janes Dylan Baker writes: > glslparsertest has a syntax for the 'require_extensions' option that is > "!", when this is specified it means "This extensions is > not supported". There is a bug in the fast skip code in > glsl_parser_test.py that causes it to add these extensions to the fast > skip required extensions list, which is obviously wrong. > > This patch adds a test for this behavior as well as fixing the behavior > to work correctly. > > cc: Mark Janes > Signed-off-by: Dylan Baker > --- > > Mark, I hate to have to ask you to review this, but it's masking > failures in jenkins a few cases (there aren't very many tests that use > this feature, but the generator I submitted recently does). > > framework/test/glsl_parser_test.py | 3 ++- > unittests/glsl_parser_test_tests.py | 16 > 2 files changed, 18 insertions(+), 1 deletion(-) > > diff --git a/framework/test/glsl_parser_test.py > b/framework/test/glsl_parser_test.py > index ce043a7..dcce8f8 100644 > --- a/framework/test/glsl_parser_test.py > +++ b/framework/test/glsl_parser_test.py > @@ -126,7 +126,8 @@ class GLSLParserTest(FastSkipMixin, PiglitBaseTest): > > req = config.get('require_extensions') > if req: > -self.gl_required = set(req.split()) > +self.gl_required = set( > +r for r in req.split() if not r.startswith('!')) > > # If GLES is requested, but piglit was not built with a gles version, > # then ARB_ES3_compatibility is required. Add it to > diff --git a/unittests/glsl_parser_test_tests.py > b/unittests/glsl_parser_test_tests.py > index c732bec..048c5a4 100644 > --- a/unittests/glsl_parser_test_tests.py > +++ b/unittests/glsl_parser_test_tests.py > @@ -456,6 +456,22 @@ def test_set_gl_required(): > nt.eq_(test.gl_required, set(['GL_ARB_foobar', 'GL_EXT_foobar'])) > > > +def test_set_exclude_gl_required(): > +"""test.glsl_parser_test.GLSLParserTest: doesn't add excludes to > gl_required""" > +rt = {'require_extensions': 'GL_ARB_foobar !GL_EXT_foobar'} > +with mock.patch.object(glsl.GLSLParserTest, '_GLSLParserTest__parser', > + mock.Mock(return_value=rt)): > +with mock.patch.object(glsl.GLSLParserTest, > + '_GLSLParserTest__get_command', > + return_value=['foo']): > +with mock.patch('framework.test.glsl_parser_test.open', > +mock.mock_open(), create=True): > +with mock.patch('framework.test.glsl_parser_test.os.stat', > +mock.mock_open()): > +test = glsl.GLSLParserTest('foo') > +nt.eq_(test.gl_required, set(['GL_ARB_foobar'])) > + > + > @mock.patch('framework.test.glsl_parser_test._HAS_GL_BIN', False) > @nt.raises(TestIsSkip) > def test_binary_skip(): > -- > 2.8.0 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 2/2] framework/glslparsertest: Don't add exclude extensions to the required list
glslparsertest has a syntax for the 'require_extensions' option that is "!", when this is specified it means "This extensions is not supported". There is a bug in the fast skip code in glsl_parser_test.py that causes it to add these extensions to the fast skip required extensions list, which is obviously wrong. This patch adds a test for this behavior as well as fixing the behavior to work correctly. cc: Mark Janes Signed-off-by: Dylan Baker --- Mark, I hate to have to ask you to review this, but it's masking failures in jenkins a few cases (there aren't very many tests that use this feature, but the generator I submitted recently does). framework/test/glsl_parser_test.py | 3 ++- unittests/glsl_parser_test_tests.py | 16 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/framework/test/glsl_parser_test.py b/framework/test/glsl_parser_test.py index ce043a7..dcce8f8 100644 --- a/framework/test/glsl_parser_test.py +++ b/framework/test/glsl_parser_test.py @@ -126,7 +126,8 @@ class GLSLParserTest(FastSkipMixin, PiglitBaseTest): req = config.get('require_extensions') if req: -self.gl_required = set(req.split()) +self.gl_required = set( +r for r in req.split() if not r.startswith('!')) # If GLES is requested, but piglit was not built with a gles version, # then ARB_ES3_compatibility is required. Add it to diff --git a/unittests/glsl_parser_test_tests.py b/unittests/glsl_parser_test_tests.py index c732bec..048c5a4 100644 --- a/unittests/glsl_parser_test_tests.py +++ b/unittests/glsl_parser_test_tests.py @@ -456,6 +456,22 @@ def test_set_gl_required(): nt.eq_(test.gl_required, set(['GL_ARB_foobar', 'GL_EXT_foobar'])) +def test_set_exclude_gl_required(): +"""test.glsl_parser_test.GLSLParserTest: doesn't add excludes to gl_required""" +rt = {'require_extensions': 'GL_ARB_foobar !GL_EXT_foobar'} +with mock.patch.object(glsl.GLSLParserTest, '_GLSLParserTest__parser', + mock.Mock(return_value=rt)): +with mock.patch.object(glsl.GLSLParserTest, + '_GLSLParserTest__get_command', + return_value=['foo']): +with mock.patch('framework.test.glsl_parser_test.open', +mock.mock_open(), create=True): +with mock.patch('framework.test.glsl_parser_test.os.stat', +mock.mock_open()): +test = glsl.GLSLParserTest('foo') +nt.eq_(test.gl_required, set(['GL_ARB_foobar'])) + + @mock.patch('framework.test.glsl_parser_test._HAS_GL_BIN', False) @nt.raises(TestIsSkip) def test_binary_skip(): -- 2.8.0 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit