11# Copyright lowRISC contributors (OpenTitan project).
22# Licensed under the Apache License, Version 2.0, see LICENSE for details.
33# SPDX-License-Identifier: Apache-2.0
4+ from collections .abc import Sequence
5+ from dvsim .job .data import CompletedJobStatus
46
57from pathlib import Path
68
@@ -176,41 +178,47 @@ def gen_results_summary(self):
176178
177179 return self .results_summary_md
178180
179- def _gen_results (self , results ):
180- # This function is called after the regression and looks for
181- # results.hjson file with aggregated results from the formal logfile.
182- # The hjson file is required to follow this format:
183- # {
184- # "messages": {
185- # "errors" : []
186- # "warnings" : []
187- # "cex" : ["property1", "property2"...],
188- # "undetermined": [],
189- # "unreachable" : [],
190- # },
191- #
192- # "summary": {
193- # "errors" : 0
194- # "warnings" : 2
195- # "proven" : 20,
196- # "cex" : 5,
197- # "covered" : 18,
198- # "undetermined": 7,
199- # "unreachable" : 2,
200- # "pass_rate" : "90 %",
201- # "cover_rate" : "90 %"
202- # },
203- # }
204- # The categories for property results are: proven, cex, undetermined,
205- # covered, and unreachable.
206- #
207- # If coverage was enabled then results.hjson will also have an item that
208- # shows formal coverage. It will have the following format:
209- # "coverage": {
210- # formal: "90 %",
211- # stimuli: "90 %",
212- # checker: "80 %"
213- # }
181+ def _gen_results (self , results : Sequence [CompletedJobStatus ]) -> None :
182+ """Generate results.
183+
184+ This function is called after the regression and looks for
185+ results.hjson file with aggregated results from the formal logfile.
186+ The hjson file is required to follow this format:
187+ {
188+ "messages": {
189+ "errors" : []
190+ "warnings" : []
191+ "cex" : ["property1", "property2"...],
192+ "undetermined": [],
193+ "unreachable" : [],
194+ },
195+
196+ "summary": {
197+ "errors" : 0
198+ "warnings" : 2
199+ "proven" : 20,
200+ "cex" : 5,
201+ "covered" : 18,
202+ "undetermined": 7,
203+ "unreachable" : 2,
204+ "pass_rate" : "90 %",
205+ "cover_rate" : "90 %"
206+ },
207+ }
208+ The categories for property results are: proven, cex, undetermined,
209+ covered, and unreachable.
210+
211+ If coverage was enabled then results.hjson will also have an item that
212+ shows formal coverage. It will have the following format:
213+ "coverage": {
214+ formal: "90 %",
215+ stimuli: "90 %",
216+ checker: "80 %"
217+ }
218+ """
219+ # There should be just one job that has run for this config.
220+ complete_job = results [0 ]
221+
214222 results_str = "## " + self .results_title + "\n \n "
215223 results_str += "### " + self .timestamp_long + "\n "
216224 if self .revision :
@@ -222,7 +230,7 @@ def _gen_results(self, results):
222230 assert len (self .deploy ) == 1
223231 mode = self .deploy [0 ]
224232
225- if results [ mode ] == "P" :
233+ if complete_job . status == "P" :
226234 result_data = Path (
227235 subst_wildcards (self .build_dir , {"build_mode" : mode .name }),
228236 "results.hjson" ,
@@ -254,8 +262,8 @@ def _gen_results(self, results):
254262 else :
255263 summary += ["N/A" , "N/A" , "N/A" ]
256264
257- if results [ mode ] != "P" :
258- results_str += "\n ## List of Failures\n " + "" .join (mode . launcher .fail_msg .message )
265+ if complete_job . status != "P" :
266+ results_str += "\n ## List of Failures\n " + "" .join (complete_job .fail_msg .message )
259267
260268 messages = self .result .get ("messages" )
261269 if messages is not None :
0 commit comments