diff --git a/os_tests/__init__.py b/os_tests/__init__.py index 601ce4f9..6866480f 100644 --- a/os_tests/__init__.py +++ b/os_tests/__init__.py @@ -1,2 +1,2 @@ __version__ = '0.3.0' -__codedate__ = '20240903' \ No newline at end of file +__codedate__ = '20240912' \ No newline at end of file diff --git a/os_tests/cfg/os-tests.yaml b/os_tests/cfg/os-tests.yaml index f693ee06..3978e55e 100644 --- a/os_tests/cfg/os-tests.yaml +++ b/os_tests/cfg/os-tests.yaml @@ -72,4 +72,6 @@ case_post: # specify it when using the internal repos for dnf update, can pass more seperated by "," dnf_repo_url: # specify it when leapp upgrade via custom repo, can pass more seperated by "," -leapp_target_repo_url: \ No newline at end of file +leapp_target_repo_url: +# add more information about test run +comment: "" \ No newline at end of file diff --git a/os_tests/data/baseline_log.json b/os_tests/data/baseline_log.json index 48077288..af904d15 100644 --- a/os_tests/data/baseline_log.json +++ b/os_tests/data/baseline_log.json @@ -2253,5 +2253,29 @@ "cases": "", "addedby": "linl@redhat.com", "addeddate": "20240912" + }, + "msg_243": { + "content": ".*sysfs: cannot create duplicate filename.*/devices/cache.*", + "analyze": "known issue", + "branch": "rhel10", + "status": "active", + "link": "https://issues.redhat.com/browse/RHEL-55706", + "path": "journal", + "trigger": "", + "cases": "os_tests.tests.test_general_check.TestGeneralCheck.test_check_dmesg_calltrace", + "addedby": "xiliang@redhat.com", + "addeddate": "20240909" + }, + "msg_244": { + "content": ".*/sys/devices/system/cpu/cpu1/online: No such file or directory.*", + "analyze": "known issue", + "branch": "rhel9", + "status": "active", + "link": "https://issues.redhat.com/browse/RHEL-58031", + "path": "/sys/devices/system/cpu/cpu1/online", + "trigger": "", + "cases": "os_tests.tests.test_general_test.TestGeneralTest.test_cpu_hotplug_no_workload", + "addedby": "xiliang@redhat.com", + "addeddate": "20240909" } -} +} \ No newline at end of file diff --git a/os_tests/libs/html_runner.py b/os_tests/libs/html_runner.py index 86198ce6..c598e5fa 100644 --- a/os_tests/libs/html_runner.py +++ b/os_tests/libs/html_runner.py @@ -9,7 +9,7 @@ import os from jinja2 import Template, FileSystemLoader, Environment, PackageLoader, select_autoescape -class Result: +class ResultSummary: ''' The class is for test result summary. ''' @@ -119,6 +119,7 @@ def __init__(self, stream=None, descriptions=True, verbosity=1, self.buffer = buffer self.tb_locals = tb_locals self.warnings = warnings + self.comment = '' if resultclass is not None: self.resultclass = resultclass @@ -128,7 +129,7 @@ def _makeResult(self): def run(self, test, logdir=None): "Run the given test case or test suite." result = self._makeResult() - test_result = Result() + test_result_summary = ResultSummary() registerResult(result) result.failfast = self.failfast result.buffer = self.buffer @@ -152,6 +153,7 @@ def run(self, test, logdir=None): result.planned = len(all_case_name) for ts in test: logdir = ts.params['results_dir'] + test_result_summary.comment = ts.params.get('comment') if not os.path.exists(logdir): os.makedirs(logdir,exist_ok=True) results_dir = logdir + '/results' @@ -184,11 +186,11 @@ def run(self, test, logdir=None): for ts_finished, reason in mapped_result[status]: if ts_finished == ts: if status == 'FAIL': - test_result.case_fail += 1 + test_result_summary.case_fail += 1 if status == 'ERROR': - test_result.case_error += 1 + test_result_summary.case_error += 1 if status == 'SKIP': - test_result.case_skip += 1 + test_result_summary.case_skip += 1 case_status = status case_reason = reason try: @@ -209,19 +211,19 @@ def run(self, test, logdir=None): case_reason = "{} IS_KNOWN:{} Please check auto analyze details in debug log".format(case_reason, not ret) break if not case_status: - test_result.case_pass += 1 + test_result_summary.case_pass += 1 with open(debug_log, 'a+') as fh: fh.write('{} - PASS'.format(ts.id())) case_status = 'PASS' case_reason = '' - test_result.table_rows.append([id, ts.id(), case_status, case_reason, ts.duration, debug_log, test_class_name]) + test_result_summary.table_rows.append([id, ts.id(), case_status, case_reason, ts.duration, debug_log, test_class_name]) with open(sum_txt, 'a+') as fh: fh.write('case: {} - {}\n'.format(ts.id(),case_status)) if case_reason: fh.write('info: {}\n'.format(case_reason)) stopTime = time.perf_counter() timeTaken = round(stopTime - startTime, 3) - test_result.run_time = timeTaken + test_result_summary.run_time = timeTaken all_case_name.sort() id = 0 for case in all_case_name: @@ -231,18 +233,18 @@ def run(self, test, logdir=None): debug_log = "../attachments/" + case + '.debug' if hasattr(result, 'separator2'): self.stream.writeln(result.separator2) - test_result.compute_totals() + test_result_summary.compute_totals() node_info_file = "{}/attachments/node_info".format(logdir) if os.path.exists(node_info_file): with open(node_info_file) as fh: - test_result.node_info = fh.read() + test_result_summary.node_info = fh.read() results_dir = logdir + '/results' if not os.path.exists(results_dir): os.mkdir(results_dir) sum_html = os.path.join(results_dir, "sum.html") - generated_report(sum_html, "sum.html", test_result) + generated_report(sum_html, "sum.html", test_result_summary) sum_junit = os.path.join(results_dir, "sum.xml") - generated_report(sum_junit, "sum.xml", test_result) + generated_report(sum_junit, "sum.xml", test_result_summary) self.stream.writeln("{} generated".format(os.path.realpath(sum_txt))) #result.printErrors() if hasattr(result, 'separator2'): diff --git a/os_tests/templates/sum.html b/os_tests/templates/sum.html index ce661725..3e91df7d 100644 --- a/os_tests/templates/sum.html +++ b/os_tests/templates/sum.html @@ -22,11 +22,14 @@
Summary | Total:{{ result.total }}, PASS:{{ result.case_pass }}, FAIL:{{ result.case_fail }}, SKIP:{{ result.case_skip }}, ERROR:{{ result.case_error }} - success rate is {{ '%0.2f' % result.pass_rate|float }}% (excluded SKIP and CANCEL) | Summary | Total:{{ result.total }}, PASS:{{ result.case_pass }}, FAIL:{{ result.case_fail }}, SKIP:{{ result.case_skip }}, ERROR:{{ result.case_error }} - success rate is {{ '%0.2f' % result.pass_rate|float }}% (excluded SKIP and CANCEL) Runtime(sec):{{ '%0.2f' % result.run_time|float }} + |
RunTime(s) | {{ '%0.2f' % result.run_time|float }} | Node Info | {{ result.node_info|e }} | +
Node Info | {{ result.node_info|e }} | Comment | {{ result.comment|e }} | +