summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-09-18 16:50:38 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2019-09-18 18:57:11 +0200
commit5eae2c50b018891b5f9c3da48e4637e0d93e5820 (patch)
treecadb6866773c2312b005e6ce05add901036d404f
parent9d489c8367e4b74c1d4db6ae042ab1866dfd9e53 (diff)
Add a per-test log filepespin/master
This way there's no need to go over hours of logging in the main log to find information of a failing test. Change-Id: I8cb79c7855e0bc14282d6728841e92ba22699eed
-rw-r--r--src/osmo_gsm_tester/test.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/osmo_gsm_tester/test.py b/src/osmo_gsm_tester/test.py
index 6f141f1..4d4353a 100644
--- a/src/osmo_gsm_tester/test.py
+++ b/src/osmo_gsm_tester/test.py
@@ -42,6 +42,7 @@ class Test(log.Origin):
self.duration = 0
self.fail_type = None
self.fail_message = None
+ self.log_target = None
def get_run_dir(self):
if self._run_dir is None:
@@ -50,6 +51,7 @@ class Test(log.Origin):
def run(self):
try:
+ self.log_target = log.FileLogTarget(self.get_run_dir().new_child('log')).set_all_levels(log.L_DBG).style_change(trace=True)
log.large_separator(self.suite_run.trial.name(), self.suite_run.name(), self.name(), sublevel=3)
self.status = Test.UNKNOWN
self.start_timestamp = time.time()
@@ -81,6 +83,10 @@ class Test(log.Origin):
# when the program is aborted by a signal (like Ctrl-C), escalate to abort all.
self.err('TEST RUN ABORTED: %s' % type(e).__name__)
raise
+ finally:
+ if self.log_target:
+ self.log_target.remove()
+ self.log_target = None
def name(self):
l = log.get_line_for_src(self.path)