summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordeepshikhaaa <deepshikhakhandelwal8@gmail.com>2017-07-24 15:54:20 +0530
committerNigel Babu <nigelb@redhat.com>2017-08-08 08:05:34 +0000
commit4416075a234a5829ea9674241fe77ebe0c597ed6 (patch)
tree9c80788ea09e7da3239c0093619de48147e25527
parentaefb99602ec6d72b9598ee2a79a8c057af7f96ce (diff)
Added a line coverage job in gluster
Change-Id: I7fa9e3e52d32451f976dc474e4ad37c42cbeb054
-rw-r--r--build-gluster-org/jobs/lcov.yml46
-rw-r--r--build-gluster-org/scripts/lcov.sh48
2 files changed, 94 insertions, 0 deletions
diff --git a/build-gluster-org/jobs/lcov.yml b/build-gluster-org/jobs/lcov.yml
new file mode 100644
index 0000000..a2146b1
--- /dev/null
+++ b/build-gluster-org/jobs/lcov.yml
@@ -0,0 +1,46 @@
+- job:
+ name: line-coverage
+ node: lcov
+ description: Checks line coverage by the regression test in gluster
+ project-type: freestyle
+ concurrent: true
+
+ scm:
+ - git:
+ branches:
+ - $GERRIT_BRANCH
+ refspec: $GERRIT_REFSPEC
+ choosing-strategy: gerrit
+ url: https://github.com/gluster/glusterfs
+
+ properties:
+ - discard-after-x:
+ x: 30
+ - one-build-per-node
+
+ triggers:
+ - timed: "H 0 * * *"
+
+ builders:
+ - shell: !include-raw: ../scripts/lcov.sh
+
+ publishers:
+ - html-publisher:
+ name: "Line Coverage Report"
+ dir: "coverage/"
+ files: "index.html"
+ keep-all: true
+ link-to-last-build: true
+
+ parameters:
+ - string:
+ default: refs/heads/master
+ description: 'For review 12345 and patch set 6, this will be refs/changes/45/12345/6. Default: Tip of master'
+ name: GERRIT_REFSPEC
+ - string:
+ default: master
+ description: 'Name of the branch you want to build from. We usually build from master'
+ name: GERRIT_BRANCH
+
+ wrappers:
+ - timestamps
diff --git a/build-gluster-org/scripts/lcov.sh b/build-gluster-org/scripts/lcov.sh
new file mode 100644
index 0000000..d31a060
--- /dev/null
+++ b/build-gluster-org/scripts/lcov.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+# Remove any gluster daemon leftovers from aborted runs
+sudo -E bash /opt/qa/cleanup.sh
+
+# Clean up the git repo
+sudo rm -rf $WORKSPACE/.gitignore $WORKSPACE/*
+sudo chown -R jenkins:jenkins $WORKSPACE
+cd $WORKSPACE || exit 1
+git reset --hard HEAD
+
+# Clean up other Gluster dirs
+sudo rm -rf /var/lib/glusterd/* /build/install /build/scratch >/dev/null 2>&1
+
+# Remove the many left over socket files in /var/run
+sudo rm -f /var/run/????????????????????????????????.socket >/dev/null 2>&1
+
+# Remove GlusterFS log files from previous runs
+sudo rm -rf /var/log/glusterfs/* /var/log/glusterfs/.cmd_log_history >/dev/null 2>&1
+
+JDIRS="/var/log/glusterfs /var/lib/glusterd /var/run/gluster /d /d/archived_builds /d/backends /d/build /d/logs /home/jenkins/root"
+sudo mkdir -p $JDIRS
+sudo chown jenkins:jenkins $JDIRS
+chmod 755 $JDIRS
+
+#compile the code with coverage options
+set -e
+./autogen.sh || exit 1
+P=/build
+./configure {,GF_FUSE_,GF_GLUSTERFS_,GF_}CFLAGS="-g3 -O0 -lgcov --coverage -fprofile-arcs -ftest-coverage" --prefix=$P/install --with-mountutildir=$P/install/sbin --with-initdir=$P/install/etc --localstatedir=/var --enable-debug --enable-gnfs --silent || exit 1
+make install
+
+echo "Initializing the line coverage"
+mkdir coverage
+lcov -d . --zerocounters
+lcov -i -c -d . -o coverage/glusterfs-lcov.info
+set +e
+
+echo "Running the regression test"
+sudo -E bash /opt/qa/regression.sh -c
+
+echo "Capturing the line coverage in the .info file"
+lcov -c -d . -o coverage/glusterfs-lcov.info
+sed -i.bak '/stdout/d' coverage/glusterfs-lcov.info
+
+#Generating the html page for code coverage details using genhtml
+genhtml -o coverage/ coverage/glusterfs-lcov.info
+echo "The HTML report is generated as index.html file"