[Piglit] [PATCH 28/45] gen_texture_query_lod_tests.py: move file generation up in loop

Dylan Baker baker.dylan.c at gmail.com
Wed Nov 12 15:46:10 PST 2014


This moves the directory name generation and existence checking/creation
out of two loops, and allowing for more reuse.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 generated_tests/gen_texture_query_lod_tests.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/generated_tests/gen_texture_query_lod_tests.py b/generated_tests/gen_texture_query_lod_tests.py
index 00eb007..03cc13f 100644
--- a/generated_tests/gen_texture_query_lod_tests.py
+++ b/generated_tests/gen_texture_query_lod_tests.py
@@ -117,20 +117,20 @@ def main():
     """Main function."""
     for api, requirement in REQUIREMENTS.iteritems():
         lod = 'Lod' if api == 'glsl-4.00' else 'LOD'
+        dirname = os.path.join("spec", api.lower(), "compiler",
+                               "built-in-functions")
+        if not os.path.exists(dirname):
+            os.makedirs(dirname)
 
         for sampler_type, coord_type in SAMPLER_TYPE_TO_COORD_TYPE.iteritems():
             for execution_stage in ("vs", "fs"):
                 file_extension = 'frag' if execution_stage == 'fs' else 'vert'
                 filename = os.path.join(
-                    "spec", api.lower(), "compiler", "built-in-functions",
+                    dirname,
                     "textureQuery{0}-{1}.{2}".format(lod, sampler_type,
                                                      file_extension))
                 print(filename)
 
-                dirname = os.path.dirname(filename)
-                if not os.path.exists(dirname):
-                    os.makedirs(dirname)
-
                 version = requirement['version']
                 extensions = [requirement['extension']] if requirement['extension'] else []
 
-- 
2.1.3



More information about the Piglit mailing list