From: degomme Date: Wed, 1 Mar 2017 01:03:33 +0000 (+0100) Subject: Try to have java coverage with jacoco. X-Git-Tag: v3_15~263^2~2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/653824fd3a6edd3824babaa15f2416c11fcced19 Try to have java coverage with jacoco. Should instead break everything. --- diff --git a/examples/java/CMakeLists.txt b/examples/java/CMakeLists.txt index 999a5b9583..0c8162e086 100644 --- a/examples/java/CMakeLists.txt +++ b/examples/java/CMakeLists.txt @@ -68,6 +68,6 @@ if(enable_java) cloud_migration cloud_masterworker dht_chord dht_kademlia energy_consumption energy_pstate energy_vm io_file io_storage process_kill process_migration process_startkilltime process_suspend task_priority trace_pingpong) string (REPLACE "_" "/" example_dir ${example}) - ADD_TESH(java-${example} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/${example_dir}/${example}.tesh) + ADD_TESH(java-${example} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java/${example_dir} ${CMAKE_HOME_DIRECTORY}/examples/java/${example_dir}/${example}.tesh) endforeach() endif() diff --git a/tools/jenkins/Coverage.sh b/tools/jenkins/Coverage.sh index 6310ddb64e..566cf9a186 100755 --- a/tools/jenkins/Coverage.sh +++ b/tools/jenkins/Coverage.sh @@ -19,7 +19,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 @@ -43,21 +43,36 @@ done NUMPROC="$(nproc)" || NUMPROC=1 + cd $WORKSPACE/build ctest -D ExperimentalStart || true -cmake -Denable_documentation=OFF -Denable_lua=ON -Denable_java=ON \ +cmake -Denable_documentation=OFF -Denable_lua=OFF -Denable_java=ON \ -Denable_compile_optimizations=OFF -Denable_compile_warnings=ON \ - -Denable_jedule=ON -Denable_mallocators=ON \ - -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=ON -Denable_model-checking=ON \ - -Denable_memcheck=OFF -Denable_memcheck_xml=OFF -Denable_smpi_ISP_testsuite=ON -Denable_coverage=ON $WORKSPACE + -Denable_jedule=OFF -Denable_mallocators=ON \ + -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=OFF -Denable_model-checking=ON \ + -Denable_memcheck=OFF -Denable_memcheck_xml=OFF -Denable_smpi_ISP_testsuite=OFF -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 +i=0 if [ -f Testing/TAG ] ; then + for example in app/bittorrent app/centralizedmutex app/masterworker app/pingpong app/tokenring async/yield async/waitall async/dsend cloud/migration cloud/masterworker dht/chord dht/kademlia energy/consumption energy/pstate energy/vm io/file io/storage process/kill process/migration process/startkilltime process/suspend task/priority trace/pingpong + do + #convert jacoco reports in xml ones + ant -f $WORKSPACE/tools/jenkins/jacoco.xml -Dsrcdir=$WORKSPACE/examples/java/${example} -Dbuilddir=$WORKSPACE/build/examples/java/${example} -Djacocodir=${JACOCO_PATH}/lib + #convert jacoco xml reports in cobertura xml reports + cover2cover.py $WORKSPACE/build/examples/java/${example}/report.xml $WORKSPACE/examples/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 mv CTestResults_memcheck.xml $WORKSPACE diff --git a/tools/jenkins/jacoco.xml b/tools/jenkins/jacoco.xml new file mode 100644 index 0000000000..3106a1c1ba --- /dev/null +++ b/tools/jenkins/jacoco.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +