[Piglit] [PATCH 1/2] framework: Fix standalone execution of glsl_parser_test.py

Ilia Mirkin imirkin at alum.mit.edu
Wed Feb 26 14:51:46 PST 2014


On Wed, Feb 26, 2014 at 5:43 PM, Dylan Baker <baker.dylan.c at gmail.com> wrote:
> On Wednesday, February 26, 2014 22:10:08 Fabian Bieler wrote:
>
>> This is usefull when writing new tests using the glslparser framework.
>
>
>
> Dang, someone actually uses this...thing. I actually have patches on the
> list to remove it.
>
>
>
> I know that you're trying to solve the problem of running this from the
> framework folder, a la:
>
> cd framework
>
> ./glsl_parser_test.py foo
>
>
>
> But it's making this module even more of a nightmare than it already is.
> idiomatically this is scary stuff.
>
>
>
> I think it would be better to write a little wrapper script that lives in
> the piglit root that can run tests standalone, perferably both shader_tests
> and glsl_parser_tests. I'd be willing to code something up to do that.

Not sure what the glsl_parser_test situation is, but for shader_test,
I always just do

bin/shader_runner tests/spec/bla.shader_test -auto

A wrapper script would not significantly improve on this, I think.

>
>>
>
>> Signed-off-by: Fabian Bieler <fabianbieler at fastmail.fm>
>
>> ---
>
>> framework/glsl_parser_test.py | 11 ++++++++++-
>
>> 1 file changed, 10 insertions(+), 1 deletion(-)
>
>>
>
>> diff --git a/framework/glsl_parser_test.py b/framework/glsl_parser_test.py
>
>> index 82292b5..9b6ff24 100755
>
>> --- a/framework/glsl_parser_test.py
>
>> +++ b/framework/glsl_parser_test.py
>
>> @@ -31,6 +31,14 @@ standalone tests on the command line. To add a test to
>> a
>
>> Piglit group, us
>
>>
>
>> usage_message = "usage: glsl_parser_test.py TEST_FILE"
>
>>
>
>> +if __name__ == '__main__':
>
>> + import sys
>
>> + import os.path as path
>
>> + sys.path.insert(1, path.join(sys.path[0], '..'))
>
>> + from framework import glsl_parser_test as self
>
>> +
>
>> + self._main()
>
>> +
>
>> import ConfigParser
>
>> import os
>
>> import os.path as path
>
>> @@ -355,6 +363,7 @@ class GLSLParserTest(PlainExecTest):
>
>> env[e] = str(self.env[e])
>
>> p = subprocess.Popen(self.command, env=env)
>
>> p.communicate()
>
>> + sys.exit(p.returncode)
>
>>
>
>> @property
>
>> def config(self):
>
>> @@ -393,7 +402,7 @@ class GLSLParserTest(PlainExecTest):
>
>> def env(self):
>
>> return dict()
>
>>
>
>> -if __name__ == '__main__':
>
>> +def _main():
>
>> if len(sys.argv) != 2:
>
>> sys.stderr.write("{0}: usage error\n\n".format(sys.argv[0]))
>
>> sys.stderr.write(usage_message)
>
>
>
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>


More information about the Piglit mailing list