This is an automated email from the ASF dual-hosted git repository.

nickva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-jiffy.git

commit 0435946bdf84fdeb095f8ffc1257379a1d817327
Author: Nick Vatamaniuc <[email protected]>
AuthorDate: Mon Mar 30 22:15:02 2026 -0400

    Add C coverage checks
    
    Use gcov for coverage checks and lcov for report generation while running 
the
    full test suite, including all the property tests.
    
    This seems to work on Ubuntu and on MacOS. In CI we'll go with Ubuntu and 
run
    it as one job for now. We don't fail on low coverage, instead we'll track it
    manually by comparing with previous runs. This mostly helpful to run 
locally,
    as lcov html report is pretty and intuitive to browse through.
    
    Noticed Windows CI kept failing. Trying the next highest Windows version, 
maybe
    that will succeed.
---
 .github/workflows/ci.yml | 15 ++++++++++++++-
 .gitignore               |  5 +++++
 Makefile                 | 18 +++++++++++++++++-
 3 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index aa40a20..4cbec22 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -55,6 +55,19 @@ jobs:
         run: |
           make REBAR=rebar3 check-with-eqc
 
+  lcov-coverage:
+    name: lcov-coverage
+    runs-on: ubuntu-latest
+    container:
+      image: erlang:28
+    steps:
+      - uses: actions/checkout@v6
+      - name: install lcov
+        run: |
+          apt update
+          apt install -y --no-install-recommends --no-install-suggests lcov
+          make REBAR=rebar3 coverage
+
   gcc-14:
     name: gcc-14
     runs-on: ubuntu-latest
@@ -113,7 +126,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        os: [windows-2022]
+        os: [windows-2022, windows-2025]
 
     steps:
     - name: prevent git from messing up our json test files
diff --git a/.gitignore b/.gitignore
index c98ce03..590e2b1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,5 +16,10 @@ hexer.config
 rebar.lock
 TEST-*.xml
 /eqc/
+coverage.info
+coverage-jiffy.info
+coverage-html/
 .eqc-info
 current_counterexample.eqc
+*.gcda
+*.gcno
diff --git a/Makefile b/Makefile
index 5f48efb..0a88ae6 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,9 @@ clean:
        rm -f test/*.beam
        rm -rf eqc
        rm -rf _build
+       rm -f c_src/*.gcno c_src/*.gcda c_src/double-conversion/*.gcno 
c_src/double-conversion/*.gcda
+       rm -f coverage.info coverage-jiffy.info
+       rm -rf coverage-html
 
 
 distclean: clean
@@ -32,6 +35,19 @@ check-with-eqc: install_eqc build eunit
 install_eqc:
        ./test/install_eqc_mini.sh
 
+# macos:
+#   brew install lcov on macos
+# ubuntu:
+#   sudo apt install --no-install-recommends lcov
+#
+coverage:
+       $(MAKE) clean
+       CFLAGS="--coverage -O0" CXXFLAGS="--coverage -O0" LDFLAGS="--coverage" 
$(MAKE) check-with-eqc
+       @lcov --capture --directory c_src -o coverage.info --ignore-errors 
inconsistent,unsupported
+       @lcov --extract coverage.info '*/c_src/*' --exclude 
'*/double-conversion/*' -o coverage-jiffy.info --ignore-errors 
inconsistent,unsupported
+       @genhtml coverage-jiffy.info -o coverage-html --title "jiffy lcov 
report"
+       @echo "For coverage report: open coverage-html/index.html"
+
 release:
        rebar3 hex publish
 
@@ -40,4 +56,4 @@ release:
        erlc -o test/ $<
 
 
-.PHONY: all clean distclean depends build etap eunit check
+.PHONY: all clean distclean depends build etap eunit check coverage

Reply via email to