summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorCostin Constantin <costin.c.constantin@intel.com>2015-12-22 10:36:29 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-27 11:26:59 +0000
commitda8097480ad70e7a75608d733c63c3ae5a337974 (patch)
tree90b3711c3bdcb883e8b1bf05fa44f7fb200e9ceb /scripts
parent169e1eaa4fc5ed03e2307b68686a7f5b1db37a36 (diff)
downloadopenembedded-core-contrib-da8097480ad70e7a75608d733c63c3ae5a337974.tar.gz
scripts/oe-selftest: Add support for selftest log with timestamp
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@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/oe-selftest7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/oe-selftest b/scripts/oe-selftest
index f989e87010..08a5af3952 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
@@ -44,10 +45,14 @@ 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)
- fh = logging.FileHandler(filename='oe-selftest.log', mode='w')
+ fh = logging.FileHandler(filename=log_file, mode='w')
fh.setLevel(logging.DEBUG)
ch = logging.StreamHandler(sys.stdout)