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 <[email protected]>
> ---
>  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)

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to