[gnome-continuous-yocto/gnomeostree-3.28-rocko: 7379/8267] buildhistory.bbclass: add ptest



commit 5f6945f5031e1a4ca116cc1eccf4c2f9dc228547
Author: Robert Yang <liezhi yang windriver com>
Date:   Mon Aug 21 18:23:13 2017 -0700

    buildhistory.bbclass: add ptest
    
    The ptest log will be saved to buildhistory/ptest, we can easily get
    the regression result between builds by:
    
    $ git show HEAD ptest/pass.fail.skip.*
    
    [YOCTO #11547]
    
    (From OE-Core rev: dcb6cd19fb8c639cb844d116fb83827267f37421)
    
    Signed-off-by: Robert Yang <liezhi yang windriver com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 meta/classes/buildhistory.bbclass |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index a3e4c7a..dbfcc05 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -912,3 +912,33 @@ def write_latest_srcrev(d, pkghistdir):
     else:
         if os.path.exists(srcrevfile):
             os.remove(srcrevfile)
+
+do_testimage[postfuncs] += "write_ptest_result"
+do_testimage[vardepsexclude] += "write_ptest_result"
+
+python write_ptest_result() {
+    write_latest_ptest_result(d, d.getVar('BUILDHISTORY_DIR'))
+}
+
+def write_latest_ptest_result(d, histdir):
+    import glob
+    import subprocess
+    test_log_dir = d.getVar('TEST_LOG_DIR')
+    input_ptest = os.path.join(test_log_dir, 'ptest_log')
+    output_ptest = os.path.join(histdir, 'ptest')
+    if os.path.exists(input_ptest):
+        try:
+            # Lock it avoid race issue
+            lock = bb.utils.lockfile(output_ptest + "/ptest.lock")
+            bb.utils.mkdirhier(output_ptest)
+            oe.path.copytree(input_ptest, output_ptest)
+            # Sort test result
+            for result in glob.glob('%s/pass.fail.*' % output_ptest):
+                bb.debug(1, 'Processing %s' % result)
+                cmd = ['sort', result, '-o', result]
+                bb.debug(1, 'Running %s' % cmd)
+                ret = subprocess.call(cmd)
+                if ret != 0:
+                    bb.error('Failed to run %s!' % cmd)
+        finally:
+            bb.utils.unlockfile(lock)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]