X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/dccf1b41e9c7b5a696f01abceaa2779fe65f154f..6b8f371d2a1dca61406b12ca7ce04437cb356af1:/tools/jenkins/Coverage.sh diff --git a/tools/jenkins/Coverage.sh b/tools/jenkins/Coverage.sh index 6310ddb64e..a8503ca934 100755 --- a/tools/jenkins/Coverage.sh +++ b/tools/jenkins/Coverage.sh @@ -2,13 +2,15 @@ set -e +BUILDFOLDER=$WORKSPACE/build + die() { echo "$@" exit 1 } do_cleanup() { - for d in "$WORKSPACE/build" + for d in "$BUILDFOLDER" do if [ -d "$d" ] then @@ -19,7 +21,7 @@ do_cleanup() { ### Check the node installation -for pkg in xsltproc gcovr +for pkg in xsltproc gcovr ant cover2cover.py do if command -v $pkg then @@ -29,21 +31,22 @@ do fi done -### Cleanup previous runs +### Cleanup previous runs ! [ -z "$WORKSPACE" ] || die "No WORKSPACE" [ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist" do_cleanup -for d in "$WORKSPACE/build" +for d in "$BUILDFOLDER" do mkdir "$d" || die "Could not create $d" done NUMPROC="$(nproc)" || NUMPROC=1 -cd $WORKSPACE/build + +cd $BUILDFOLDER ctest -D ExperimentalStart || true @@ -54,11 +57,29 @@ cmake -Denable_documentation=OFF -Denable_lua=ON -Denable_java=ON \ -Denable_memcheck=OFF -Denable_memcheck_xml=OFF -Denable_smpi_ISP_testsuite=ON -Denable_coverage=ON $WORKSPACE make -j$NUMPROC +JACOCO_PATH="/usr/local/share/jacoco" +export JAVA_TOOL_OPTIONS="-javaagent:${JACOCO_PATH}/lib/jacocoagent.jar" + ctest -D ExperimentalTest -j$NUMPROC || true ctest -D ExperimentalCoverage || true +unset JAVA_TOOL_OPTIONS if [ -f Testing/TAG ] ; then + + files=$( find . -name "jacoco.exec" ) + i=0 + for file in $files + do + sourcepath=$( dirname $file ) + #convert jacoco reports in xml ones + ant -f $WORKSPACE/tools/jenkins/jacoco.xml -Dexamplesrcdir=$WORKSPACE -Dbuilddir=$BUILDFOLDER/${sourcepath} -Djarfile=$BUILDFOLDER/simgrid.jar -Djacocodir=${JACOCO_PATH}/lib + #convert jacoco xml reports in cobertura xml reports + cover2cover.py $BUILDFOLDER/${sourcepath}/report.xml .. ../src/bindings/java src/bindings/java > $WORKSPACE/java_coverage_${i}.xml + i=$((i + 1)) + done + + #convert all gcov reports to xml cobertura reports gcovr -r .. --xml-pretty -e teshsuite.* -u -o $WORKSPACE/xml_coverage.xml - xsltproc $WORKSPACE/tools/jenkins/ctest2junit.xsl Testing/`head -n 1 < Testing/TAG`/Test.xml > CTestResults_memcheck.xml + xsltproc $WORKSPACE/tools/jenkins/ctest2junit.xsl Testing/$( head -n 1 < Testing/TAG )/Test.xml > CTestResults_memcheck.xml mv CTestResults_memcheck.xml $WORKSPACE fi