From d26a523eb04e4a7178595f56428b38d5cb4e8c32 Mon Sep 17 00:00:00 2001 From: DavidKorczynski Date: Fri, 27 Sep 2024 17:53:28 +0100 Subject: [PATCH] report: add bug-specific table (#654) This is to make it easier to traverse bugs in larger experiments --------- Signed-off-by: David Korczynski --- report/templates/index.html | 22 ++++++++++++++++++++++ report/web.py | 11 ++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/report/templates/index.html b/report/templates/index.html index 22c79f46b..abc75434e 100644 --- a/report/templates/index.html +++ b/report/templates/index.html @@ -128,6 +128,28 @@

Project summary

+

Crashes found by generated fuzz harnesses

+ + + + + + + + + + + {% for bug_sample in samples_with_bugs %} + + + + + + + {% endfor %} + +
ProjectBenchmarkAI bug validation
{{ loop.index }}{{bug_sample.benchmark.project}}{{bug_sample.benchmark.id}}-{{ bug_sample.sample.id }} {{'True positive' if bug_sample.sample.result.is_semantic_error else 'False positive'}}
+

Accumulated results

diff --git a/report/web.py b/report/web.py index 7c40f6b67..b8ebb277e 100644 --- a/report/web.py +++ b/report/web.py @@ -139,6 +139,7 @@ def _copy_and_set_coverage_report(self, benchmark, sample): def generate(self): """Generate and write every report file.""" benchmarks = [] + samples_with_bugs = [] for benchmark_id in self._results.list_benchmark_ids(): results, targets = self._results.get_results(benchmark_id) benchmark = self._results.match_benchmark(benchmark_id, results, targets) @@ -154,6 +155,8 @@ def generate(self): self._write_benchmark_crash(benchmark, samples) for sample in samples: + if sample.result.crashes: + samples_with_bugs.append({'benchmark': benchmark, 'sample': sample}) sample_targets = self._results.get_targets(benchmark.id, sample.id) self._write_benchmark_sample(benchmark, sample, sample_targets) @@ -163,7 +166,7 @@ def generate(self): time_results = self.read_timings() self._write_index_html(benchmarks, accumulated_results, time_results, - projects) + projects, samples_with_bugs) self._write_index_json(benchmarks) def _write(self, output_path: str, content: str): @@ -183,13 +186,15 @@ def _write(self, output_path: str, content: str): def _write_index_html(self, benchmarks: List[Benchmark], accumulated_results: AccumulatedResult, - time_results: dict[str, Any], projects: list[Project]): + time_results: dict[str, Any], projects: list[Project], + samples_with_bugs: list[dict[str, Any]]): """Generate the report index.html and write to filesystem.""" rendered = self._jinja.render('index.html', benchmarks=benchmarks, accumulated_results=accumulated_results, time_results=time_results, - projects=projects) + projects=projects, + samples_with_bugs=samples_with_bugs) self._write('index.html', rendered) def _write_index_json(self, benchmarks: List[Benchmark]):