Change in ...osmo-gsm-tester[master]: Add a per-test log file

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Wed Sep 18 15:06:00 UTC 2019


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/15567


Change subject: Add a per-test log file
......................................................................

Add a per-test log file

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
---
M src/osmo_gsm_tester/test.py
1 file changed, 6 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/67/15567/1

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 @@
         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 @@
 
     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 @@
             # 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)

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/15567
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Change-Id: I8cb79c7855e0bc14282d6728841e92ba22699eed
Gerrit-Change-Number: 15567
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190918/de019877/attachment.htm>


More information about the gerrit-log mailing list