8 [ -n "$WORKSPACE" ] || die "No WORKSPACE"
9 [ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
11 echo "XXXX Cleanup previous attempts. Remaining content of /tmp:"
15 rm -rf /tmp/simgrid-java*
16 rm -rf /var/tmp/simgrid-java*
18 find "$WORKSPACE" -name "hs_err_pid*.log" -exec rm -f {} +
25 BUILDFOLDER=$WORKSPACE/build
27 ### Check the node installation
34 echo "$pkg is installed. Good."
36 die "please install $pkg before proceeding"
41 pkg_check xsltproc gcovr ant cover2cover.py
43 ### Cleanup previous runs
50 rm -rf "$d" || die "Could not remove $d"
52 mkdir "$d" || die "Could not create $d"
56 do_cleanup "$BUILDFOLDER"
58 NUMPROC="$(nproc)" || NUMPROC=1
65 rm -rf xml_coverage.xml
67 ctest -D ExperimentalStart || true
69 cmake -Denable_documentation=OFF -Denable_lua=ON \
70 -Denable_compile_optimizations=OFF -Denable_compile_warnings=ON \
71 -Denable_mallocators=ON \
72 -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=ON -Denable_model-checking=ON \
73 -Denable_smpi_papi=ON \
74 -Denable_memcheck=OFF -Denable_memcheck_xml=OFF -Denable_smpi_ISP_testsuite=ON \
75 -Denable_coverage=ON -DLTO_EXTRA_FLAG="auto" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON "$WORKSPACE"
77 #build with sonarqube scanner wrapper
78 /home/ci/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-outputs make -j$NUMPROC tests
79 JACOCO_PATH="/usr/local/share/jacoco"
80 export JAVA_TOOL_OPTIONS="-javaagent:${JACOCO_PATH}/lib/jacocoagent.jar"
82 export PYTHON_TOOL_OPTIONS="/usr/bin/python3-coverage run --parallel-mode --branch"
84 ctest --no-compress-output -D ExperimentalTest -j$NUMPROC || true
85 ctest -D ExperimentalCoverage || true
87 unset JAVA_TOOL_OPTIONS
88 if [ -f Testing/TAG ] ; then
90 files=$( find . -size +1c -name "jacoco.exec" )
94 sourcepath=$( dirname "$file" )
95 #convert jacoco reports in xml ones
96 ant -f "$WORKSPACE"/tools/jenkins/jacoco.xml -Dexamplesrcdir="$WORKSPACE" -Dbuilddir="$BUILDFOLDER"/"${sourcepath}" -Djarfile="$BUILDFOLDER"/simgrid.jar -Djacocodir=${JACOCO_PATH}/lib
97 #convert jacoco xml reports in cobertura xml reports
98 cover2cover.py "$BUILDFOLDER"/"${sourcepath}"/report.xml .. ../src/bindings/java src/bindings/java > "$BUILDFOLDER"/java_coverage_${i}.xml
99 #save jacoco xml report as sonar only allows it
100 mv "$BUILDFOLDER"/"${sourcepath}"/report.xml "$BUILDFOLDER"/jacoco_cov_${i}.xml
104 #convert python coverage reports in xml ones
106 find .. -size +1c -name ".coverage*" -exec mv {} . \;
107 /usr/bin/python3-coverage combine
108 /usr/bin/python3-coverage xml -i -o ./python_coverage.xml
111 #convert all gcov reports to xml cobertura reports
112 gcovr -r . --xml-pretty -e teshsuite -e examples/smpi/NAS -e examples/smpi/mc -u -o "$BUILDFOLDER"/xml_coverage.xml
113 xsltproc "$WORKSPACE"/tools/jenkins/ctest2junit.xsl build/Testing/"$( head -n 1 < build/Testing/TAG )"/Test.xml > CTestResults_memcheck.xml
115 #generate sloccount report
116 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
118 #generate PVS-studio report
119 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/"
120 pvs-studio-analyzer analyze -f "$BUILDFOLDER"/compile_commands.json -o "$WORKSPACE"/pvs.log $EXCLUDEDPATH -j$NUMPROC
122 # V521 Such expressions using the ',' operator are dangerous. (-> commas in catch.hpp),
123 # V576 Incorrect format. (-> gives false alarms, and already checked elsewhere)
124 # V1042 This file is marked with copyleft license, which requires you to open the derived source code.
125 # V1056 The predefined identifier '__func__' always contains the string 'operator()' inside function body of the overloaded 'operator()'.
126 plog-converter -t xml -o "$WORKSPACE"/pvs.plog -d V521,V576,V1042,V1056 "$WORKSPACE"/pvs.log