X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Ftools%2Fpresentation%2Fgenerator_alerts.py;h=4dd78fe820f1bf3af5fcf117416b1852aca3c41e;hp=02d570355385e0538562334cc6a643336eeb9436;hb=d8fc1521b8def68adc8f4a390aa2d25db806ea4f;hpb=7f7f2fd7363637d0da626a28bb8a0b357d314a9d diff --git a/resources/tools/presentation/generator_alerts.py b/resources/tools/presentation/generator_alerts.py index 02d5703553..4dd78fe820 100644 --- a/resources/tools/presentation/generator_alerts.py +++ b/resources/tools/presentation/generator_alerts.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2021 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -27,7 +27,6 @@ from email.mime.multipart import MIMEMultipart from os.path import isdir from collections import OrderedDict -from pal_utils import get_last_completed_build_number from pal_errors import PresentationError @@ -247,7 +246,7 @@ class Alerting: :type sort: bool :returns: CSIT build number, VPP version, Number of passed tests, Number of failed tests, Compressed failed tests. - :rtype: tuple(str, str, int, int, OrderedDict) + :rtype: tuple(str, str, int, int, str, OrderedDict) """ directory = self.configs[alert[u"way"]][u"output-dir"] @@ -269,6 +268,10 @@ class Alerting: if idx == 3: failed = line[:-1] continue + if idx == 4: + minutes = int(line[:-1]) // 60000 + duration = f"{(minutes // 60):02d}:{(minutes % 60):02d}" + continue try: test = line[:-1].split(u'-') name = u'-'.join(test[3:-1]) @@ -286,14 +289,14 @@ class Alerting: failed_tests[name][u"cores"].append(test[2]) except IOError: logging.error(f"No such file or directory: {file_path}") - return None, None, None, None, None + return None, None, None, None, None, None if sort: sorted_failed_tests = OrderedDict() for key in sorted(failed_tests.keys()): sorted_failed_tests[key] = failed_tests[key] - return build, version, passed, failed, sorted_failed_tests + return build, version, passed, failed, duration, sorted_failed_tests - return build, version, passed, failed, failed_tests + return build, version, passed, failed, duration, failed_tests def _list_gressions(self, alert, idx, header, re_pro): """Create a file with regressions or progressions for the test set @@ -353,7 +356,7 @@ class Alerting: try: groups = re.search( re.compile( - r'((vpp|dpdk)-\dn-(skx|clx|hsw|tsh|dnv|zn2|tx2)-.*)' + r'((vpp|dpdk)-\dn-(skx|clx|tsh|dnv|zn2|tx2)-.*)' ), test_set ) @@ -364,7 +367,7 @@ class Alerting: f"The test set {test_set} does not include information " f"about test bed. Using empty string instead." ) - build, version, passed, failed, failed_tests = \ + build, version, passed, failed, duration, failed_tests = \ self._get_compressed_failed_tests(alert, test_set) if build is None: text += ( @@ -374,8 +377,11 @@ class Alerting: ) continue text += ( - f"\n\n{test_set_short}, {failed} tests failed, {passed} tests " - f"passed, CSIT build: {alert[u'urls'][idx]}/{build}, " + f"\n\n{test_set_short}, " + f"{failed} tests failed, " + f"{passed} tests passed, " + f"duration: {duration}, " + f"CSIT build: {alert[u'urls'][idx]}/{build}, " f"{device} version: {version}\n\n" )