summaryrefslogtreecommitdiffstats
path: root/build-gluster-org/scripts/lcov.sh
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 /build-gluster-org/scripts/lcov.sh
parentaefb99602ec6d72b9598ee2a79a8c057af7f96ce (diff)
Added a line coverage job in gluster
Change-Id: I7fa9e3e52d32451f976dc474e4ad37c42cbeb054
Diffstat (limited to 'build-gluster-org/scripts/lcov.sh')
-rw-r--r--build-gluster-org/scripts/lcov.sh48
1 files changed, 48 insertions, 0 deletions
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"