This results in substantially smaller profiles and doesn't seem to
affect runtime.
---
 CMakeLists.txt              | 4 ++--
 framework/profile.py        | 8 ++++----
 tests/CMakeLists.no_api.txt | 6 +++---
 tests/serializer.py         | 4 +++-
 4 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index db047b4..2e870d2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -533,14 +533,14 @@ install (
 install (
        DIRECTORY tests
        DESTINATION ${PIGLIT_INSTALL_LIBDIR}
-       FILES_MATCHING REGEX 
".*\\.(xml|py|program_test|shader_test|frag|vert|geom|tesc|tese|comp|ktx|cl|txt|inc)$"
+       FILES_MATCHING REGEX 
".*\\.(xml.gz|py|program_test|shader_test|frag|vert|geom|tesc|tese|comp|ktx|cl|txt|inc)$"
        REGEX 
"CMakeFiles|CMakeLists|serializer.py|opengl.py|cl.py|quick_gl.py|glslparser.py|shader.py|quick_shader.py|no_error.py|llvmpipe_gl.py|sanity.py"
 EXCLUDE
 )
 
 install (
        DIRECTORY ${CMAKE_BINARY_DIR}/tests
        DESTINATION ${PIGLIT_INSTALL_LIBDIR}
-       FILES_MATCHING REGEX ".*\\.xml"
+       FILES_MATCHING REGEX ".*\\.xml.gz"
 )
 
 install (
diff --git a/framework/profile.py b/framework/profile.py
index 3975d06..7eefeeb 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -34,8 +34,8 @@ import ast
 import collections
 import contextlib
 import copy
+import gzip
 import importlib
-import io
 import itertools
 import multiprocessing
 import multiprocessing.dummy
@@ -318,7 +318,7 @@ class XMLProfile(object):
 
     def __len__(self):
         if not (self.filters or self.forced_test_list):
-            with io.open(self.filename, 'rt') as f:
+            with gzip.open(self.filename, 'rt') as f:
                 iter_ = et.iterparse(f, events=(b'start', ))
                 for _, elem in iter_:
                     if elem.tag == 'PiglitTestList':
@@ -333,7 +333,7 @@ class XMLProfile(object):
 
     def _itertests(self):
         """Always iterates tests instead of using the forced test_list."""
-        with io.open(self.filename, 'rt') as f:
+        with gzip.open(self.filename, 'rt') as f:
             doc = et.iterparse(f, events=(b'end', ))
             _, root = next(doc)  # get the root so we can keep clearing it
             for _, e in doc:
@@ -517,7 +517,7 @@ def load_test_profile(filename, python=None):
         if os.path.exists(meta):
             return MetaProfile(meta)
 
-        xml = os.path.join(ROOT_DIR, 'tests', name + '.xml')
+        xml = os.path.join(ROOT_DIR, 'tests', name + '.xml.gz')
         if os.path.exists(xml):
             return XMLProfile(xml)
 
diff --git a/tests/CMakeLists.no_api.txt b/tests/CMakeLists.no_api.txt
index d7f95af..3ffba74 100644
--- a/tests/CMakeLists.no_api.txt
+++ b/tests/CMakeLists.no_api.txt
@@ -45,14 +45,14 @@ add_custom_target(
 
 function(piglit_generate_xml name profile meta_target extra_args)
        add_custom_command(
-               OUTPUT ${CMAKE_BINARY_DIR}/tests/${name}.xml
-               COMMAND ${CMAKE_COMMAND} -E env 
PIGLIT_BUILD_TREE=${CMAKE_BINARY_DIR} ${PYTHON_EXECUTABLE} 
${CMAKE_CURRENT_SOURCE_DIR}/serializer.py ${name} 
${CMAKE_CURRENT_SOURCE_DIR}/${profile}.py ${CMAKE_BINARY_DIR}/tests/${name}.xml 
 ${extra_args}
+               OUTPUT ${CMAKE_BINARY_DIR}/tests/${name}.xml.gz
+               COMMAND ${CMAKE_COMMAND} -E env 
PIGLIT_BUILD_TREE=${CMAKE_BINARY_DIR} ${PYTHON_EXECUTABLE} 
${CMAKE_CURRENT_SOURCE_DIR}/serializer.py ${name} 
${CMAKE_CURRENT_SOURCE_DIR}/${profile}.py 
${CMAKE_BINARY_DIR}/tests/${name}.xml.gz  ${extra_args}
                DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${profile}.py 
${CMAKE_CURRENT_SOURCE_DIR}/serializer.py ${ARGN}
                VERBATIM
        )
        add_custom_target(
                generate-${name}-xml
-               DEPENDS ${CMAKE_BINARY_DIR}/tests/${name}.xml
+               DEPENDS ${CMAKE_BINARY_DIR}/tests/${name}.xml.gz
        )
        add_dependencies(${meta_target} generate-${name}-xml)
 endfunction()
diff --git a/tests/serializer.py b/tests/serializer.py
index 58b3a14..32beb42 100644
--- a/tests/serializer.py
+++ b/tests/serializer.py
@@ -22,6 +22,7 @@
 """Script for taking profiles in python format and serializing them to XML."""
 
 import argparse
+import gzip
 import os
 import sys
 import xml.etree.cElementTree as et
@@ -133,7 +134,8 @@ def serializer(name, profile, outfile):
                 et.SubElement(env, 'env', name=k, value=v)
 
     tree = et.ElementTree(root)
-    tree.write(outfile, encoding='utf-8', xml_declaration=True)
+    with gzip.open(outfile, 'wb') as f:
+        tree.write(f, encoding='utf-8', xml_declaration=True)
 
 
 def main():
-- 
git-series 0.9.1
_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to