Effective coverage reads function totals as line totals when the LLVM report has no branches

Offen Anfängerfreundlich
#95 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
78/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
python, rust
Bereich
testing-qa

Rechercherichtung

Beginne mit effective_coverage.parse_index_page_totals und reproduziere das Problem anhand der synthetischen Zeilen aus html_report/index.html im Issue. Prüfe, wie die Funktion die Summen auswählt und die Branch-Zelle - (0/0) behandelt. Als abgeschlossen gilt die Aufgabe, wenn für die Reproduktion Zeilen (1, 4) und Branches (0, 0) zurückgegeben werden, sodass die effektive Zeilenabdeckung die Zeilensummen verwendet.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug

Found while reviewing the user manual against the implementation at fe013fe. Reproduced by calling effective_coverage.parse_index_page_totals on a synthetic index page.

The effective-coverage path reads the totals from the LLVM HTML index page by taking the last three matches of NN.NN% (covered/total) in the page and treating them as function, line and branch totals. When the report contains no branches, llvm-cov renders the branch total as - (0/0), which does not match. The last three matches are then shifted by one cell: the function totals are read as line totals and the line totals as branch totals.

Reproduction

html_report/index.html whose only rows are

<tr><td>a.rs</td><td>100.00% (1/1)</td><td>25.00% (1/4)</td><td>- (0/0)</td></tr>
<tr><td>Totals</td><td>100.00% (1/1)</td><td>25.00% (1/4)</td><td>- (0/0)</td></tr>

parse_index_page_totals returns {'lines': (1, 1), 'branches': (1, 4)}. Expected: {'lines': (1, 4), 'branches': (0, 0)}.

Effect

With --yaml, a report without branch data is gated on the function coverage instead of the line coverage. In the example the effective line coverage is 100 % although 1 of 4 lines is covered. A Rust-only scope built without -Zcoverage-options=branch has no branch data.

Expected behavior

Read the totals from the Totals row by column, and accept - (0/0) as zero branches.

Vorherrschende Sprache
Python
Sterne
0
Forks
4
Ø Merge
1 T. 16 Std.
Gemergte PRs (30 T.)
16

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus eclipse-score/coverage_tool

Alle Issues in eclipse-score/coverage_tool

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.