5 BUILDFOLDER=$WORKSPACE/build
12 ### Check the node installation
19 echo "$pkg is installed. Good."
21 die "please install $pkg before proceeding"
26 pkg_check xsltproc gcovr ant cover2cover.py
28 ### Cleanup previous runs
30 [ -n "$WORKSPACE" ] || die "No WORKSPACE"
31 [ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
38 rm -rf "$d" || die "Could not remove $d"
40 mkdir "$d" || die "Could not create $d"
44 do_cleanup "$BUILDFOLDER"
46 NUMPROC="$(nproc)" || NUMPROC=1
53 rm -rf xml_coverage.xml
55 ctest -D ExperimentalStart || true
57 cmake -Denable_documentation=OFF -Denable_lua=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 \
63 -Denable_coverage=ON -DLTO_EXTRA_FLAG="auto" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON "$WORKSPACE"
65 #build with sonarqube scanner wrapper
66 /home/ci/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-outputs make -j$NUMPROC tests
67 JACOCO_PATH="/usr/local/share/jacoco"
68 export JAVA_TOOL_OPTIONS="-javaagent:${JACOCO_PATH}/lib/jacocoagent.jar"
70 export PYTHON_TOOL_OPTIONS="/usr/bin/python3-coverage run --parallel-mode --branch"
72 ctest --no-compress-output -D ExperimentalTest -j$NUMPROC || true
73 ctest -D ExperimentalCoverage || true
75 unset JAVA_TOOL_OPTIONS
76 if [ -f Testing/TAG ] ; then
78 files=$( find . -size +1c -name "jacoco.exec" )
82 sourcepath=$( dirname "$file" )
83 #convert jacoco reports in xml ones
84 ant -f "$WORKSPACE"/tools/jenkins/jacoco.xml -Dexamplesrcdir="$WORKSPACE" -Dbuilddir="$BUILDFOLDER"/"${sourcepath}" -Djarfile="$BUILDFOLDER"/simgrid.jar -Djacocodir=${JACOCO_PATH}/lib
85 #convert jacoco xml reports in cobertura xml reports
86 cover2cover.py "$BUILDFOLDER"/"${sourcepath}"/report.xml .. ../src/bindings/java src/bindings/java > "$BUILDFOLDER"/java_coverage_${i}.xml
87 #save jacoco xml report as sonar only allows it
88 mv "$BUILDFOLDER"/"${sourcepath}"/report.xml "$BUILDFOLDER"/jacoco_cov_${i}.xml
92 #convert python coverage reports in xml ones
94 find .. -size +1c -name ".coverage*" -exec mv {} . \;
95 /usr/bin/python3-coverage combine
96 /usr/bin/python3-coverage xml -i -o ./python_coverage.xml
99 #convert all gcov reports to xml cobertura reports
100 gcovr -r . --xml-pretty -e teshsuite -u -o "$BUILDFOLDER"/xml_coverage.xml
101 xsltproc "$WORKSPACE"/tools/jenkins/ctest2junit.xsl build/Testing/"$( head -n 1 < build/Testing/TAG )"/Test.xml > CTestResults_memcheck.xml
103 #generate sloccount report
104 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
106 #generate PVS-studio report
107 EXCLUDEDPATH="-e $WORKSPACE/src/include/catch.hpp -e $WORKSPACE/src/include/xxhash.hpp -e $WORKSPACE/teshsuite/smpi/mpich3-test/ -e $WORKSPACE/teshsuite/smpi/isp/ -e *_dtd.c -e *_dtd.h -e *yy.c -e $WORKSPACE/src/xbt/automaton/ -e $WORKSPACE/src/smpi/colls/ -e $WORKSPACE/examples/smpi/NAS/ -e $WORKSPACE/examples/smpi/gemm/gemm.c -e $WORKSPACE/src/msg/ -e $WORKSPACE/include/msg/ -e $WORKSPACE/examples/deprecated/ -e $WORKSPACE/teshsuite/msg/"
108 pvs-studio-analyzer analyze -f "$BUILDFOLDER"/compile_commands.json -o "$WORKSPACE"/pvs.log $EXCLUDEDPATH -j$NUMPROC
109 #disable V1042 (copyleft), V521 (commas in catch.hpp)
110 plog-converter -t xml -o "$WORKSPACE"/pvs.plog -d V1042,V521 "$WORKSPACE"/pvs.log