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
53 rm -rf xml_coverage.xml
55 ctest -D ExperimentalStart || true
57 cmake -Denable_documentation=OFF -Denable_lua=ON -Denable_java=ON \
58 -Denable_compile_optimizations=OFF -Denable_compile_warnings=ON \
59 -Denable_jedule=ON -Denable_mallocators=ON \
60 -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=ON -Denable_model-checking=ON \
61 -Denable_smpi_papi=ON \
62 -Denable_memcheck=OFF -Denable_memcheck_xml=OFF -Denable_smpi_ISP_testsuite=ON -Denable_coverage=ON $WORKSPACE
64 #build with sonarqube scanner wrapper
65 /home/ci/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-outputs make -j$NUMPROC tests
66 JACOCO_PATH="/usr/local/share/jacoco"
67 export JAVA_TOOL_OPTIONS="-javaagent:${JACOCO_PATH}/lib/jacocoagent.jar"
69 export PYTHON_TOOL_OPTIONS="/usr/bin/python3-coverage run --parallel-mode --branch"
71 ctest --no-compress-output -D ExperimentalTest -j$NUMPROC || true
72 ctest -D ExperimentalCoverage || true
74 unset JAVA_TOOL_OPTIONS
75 if [ -f Testing/TAG ] ; then
77 files=$( find . -size +1c -name "jacoco.exec" )
81 sourcepath=$( dirname $file )
82 #convert jacoco reports in xml ones
83 ant -f $WORKSPACE/tools/jenkins/jacoco.xml -Dexamplesrcdir=$WORKSPACE -Dbuilddir=$BUILDFOLDER/${sourcepath} -Djarfile=$BUILDFOLDER/simgrid.jar -Djacocodir=${JACOCO_PATH}/lib
84 #convert jacoco xml reports in cobertura xml reports
85 cover2cover.py $BUILDFOLDER/${sourcepath}/report.xml .. ../src/bindings/java src/bindings/java > $BUILDFOLDER/java_coverage_${i}.xml
86 #save jacoco xml report as sonar only allows it
87 mv $BUILDFOLDER/${sourcepath}/report.xml $BUILDFOLDER/jacoco_cov_${i}.xml
91 #convert python coverage reports in xml ones
93 find .. -size +1c -name ".coverage*" -exec mv {} . \;
94 /usr/bin/python3-coverage combine
95 /usr/bin/python3-coverage xml -i -o ./python_coverage.xml
98 #convert all gcov reports to xml cobertura reports
99 gcovr -r . --xml-pretty -e teshsuite -u -o $BUILDFOLDER/xml_coverage.xml
100 xsltproc $WORKSPACE/tools/jenkins/ctest2junit.xsl build/Testing/$( head -n 1 < build/Testing/TAG )/Test.xml > CTestResults_memcheck.xml
102 #generate sloccount report
103 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
105 #upload files to codacy. CODACY_PROJECT_TOKEN must be setup !
106 if ! [ -z $CODACY_PROJECT_TOKEN ]
108 for report in $BUILDFOLDER/java_cov*
110 if [ ! -e "$report" ]; then continue; fi
111 java -jar /home/ci/codacy-coverage-reporter-*-assembly.jar report -l Java -r $report --partial
113 java -jar /home/ci/codacy-coverage-reporter-*-assembly.jar final
115 java -jar /home/ci/codacy-coverage-reporter-*-assembly.jar report -l Python -r $BUILDFOLDER/python_coverage.xml
116 java -jar /home/ci/codacy-coverage-reporter-*-assembly.jar report -l C -f -r $BUILDFOLDER/xml_coverage.xml
117 java -jar /home/ci/codacy-coverage-reporter-*-assembly.jar report -l CPP -f -r $BUILDFOLDER/xml_coverage.xml