[OE-core] [PATCH] scripts/oe-selftest: Add support for selftest log with timestamp

Costin Constantin costin.c.constantin at intel.com
Sat Dec 19 19:41:59 UTC 2015


Each time oe-selftest runs, the oe-selftest.log file is overwritten.
This patch solves it by adding time stamp to each selftest log file
and doing a symlink named as oe-selftest.log to the last one created.

Signed-off-by: Costin Constantin <costin.c.constantin at intel.com>
---
 scripts/oe-selftest | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/oe-selftest b/scripts/oe-selftest
index bc50b2a..276c7d3 100755
--- a/scripts/oe-selftest
+++ b/scripts/oe-selftest
@@ -31,6 +31,7 @@ import unittest
 import logging
 import argparse
 import subprocess
+import time as t
 
 sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '/lib')
 import scriptpath
@@ -43,6 +44,10 @@ from oeqa.utils.commands import runCmd, get_bb_var, get_test_layer
 from oeqa.selftest.base import oeSelfTest
 
 def logger_create():
+    log_file = "oe-selftest-" + t.strftime("%Y-%m-%d_%H:%M:%S") + ".log"
+    if os.path.exists("oe-selftest.log"): os.remove("oe-selftest.log")
+    os.symlink(log_file, "oe-selftest.log")
+
     log = logging.getLogger("selftest")
     log.setLevel(logging.DEBUG)
 
-- 
2.5.0




More information about the Openembedded-core mailing list