From d567e51cebf8e25b1030367d2b946faba91233d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sat, 28 Oct 2023 23:29:53 +0200 Subject: Uncovered files now have ALL their lines marked as uncovered. Only marking one line as uncovered gave 100% miss, but when grouped with other files would be missleading, (0% + 0% + 100% \simeq 99%). This is also incorrect, since non-code lines are marked non-covered. But it draws the attention to the right places. --- testrunner.scm | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/testrunner.scm b/testrunner.scm index fbab2585..97981251 100755 --- a/testrunner.scm +++ b/testrunner.scm @@ -20,7 +20,7 @@ exec "$GUILE" --debug --no-auto-compile -e main -s "$0" "$@" (srfi srfi-64) (srfi srfi-71) (srfi srfi-111) - ((rnrs io ports) :select (get-bytevector-all)) + ((rnrs io ports) :select (get-bytevector-all get-u8)) ((hnh util) :select (-> ->> for group-by)) (hnh util path) (hnh util type) @@ -57,6 +57,15 @@ exec "$GUILE" --debug --no-auto-compile -e main -s "$0" "$@" (thread-start! thread) thread)) +(define (line-count port) + (let loop ((count 0) + (chr (get-u8 port))) + (if (eof-object? chr) + count + (loop (+ count (if (= chr 10) + 1 0)) + (get-u8 port))))) + (define print @@ -418,10 +427,12 @@ Flags: (for-each output-coverage merged-coverages) (for-each output-coverage (map (lambda (filename) - (coverage-info filename: filename - lines: '((2 . 0)) - total-lines: 1 - hit-lines: 0)) + (let ((lines (call-with-input-file filename line-count))) + (coverage-info filename: filename + lines: (map (lambda (x) (cons x 0)) + (iota lines 1)) + total-lines: lines + hit-lines: 0))) uncovered-files))))) (format #t "~%== Gathered errors ==~%") -- cgit v1.2.3