5 BUILDFOLDER=$WORKSPACE/build
13 for d in "$BUILDFOLDER"
17 rm -rf "$d" || die "Could not remote $d"
22 ### Check the node installation
24 for pkg in xsltproc gcovr ant cover2cover.py
28 echo "$pkg is installed. Good."
30 die "please install $pkg before proceeding"
34 ### Cleanup previous runs
36 ! [ -z "$WORKSPACE" ] || die "No WORKSPACE"
37 [ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
41 for d in "$BUILDFOLDER"
43 mkdir "$d" || die "Could not create $d"
46 NUMPROC="$(nproc)" || NUMPROC=1
51 rm -rf xml_coverage.xml
53 ctest -D ExperimentalStart || true
55 cmake -Denable_documentation=OFF -Denable_lua=ON -Denable_java=ON \
56 -Denable_compile_optimizations=OFF -Denable_compile_warnings=ON \
57 -Denable_jedule=ON -Denable_mallocators=ON \
58 -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=ON -Denable_model-checking=ON \
59 -Denable_smpi_papi=ON \
60 -Denable_memcheck=OFF -Denable_memcheck_xml=OFF -Denable_smpi_ISP_testsuite=ON -Denable_coverage=ON $WORKSPACE
63 JACOCO_PATH="/usr/local/share/jacoco"
64 export JAVA_TOOL_OPTIONS="-javaagent:${JACOCO_PATH}/lib/jacocoagent.jar"
66 ctest --no-compress-output -D ExperimentalTest -j$NUMPROC || true
67 ctest -D ExperimentalCoverage || true
69 unset JAVA_TOOL_OPTIONS
70 if [ -f Testing/TAG ] ; then
72 files=$( find . -name "jacoco.exec" )
76 sourcepath=$( dirname $file )
77 #convert jacoco reports in xml ones
78 ant -f $WORKSPACE/tools/jenkins/jacoco.xml -Dexamplesrcdir=$WORKSPACE -Dbuilddir=$BUILDFOLDER/${sourcepath} -Djarfile=$BUILDFOLDER/simgrid.jar -Djacocodir=${JACOCO_PATH}/lib
79 #convert jacoco xml reports in cobertura xml reports
80 cover2cover.py $BUILDFOLDER/${sourcepath}/report.xml .. ../src/bindings/java src/bindings/java > $WORKSPACE/java_coverage_${i}.xml
85 #convert all gcov reports to xml cobertura reports
86 gcovr -r . --xml-pretty -e teshsuite -u -o $WORKSPACE/xml_coverage.xml
87 xsltproc $WORKSPACE/tools/jenkins/ctest2junit.xsl build/Testing/$( head -n 1 < build/Testing/TAG )/Test.xml > CTestResults_memcheck.xml
89 #generate sloccount report
90 sloccount --duplicates --wide --details $WORKSPACE | grep -v -e '.git' -e 'mpich3-test' -e 'sloccount.sc' -e 'isp/umpire' -e 'build/' -e 'xml_coverage.xml' -e 'CTestResults_memcheck.xml' -e 'DynamicAnalysis.xml' > $WORKSPACE/sloccount.sc
92 #upload files to codacy. CODACY_PROJECT_TOKEN must be setup !
93 if ! [ -z $CODACY_PROJECT_TOKEN ]
95 for report in $WORKSPACE/java_cov*
97 java -jar /home/ci/codacy-coverage-reporter-4.0.1-assembly.jar report -l Java -r $report --partial
99 java -jar /home/ci/codacy-coverage-reporter-4.0.1-assembly.jar final
100 java -jar /home/ci/codacy-coverage-reporter-4.0.1-assembly.jar report -l C -f -r $WORKSPACE/xml_coverage.xml
101 java -jar /home/ci/codacy-coverage-reporter-4.0.1-assembly.jar report -l CPP -f -r $WORKSPACE/xml_coverage.xml