[Piglit] [PATCH 1/2] utils/glslparsertest.py: Adds a small utility for running glslparsrtest
Dylan Baker
baker.dylan.c at gmail.com
Thu Feb 27 11:43:30 PST 2014
This uses the python framework for parsing a glslparsertest, and then
runs it, without the full setup of the piglit framework, logging,
reporting, concurrency, etc. This is intended as a tool for developing
glslparsertests.
Piglit does some really stupid things with output, namely it puts
stderr, stdout, and the returncode together into one string. That is a
patch for another time.
Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
CMakeLists.txt | 6 ++++++
utils/glslparsertest.py | 54 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+)
create mode 100755 utils/glslparsertest.py
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bef9c35..8b69e15 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -432,6 +432,12 @@ install (
REGEX "CMakeFiles|CMakeLists" EXCLUDE
)
+install (
+ DIRECTORY utils
+ DESTINATION .
+ USE_SOURCE_PERMISSIONS
+)
+
set (CPACK_PACKAGE_VERSION_MAJOR "1")
set (CPACK_PACKAGE_VERSION_MINOR "0")
diff --git a/utils/glslparsertest.py b/utils/glslparsertest.py
new file mode 100755
index 0000000..85d9bb3
--- /dev/null
+++ b/utils/glslparsertest.py
@@ -0,0 +1,54 @@
+#!/usr/bin/python
+# Copyright (c) 2014 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+""" Wrapper script for running glsl parser tests """
+
+from __future__ import print_function
+import sys
+import argparse
+import os.path as path
+
+# Evil to allow us to use the piglit package, which has it's root in the parent
+# directory, this must be defined before any local imports
+sys.path.append(path.abspath(path.join(path.dirname(__file__), '..')))
+
+from framework.core import Environment
+from framework.glsl_parser_test import GLSLParserTest
+
+
+def main():
+ """ Main function """
+ parser = argparse.ArgumentParser(
+ description="Small script to run glslparsertest files with a minimal "
+ "subset of the python framework.")
+ parser.add_argument("test",
+ help="A file to pass to glslparsertest")
+ args = parser.parse_args()
+
+ assert path.splitext(args.test)[1] in ['.vert', '.geom', '.frag']
+
+ test = GLSLParserTest(args.test)
+ results = test.run(Environment())
+ print('result: {result}\n{info}'.format(**results))
+
+
+if __name__ == "__main__":
+ main()
--
1.9.0
More information about the Piglit
mailing list