about summary refs log tree commit diff homepage
path: root/.travis/klee.sh
diff options
context:
space:
mode:
authorCristian Cadar <c.cadar@imperial.ac.uk>2015-06-17 12:35:16 +0100
committerCristian Cadar <c.cadar@imperial.ac.uk>2015-06-17 12:35:16 +0100
commit637e884bb0ad4ead31d61583f47db475f5ec1ab7 (patch)
tree91888800aed8d062d8eb90ff6bc589329f2f7ae7 /.travis/klee.sh
parent998a0c10526c6549c655a227b122a6def9d65398 (diff)
parent7844d5f9b9057197b7392efca46ed79c82e66dc5 (diff)
downloadklee-637e884bb0ad4ead31d61583f47db475f5ec1ab7.tar.gz
Merge pull request #245 from kren1/master
Added coverage of the KLEE codebase to Travis CI
Diffstat (limited to '.travis/klee.sh')
-rwxr-xr-x.travis/klee.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/.travis/klee.sh b/.travis/klee.sh
index 3106dca9..3008c7fb 100755
--- a/.travis/klee.sh
+++ b/.travis/klee.sh
@@ -39,6 +39,10 @@ else
     KLEE_UCLIBC_CONFIGURE_OPTION=""
 fi
 
+COVERAGE_FLAGS=""
+if [ ${COVERAGE} -eq 1 ]; then
+    COVERAGE_FLAGS='-fprofile-arcs -ftest-coverage'
+fi
 ###############################################################################
 # KLEE
 ###############################################################################
@@ -55,6 +59,7 @@ ${KLEE_SRC}/configure --with-llvmsrc=/usr/lib/llvm-${LLVM_VERSION}/build \
             --with-llvmcxx=${KLEE_CXX} \
             --with-stp="${BUILD_DIR}/stp/build" \
             ${KLEE_UCLIBC_CONFIGURE_OPTION} \
+            CXXFLAGS="${COVERAGE_FLAGS}" \
             && make DISABLE_ASSERTIONS=${DISABLE_ASSERTIONS} \
                     ENABLE_OPTIMIZED=${ENABLE_OPTIMIZED} \
                     ENABLE_SHARED=0
@@ -94,6 +99,37 @@ set +e # We want to let all the tests run before we exit
 lit -v .
 RETURN="${RETURN}$?"
 
+#generate and upload coverage if COVERAGE is set
+if [ ${COVERAGE} -eq 1 ]; then
+
+#get zcov that works with gcov v4.8
+    git clone https://github.com/ddunbar/zcov.git
+    cd zcov
+    sudo python setup.py install
+    sudo mkdir /usr/local/lib/python2.7/dist-packages/zcov-0.3.0.dev0-py2.7.egg/zcov/js
+    cd zcov
+
+#these files are not where zcov expects them to be after install so we move them
+    sudo cp js/sorttable.js /usr/local/lib/python2.7/dist-packages/zcov-0.3.0.dev0-py2.7.egg/zcov/js/sorttable.js 
+    sudo cp js/sourceview.js /usr/local/lib/python2.7/dist-packages/zcov-0.3.0.dev0-py2.7.egg/zcov/js/sourceview.js 
+    sudo cp style.css /usr/local/lib/python2.7/dist-packages/zcov-0.3.0.dev0-py2.7.egg/zcov/style.css
+
+#install zcov dependency
+    sudo apt-get install enscript
+
+#update gcov from v4.6 to v4.8. This is becauase gcda files are made for v4.8 and cause 
+#a segmentation fault in v4.6
+    sudo apt-get install ggcov
+    sudo rm /usr/bin/gcov
+    sudo ln -s /usr/bin/gcov-4.8 /usr/bin/gcov
+
+#scan and generate coverage
+    zcov scan output.zcov ${BUILD_DIR}
+    zcov genhtml output.zcov coverage/
+#upload the coverage data, currently to a random ftp server
+    tar -zcvf coverage.tar.gz coverage/
+    curl --form "file=@coverage.tar.gz" -u ${USER}:${PASSWORD} ${COVERAGE_SERVER}
+fi
 ###############################################################################
 # Result
 ###############################################################################