agora inbox for [email protected]  
help / color / mirror / Atom feed
From: Justin Pryzby <[email protected]>
Subject: [PATCH 4/7] wip: cirrus: code coverage
Date: Mon, 17 Jan 2022 00:54:28 -0600

XXX: lcov should be installed in the OS image
---
 .cirrus.yml | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 73b0baeaa7..635ee64b50 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -174,6 +174,14 @@ task:
     cat /proc/cmdline
     ulimit -a -H && ulimit -a -S
     export
+    git remote -v
+    git branch -a
+    git remote add postgres https://github.com/postgres/postgres
+    time git fetch -v postgres master
+    git log -1 postgres/master
+    git diff --name-only --cherry-pick postgres/master...
+    #git branch parent `git merge-base postgres/master HEAD`
+    #git diff --name-only parent..
   create_user_script: |
     useradd -m postgres
     chown -R postgres:postgres .
@@ -185,13 +193,14 @@ task:
     mkdir -m 770 /tmp/cores
     chown root:postgres /tmp/cores
     sysctl kernel.core_pattern='/tmp/cores/%e-%s-%p.core'
-    #apt-get update
-    #apt-get -y install ...
+    apt-get update
+    apt-get -y install lcov
 
   configure_script: |
     su postgres <<-EOF
       ./configure \
         --enable-cassert --enable-debug --enable-tap-tests \
+        --enable-coverage \
         --enable-nls \
         \
         ${LINUX_CONFIGURE_FEATURES} \
@@ -211,6 +220,29 @@ task:
       make -s ${CHECK} ${CHECKFLAGS} -j${TEST_JOBS}
     EOF
 
+  generate_coverage_report_script: |
+      mkdir coverage
+      # Coverage only for changed files
+      # This is useful to see coverage of newly-added code, but won't
+      # show added/lost coverage in files which this patch doesn't modify.
+      for f in `git diff --name-only --cherry-pick postgres/master... '*.c'`;
+      do
+        lcov --quiet --capture --directory "$f"
+      done >coverage/coverage.gcov
+
+      time genhtml coverage/coverage.gcov --output-directory coverage --show-details --legend --quiet
+      cp coverage/index.html coverage/00-index.html
+
+      # Coverage for all files:
+      #time lcov --quiet --capture --directory . >coverage/coverage-all.gcov
+      #time genhtml coverage/coverage-all.gcov --output-directory coverage-all --show-details --legend --quiet
+      #cp coverage-all/index.html coverage-all/00-index.html
+
+      #git diff --name-only --cherry-pick postgres/master... '*.c' |xargs -r gcov --demangled-names --
+
+  coverage_artifacts:
+    paths: ['coverage/**/*.html', 'coverage/**/*.png', 'coverage/**/*.gcov', 'coverage/**/*.css' ]
+
   on_failure:
     <<: *on_failure
     cores_script: src/tools/ci/cores_backtrace.sh linux /tmp/cores
-- 
2.17.1


--x1F0m3RQhDZyj8sd
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
 filename="0005-cirrus-vcregress-test-modules-contrib-with-NO_INSTAL.patch"



view thread (5+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH 4/7] wip: cirrus: code coverage
  In-Reply-To: <no-message-id-133818@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox