Rather than loading a file out of the tree (which might be moved,
deleted, etc.) create a temporary file and load that.

Signed-off-by: Dylan Baker <dylanx.c.ba...@intel.com>
---
 framework/tests/glsl_parser_test_tests.py | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/framework/tests/glsl_parser_test_tests.py 
b/framework/tests/glsl_parser_test_tests.py
index bb5c246..70910b7 100644
--- a/framework/tests/glsl_parser_test_tests.py
+++ b/framework/tests/glsl_parser_test_tests.py
@@ -22,6 +22,7 @@
 
 from __future__ import print_function, absolute_import
 import os
+import textwrap
 
 import nose.tools as nt
 
@@ -160,9 +161,17 @@ def test_empty_in_config():
 
 def test_glslparser_initializer():
     """test.glsl_parser_test.GLSLParserTest: clas initializes correctly"""
-    # TODO: use a tempfile and write a temporary test rather than rely on a
-    # real one
-    glsl.GLSLParserTest('tests/spec/glsl-es-1.00/compiler/version-macro.frag')
+    content = textwrap.dedent("""\
+        /*
+         * [config]
+         * expect_result: pass
+         * glsl_version: 1.10
+         * [end config]
+         */
+        """)
+
+    with utils.tempfile(content) as f:
+        glsl.GLSLParserTest(f)
 
 
 def check_config_to_command(config, result):
-- 
2.5.0

_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to