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.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18691 )
Change subject: report: Add trial commit info to junit file
......................................................................
report: Add trial commit info to junit file
Change-Id: I997bbbeb3807af5cd927594a4155b824f0c6d03d
---
M src/osmo_gsm_tester/core/report.py
M src/osmo_gsm_tester/core/trial.py
2 files changed, 27 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/91/18691/1
diff --git a/src/osmo_gsm_tester/core/report.py b/src/osmo_gsm_tester/core/report.py
index 121fbaf..5014bf5 100644
--- a/src/osmo_gsm_tester/core/report.py
+++ b/src/osmo_gsm_tester/core/report.py
@@ -46,6 +46,14 @@
replacement_char = '\uFFFD' # Unicode replacement character
return invalid_xml_char_ranges_regex.sub(replacement_char, escape(str))
+def hash_info_to_junit(testsuite, hash_info):
+ properties = et.SubElement(testsuite, 'properties')
+ for key, val in hash_info.items():
+ prop = et.SubElement(properties, 'property')
+ prop.set('name', 'ref:' + key)
+ prop.set('value', val)
+
+
def trial_to_junit_write(trial, junit_path):
elements = et.ElementTree(element=trial_to_junit(trial))
elements.write(junit_path)
@@ -57,8 +65,10 @@
num_errors = 0
time = 0
id = 0
+ hash_info = trial.get_all_inst_hash_info()
for suite in trial.suites:
testsuite = suite_to_junit(suite)
+ hash_info_to_junit(testsuite, hash_info)
testsuite.set('id', str(id))
id += 1
testsuites.append(testsuite)
diff --git a/src/osmo_gsm_tester/core/trial.py b/src/osmo_gsm_tester/core/trial.py
index eaf18c3..001421f 100644
--- a/src/osmo_gsm_tester/core/trial.py
+++ b/src/osmo_gsm_tester/core/trial.py
@@ -21,6 +21,7 @@
import time
import shutil
import tarfile
+import pathlib
from . import log
from . import util
@@ -212,6 +213,22 @@
self.log('Storing JUnit report in', junit_path)
report.trial_to_junit_write(self, junit_path)
+ def get_all_inst_hash_info(self):
+ d = {}
+ pathlist = pathlib.Path(str(self.inst_dir)).glob('**/*git_hashes.txt')
+ for path in pathlist:
+ # because path is object not string
+ abs_path_str = str(path) # because path is object not string
+ dir, file = os.path.split(abs_path_str)
+ reldir = os.path.relpath(dir, str(self.inst_dir)).rstrip(os.sep)
+ with open(abs_path_str, 'r') as f:
+ for line in [l.strip() for l in f.readlines()]:
+ if not line:
+ continue
+ hash, proj = tuple(line.split(' ', 1))
+ d[os.path.join(reldir,proj)] = hash
+ return d
+
def log_report(self):
log.large_separator(self.name(), self.status)
self.log(report.trial_to_text(self))
--
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18691
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: I997bbbeb3807af5cd927594a4155b824f0c6d03d
Gerrit-Change-Number: 18691
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/20200605/c93f2b08/attachment.htm>