summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/buildhistory.bbclass30
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):
912 else: 912 else:
913 if os.path.exists(srcrevfile): 913 if os.path.exists(srcrevfile):
914 os.remove(srcrevfile) 914 os.remove(srcrevfile)
915
916do_testimage[postfuncs] += "write_ptest_result"
917do_testimage[vardepsexclude] += "write_ptest_result"
918
919python write_ptest_result() {
920 write_latest_ptest_result(d, d.getVar('BUILDHISTORY_DIR'))
921}
922
923def write_latest_ptest_result(d, histdir):
924 import glob
925 import subprocess
926 test_log_dir = d.getVar('TEST_LOG_DIR')
927 input_ptest = os.path.join(test_log_dir, 'ptest_log')
928 output_ptest = os.path.join(histdir, 'ptest')
929 if os.path.exists(input_ptest):
930 try:
931 # Lock it avoid race issue
932 lock = bb.utils.lockfile(output_ptest + "/ptest.lock")
933 bb.utils.mkdirhier(output_ptest)
934 oe.path.copytree(input_ptest, output_ptest)
935 # Sort test result
936 for result in glob.glob('%s/pass.fail.*' % output_ptest):
937 bb.debug(1, 'Processing %s' % result)
938 cmd = ['sort', result, '-o', result]
939 bb.debug(1, 'Running %s' % cmd)
940 ret = subprocess.call(cmd)
941 if ret != 0:
942 bb.error('Failed to run %s!' % cmd)
943 finally:
944 bb.utils.unlockfile(lock)