Create a tarball with the results of the testing.
authorIgor Stoppa <igor.stoppa@intel.com>
Mon, 16 Jun 2014 10:51:33 +0000 (13:51 +0300)
committerLin A Yang <lin.a.yang@intel.com>
Mon, 7 Jul 2014 09:09:07 +0000 (12:09 +0300)
Change-Id: Iebbbee94306e11a616fb3da2daa00fa3458eb968

job_test_build.py

index fb6c1e3..9187ecc 100755 (executable)
@@ -5,6 +5,7 @@
 import os
 import sys
 import glob
+import tarfile
 import subprocess
 from common.buildtrigger import trigger_info
 
@@ -55,6 +56,20 @@ def test_image(image):
     dump_result(result, image)
     return result
 
+def pack_results(results_folder):
+    """Creates a tarball containing the test results"""
+    if not results_folder:
+        return
+    print "Packing test results ... ",
+    try:
+        tar = tarfile.open("results.tar.gz", "w:gz")
+        tar.add(results_folder)
+    except (ValueError, OSError) as error:
+        print "failed."
+        print error
+    else:
+        print "done."
+
 def main():
     """The main body"""
     # Note: the script, by design, will not return errors
@@ -68,7 +83,7 @@ def main():
         return
 
     dump_result(test_image(image), image)
-
+    pack_results(glob.glob("tztestrobot-results.*")[0])
 
 if __name__ == "__main__":
     sys.exit(main())