[Piglit] [PATCH 1/2] framework: Fix standalone execution of glsl_parser_test.py
Dylan Baker
baker.dylan.c at gmail.com
Wed Feb 26 14:43:07 PST 2014
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.
>
> 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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140226/162b0e8a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140226/162b0e8a/attachment.pgp>
More information about the Piglit
mailing list