[Piglit] [PATCH 1/2] framework: Fix standalone execution of glsl_parser_test.py
Fabian Bieler
fabianbieler at fastmail.fm
Wed Feb 26 13:10:08 PST 2014
This is usefull when writing new tests using the glslparser framework.
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)
--
1.8.3.2
More information about the Piglit
mailing list