Title: [221985] trunk/Tools
Revision
221985
Author
lforsch...@apple.com
Date
2017-09-13 12:54:06 -0700 (Wed, 13 Sep 2017)

Log Message

Compress spindumps on client side before packaging into layout test results zip (mac & ios)
https://bugs.webkit.org/show_bug.cgi?id=176853

Reviewed by Aakash Jain.

* BuildSlaveSupport/test-result-archive:
(main):
(gzip_file): use gzip to compress a file, removing original
(compress_spindumps): find and compress spindumps matching a filter
(archive_test_results): refactor to snake_case
(archiveTestResults): Deleted.

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/test-result-archive (221984 => 221985)


--- trunk/Tools/BuildSlaveSupport/test-result-archive	2017-09-13 18:45:41 UTC (rev 221984)
+++ trunk/Tools/BuildSlaveSupport/test-result-archive	2017-09-13 19:54:06 UTC (rev 221985)
@@ -23,7 +23,7 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-import optparse, os, shutil, subprocess, sys
+import gzip, optparse, os, shutil, subprocess, sys
 
 sourceRootDirectory = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
 archiveFile = os.path.join(sourceRootDirectory, "layout-test-results.zip")
@@ -43,9 +43,22 @@
         parser.error("Action is required")
 
     layoutTestResultsDir = os.path.abspath(os.path.join(sourceRootDirectory, "layout-test-results"))
-    return archiveTestResults(options.configuration, options.platform, layoutTestResultsDir)
+    return archive_test_results(options.configuration, options.platform, layoutTestResultsDir)
 
-def archiveTestResults(configuration, platform, layoutTestResultsDir):
+def gzip_file(root, name):
+    with open(os.path.join(root, name), 'rb') as f_in, gzip.open(os.path.join(root, name + '.gz'), 'wb') as f_out:
+        shutil.copyfileobj(f_in, f_out)
+        os.remove(os.path.join(root, name))
+
+def compress_spindumps(layoutTestResultsDir):
+    file_patterns = ('-spindump.txt','-sample.txt')
+    for root, dirs, files in os.walk(layoutTestResultsDir):
+        for name in files:
+            for pattern in file_patterns:        
+                if pattern in name:
+                    gzip_file(root, name)
+
+def archive_test_results(configuration, platform, layoutTestResultsDir):
     assert platform in ('mac', 'win', 'gtk', 'wincairo', 'ios', 'wpe')
 
     try:
@@ -64,6 +77,7 @@
     open(os.path.join(layoutTestResultsDir, '.placeholder'), 'w').close()
 
     if platform in ('mac', 'ios'):
+        compress_spindumps(layoutTestResultsDir)
         if subprocess.call(["ditto", "-c", "-k", "--sequesterRsrc", "--zlibCompressionLevel", "2", layoutTestResultsDir, archiveFile]):
             return 1
     elif platform in ('win', 'gtk', 'wincairo', 'wpe'):

Modified: trunk/Tools/ChangeLog (221984 => 221985)


--- trunk/Tools/ChangeLog	2017-09-13 18:45:41 UTC (rev 221984)
+++ trunk/Tools/ChangeLog	2017-09-13 19:54:06 UTC (rev 221985)
@@ -1,3 +1,17 @@
+2017-09-13  Lucas Forschler  <lforsch...@apple.com>
+
+        Compress spindumps on client side before packaging into layout test results zip (mac & ios)
+        https://bugs.webkit.org/show_bug.cgi?id=176853
+
+        Reviewed by Aakash Jain.
+
+        * BuildSlaveSupport/test-result-archive:
+        (main):
+        (gzip_file): use gzip to compress a file, removing original
+        (compress_spindumps): find and compress spindumps matching a filter
+        (archive_test_results): refactor to snake_case
+        (archiveTestResults): Deleted.
+
 2017-09-13  Alex Christensen  <achristen...@webkit.org>
 
         Add WKUIDelegatePrivate equivalent of WKPageUIClient's setIsResizable, getWindowFrame, and setWindowFrame
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to