]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Report coverage with gcovr
authorMichal Nowak <mnowak@isc.org>
Thu, 30 Jul 2020 07:27:22 +0000 (09:27 +0200)
committerMichal Nowak <mnowak@isc.org>
Mon, 17 Aug 2020 14:55:26 +0000 (16:55 +0200)
.gitlab-ci.yml

index 6a5ea375fba2dd68f095c4368e3561d27e37e2ec..f047ad8260cc94b2acdd19cc36eb57019489fd8d 100644 (file)
@@ -1378,3 +1378,41 @@ abi-check:
   only:
     - main@isc-projects/bind9
     - /^v9_[1-9][0-9]$/@isc-projects/bind9
+
+gcov:
+  <<: *base_image
+  stage: build
+  needs:
+    - job: autoreconf
+      artifacts: true
+  variables:
+    CC: gcc
+    CFLAGS: "${CFLAGS_COMMON} --coverage -O0"
+    LDFLAGS: "--coverage"
+    EXTRA_CONFIGURE: "--enable-dnstap --with-libidn2"
+  script:
+    - *configure
+    - *setup_interfaces
+    - *setup_softhsm
+    - make -j${BUILD_PARALLEL_JOBS:-1} -k all V=1
+    - make -k unit || true
+    - make -C bin/tests/system -j${TEST_PARALLEL_JOBS:-1} -k test V=1 || true
+    # *.gcno and *.gcda files generated for shared library objects are created
+    # in directories in which gcovr is unable to process them properly
+    # (.../.libs/...).  Move such *.gcno and *.gcda files one level higher.
+    - find . -regex ".*/\.libs/.*\.\(gcda\|gcno\)" -execdir mv "{}" .. \;
+    # Help gcovr process the nasty tricks in lib/dns/code.h, where we include C
+    # source files from lib/dns/rdata/*/, using an even nastier trick.
+    - find lib/dns/rdata/* -name "*.c" -execdir cp -f "{}" ../../ \;
+    # These drivers are built into bin/named/named in a way which trips up
+    # gcovr.  Copy them to where gcovr expects them.
+    - cp contrib/dlz/drivers/dlz_drivers.c contrib/dlz/drivers/dlz_filesystem_driver.c contrib/dlz/drivers/sdlz_helper.c bin/named/
+    - gcovr --root . --exclude-directories bin/tests --exclude-directories doc --exclude-directories libltdl --exclude-directories lib/samples --exclude 'lib/.*/tests/.*' --html-details -o coverage.html
+    - gcovr --root . --exclude-directories bin/tests --exclude-directories doc --exclude-directories libltdl --exclude-directories lib/samples --exclude 'lib/.*/tests/.*' -o coverage.txt
+    - tail -n 3 coverage.txt
+  artifacts:
+    paths:
+      - coverage*.html
+  only:
+    - main@isc-projects/bind9
+    - /^v9_[1-9][0-9]$/@isc-projects/bind9