|
14 | 14 | SINGLE_REPORT_FILENAME = f"{REPORTS_FOLDER}/report.log" |
15 | 15 | SUMMARY_FILENAME = f"{REPORTS_FOLDER}/report-summary.log" |
16 | 16 | DRC_FILENAME = '5_route_drc.rpt' |
17 | | -LAST_EXPECTED_LOG = '6_report.log' |
| 17 | +LAST_EXPECTED_LOG = ['6_report.log', 'generate_abstract.log'] |
18 | 18 | METRICS_LOG_FMT = 'gen-metrics-{}-check.log' |
19 | 19 | METRICS_CHECK_FMT = '{}/metadata-{}-check.log' |
20 | 20 | REGEX_ERROR = re.compile(r"^\[error ?(\w+-\d+)?\]", re.IGNORECASE) |
@@ -112,16 +112,56 @@ def gen_report(name, data): |
112 | 112 | else: |
113 | 113 | output = "" |
114 | 114 |
|
115 | | - output = append_text(data['log_errors'], output, 'errors in the logs', REGEX_ERROR, args.verbose) |
116 | | - output = append_text(data['metrics_logs_errors'], output, 'errors in the metrics logs', REGEX_ERROR, args.verbose) |
117 | | - output = append_text(data['metrics_errors'], output, 'metrics failures', REGEX_ERROR, args.verbose) |
118 | | - output = append_text(data['calibre_errors'], output, 'calibre failures', REGEX_ERROR, args.verbose) |
| 115 | + output = append_text( |
| 116 | + data['log_errors'], |
| 117 | + output, |
| 118 | + 'errors in the logs', |
| 119 | + REGEX_ERROR, |
| 120 | + args.verbose) |
| 121 | + output = append_text( |
| 122 | + data['metrics_logs_errors'], |
| 123 | + output, |
| 124 | + 'errors in the metrics logs', |
| 125 | + REGEX_ERROR, |
| 126 | + args.verbose) |
| 127 | + output = append_text( |
| 128 | + data['metrics_errors'], |
| 129 | + output, |
| 130 | + 'metrics failures', |
| 131 | + REGEX_ERROR, |
| 132 | + args.verbose) |
| 133 | + output = append_text( |
| 134 | + data['calibre_errors'], |
| 135 | + output, |
| 136 | + 'calibre failures', |
| 137 | + REGEX_ERROR, |
| 138 | + args.verbose) |
119 | 139 |
|
120 | 140 | if args.verbose >= 2: |
121 | | - output = append_text(data['log_warnings'], output, 'warnings in the logs', REGEX_WARNING, args.verbose-2) |
122 | | - output = append_text(data['metrics_logs_warnings'], output, 'warnings in the metrics logs', REGEX_WARNING, args.verbose-2) |
123 | | - output = append_text(data['metrics_warnings'], output, 'metrics warnings', REGEX_WARNING, args.verbose-2) |
124 | | - output = append_text(data['calibre_warnings'], output, 'calibre warnings', REGEX_WARNING, args.verbose-2) |
| 141 | + output = append_text( |
| 142 | + data['log_warnings'], |
| 143 | + output, |
| 144 | + 'warnings in the logs', |
| 145 | + REGEX_WARNING, |
| 146 | + args.verbose - 2) |
| 147 | + output = append_text( |
| 148 | + data['metrics_logs_warnings'], |
| 149 | + output, |
| 150 | + 'warnings in the metrics logs', |
| 151 | + REGEX_WARNING, |
| 152 | + args.verbose - 2) |
| 153 | + output = append_text( |
| 154 | + data['metrics_warnings'], |
| 155 | + output, |
| 156 | + 'metrics warnings', |
| 157 | + REGEX_WARNING, |
| 158 | + args.verbose - 2) |
| 159 | + output = append_text( |
| 160 | + data['calibre_warnings'], |
| 161 | + output, |
| 162 | + 'calibre warnings', |
| 163 | + REGEX_WARNING, |
| 164 | + args.verbose - 2) |
125 | 165 |
|
126 | 166 | if d['drcs']: |
127 | 167 | if data['status'] == STATUS_GREEN: |
@@ -214,7 +254,7 @@ def write_summary(): |
214 | 254 | d['log_warnings'] += temp_w |
215 | 255 | if name_.endswith('.log'): |
216 | 256 | d['last_log'] = name_ |
217 | | - d['finished'] = (d['last_log'] == LAST_EXPECTED_LOG) |
| 257 | + d['finished'] = (d['last_log'] in LAST_EXPECTED_LOG) |
218 | 258 |
|
219 | 259 | # check if metrics generation had issues |
220 | 260 | d['metrics_logs_errors'], d['metrics_logs_warnings'] = parse_messages( |
@@ -250,7 +290,17 @@ def write_summary(): |
250 | 290 | if d['log_errors'] or d['metrics_errors'] or d['calibre_errors']: |
251 | 291 | d['status'] = STATUS_RED |
252 | 292 | else: |
253 | | - d['status'] = STATUS_GREEN |
| 293 | + if not d['finished']: |
| 294 | + d['status'] = STATUS_RED |
| 295 | + last_lines = 'Could not find last lines of the log file.' |
| 296 | + with open(os.path.join(log_dir, d['last_log']), 'r') as last_file: |
| 297 | + last_lines = last_file.readlines()[-10:] |
| 298 | + last_lines = ' '.join(last_lines) |
| 299 | + message = '[ERROR CI-0000] No error message found. ' |
| 300 | + message += 'Here are the last 10 lines of the log.\n' |
| 301 | + d['log_errors'] = [message + last_lines] |
| 302 | + else: |
| 303 | + d['status'] = STATUS_GREEN |
254 | 304 |
|
255 | 305 | design_list[f"{platform} {design} ({variant})"] = d |
256 | 306 |
|
|
0 commit comments