Mostly quoting stuff ..
pkg_check() {
for pkg
do
- if command -v $pkg
+ if command -v "$pkg"
then
echo "$pkg is installed. Good."
else
### Cleanup previous runs
-! [ -z "$WORKSPACE" ] || die "No WORKSPACE"
+[ -n "$WORKSPACE" ] || die "No WORKSPACE"
[ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
do_cleanup() {
NUMPROC="$(nproc)" || NUMPROC=1
-cd $BUILDFOLDER
+cd "$BUILDFOLDER"
rm -rf java_cov*
rm -rf jacoco_cov*
rm -rf python_cov*
-Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=ON -Denable_model-checking=ON \
-Denable_smpi_papi=ON \
-Denable_memcheck=OFF -Denable_memcheck_xml=OFF -Denable_smpi_ISP_testsuite=ON \
- -Denable_coverage=ON -DLTO_EXTRA_FLAG="auto" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON $WORKSPACE
+ -Denable_coverage=ON -DLTO_EXTRA_FLAG="auto" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON "$WORKSPACE"
#build with sonarqube scanner wrapper
/home/ci/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-outputs make -j$NUMPROC tests
i=0
for file in $files
do
- sourcepath=$( dirname $file )
+ sourcepath=$( dirname "$file" )
#convert jacoco reports in xml ones
- ant -f $WORKSPACE/tools/jenkins/jacoco.xml -Dexamplesrcdir=$WORKSPACE -Dbuilddir=$BUILDFOLDER/${sourcepath} -Djarfile=$BUILDFOLDER/simgrid.jar -Djacocodir=${JACOCO_PATH}/lib
+ ant -f "$WORKSPACE"/tools/jenkins/jacoco.xml -Dexamplesrcdir="$WORKSPACE" -Dbuilddir="$BUILDFOLDER"/"${sourcepath}" -Djarfile="$BUILDFOLDER"/simgrid.jar -Djacocodir=${JACOCO_PATH}/lib
#convert jacoco xml reports in cobertura xml reports
- cover2cover.py $BUILDFOLDER/${sourcepath}/report.xml .. ../src/bindings/java src/bindings/java > $BUILDFOLDER/java_coverage_${i}.xml
+ cover2cover.py "$BUILDFOLDER"/"${sourcepath}"/report.xml .. ../src/bindings/java src/bindings/java > "$BUILDFOLDER"/java_coverage_${i}.xml
#save jacoco xml report as sonar only allows it
- mv $BUILDFOLDER/${sourcepath}/report.xml $BUILDFOLDER/jacoco_cov_${i}.xml
+ mv "$BUILDFOLDER"/"${sourcepath}"/report.xml "$BUILDFOLDER"/jacoco_cov_${i}.xml
i=$((i + 1))
done
#convert python coverage reports in xml ones
- cd $BUILDFOLDER
+ cd "$BUILDFOLDER"
find .. -size +1c -name ".coverage*" -exec mv {} . \;
/usr/bin/python3-coverage combine
/usr/bin/python3-coverage xml -i -o ./python_coverage.xml
- cd $WORKSPACE
+ cd "$WORKSPACE"
#convert all gcov reports to xml cobertura reports
- gcovr -r . --xml-pretty -e teshsuite -u -o $BUILDFOLDER/xml_coverage.xml
- xsltproc $WORKSPACE/tools/jenkins/ctest2junit.xsl build/Testing/$( head -n 1 < build/Testing/TAG )/Test.xml > CTestResults_memcheck.xml
+ gcovr -r . --xml-pretty -e teshsuite -u -o "$BUILDFOLDER"/xml_coverage.xml
+ xsltproc "$WORKSPACE"/tools/jenkins/ctest2junit.xsl build/Testing/"$( head -n 1 < build/Testing/TAG )"/Test.xml > CTestResults_memcheck.xml
#generate sloccount report
- 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
+ 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
#generate PVS-studio report
EXCLUDEDPATH="-e $WORKSPACE/src/include/catch.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/"
- pvs-studio-analyzer analyze -f $BUILDFOLDER/compile_commands.json -o $WORKSPACE/pvs.log $EXCLUDEDPATH -j$NUMPROC
+ pvs-studio-analyzer analyze -f "$BUILDFOLDER"/compile_commands.json -o "$WORKSPACE"/pvs.log "$EXCLUDEDPATH" -j$NUMPROC
#disable V1042 (copyleft), V521 (commas in catch.hpp)
- plog-converter -t xml -o $WORKSPACE/pvs.plog -d V1042,V521 $WORKSPACE/pvs.log
+ plog-converter -t xml -o "$WORKSPACE"/pvs.plog -d V1042,V521 "$WORKSPACE"/pvs.log
fi || exit 42
pkg_check() {
for pkg
do
- if command -v $pkg
+ if command -v "$pkg"
then
echo "$pkg is installed. Good."
else
### Cleanup previous runs
-! [ -z "$WORKSPACE" ] || die "No WORKSPACE"
+[ -n "$WORKSPACE" ] || die "No WORKSPACE"
[ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
do_cleanup() {
fi
mkdir "$d" || die "Could not create $d"
done
- find $WORKSPACE -name "memcheck_test_*.memcheck" -exec rm {} \;
+ find "$WORKSPACE" -name "memcheck_test_*.memcheck" -exec rm {} \;
}
do_cleanup "$WORKSPACE/build" "$WORKSPACE/memcheck"
NUMPROC="$(nproc)" || NUMPROC=1
-cd $WORKSPACE/build
+cd "$WORKSPACE"/build
### Proceed with the tests
ctest -D ExperimentalStart || true
-Denable_compile_optimizations=OFF -Denable_compile_warnings=ON \
-Denable_jedule=OFF -Denable_mallocators=OFF \
-Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=OFF -Denable_model-checking=OFF \
- -Denable_memcheck_xml=ON -DLTO_EXTRA_FLAG="auto" $WORKSPACE
+ -Denable_memcheck_xml=ON -DLTO_EXTRA_FLAG="auto" "$WORKSPACE"
make -j$NUMPROC tests
ctest --no-compress-output -D ExperimentalTest -j$NUMPROC || true
-cd $WORKSPACE/build
+cd "$WORKSPACE"/build
if [ -f Testing/TAG ] ; then
- find $WORKSPACE -iname "*.memcheck" -exec mv {} $WORKSPACE/memcheck \;
+ find "$WORKSPACE" -iname "*.memcheck" -exec mv {} "$WORKSPACE"/memcheck \;
#remove all "empty" files
- grep -r -L "error>" $WORKSPACE/memcheck | xargs rm -f
- mv Testing/$(head -n 1 < Testing/TAG)/Test.xml $WORKSPACE/DynamicAnalysis.xml
+ grep -r -L "error>" "$WORKSPACE"/memcheck | xargs rm -f
+ mv Testing/"$(head -n 1 < Testing/TAG)"/Test.xml "$WORKSPACE"/DynamicAnalysis.xml
fi
-
### Cleanup previous runs
-! [ -z "$WORKSPACE" ] || die "No WORKSPACE"
+[ -n "$WORKSPACE" ] || die "No WORKSPACE"
[ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
do_cleanup() {
NUMPROC="$(nproc)" || NUMPROC=1
-cd $WORKSPACE/build
+cd "$WORKSPACE"/build
#we can't just receive ON or OFF as values as display is bad in the resulting jenkins matrix
-if [ $1 = "JAVA" ]
+if [ "$1" = "JAVA" ]
then
buildjava="ON"
else
buildjava="OFF"
fi
-if [ $2 = "MC" ]
+if [ "$2" = "MC" ]
then
buildmc="ON"
else
buildmc="OFF"
fi
-if [ $3 = "SMPI" ]
+if [ "$3" = "SMPI" ]
then
buildsmpi="ON"
else
buildsmpi="OFF"
fi
-if [ $4 = "DEBUG" ]
+if [ "$4" = "DEBUG" ]
then
builddebug="ON"
else
builddebug="OFF"
fi
-if [ $5 = "MSG" ]
+if [ "$5" = "MSG" ]
then
buildmsg="ON"
else
-Denable_jedule=ON -Denable_mallocators=ON -Denable_debug=${builddebug} \
-Denable_smpi=${buildsmpi} -Denable_smpi_MPICH3_testsuite=${buildsmpi} -Denable_model-checking=${buildmc} \
-Denable_memcheck=OFF -Denable_memcheck_xml=OFF -Denable_smpi_ISP_testsuite=OFF \
- -Denable_ns3=$(onoff test "$buildmc" != "ON") -Denable_coverage=OFF -DLTO_EXTRA_FLAG="auto" $WORKSPACE
+ -Denable_ns3=$(onoff test "$buildmc" != "ON") -Denable_coverage=OFF -DLTO_EXTRA_FLAG="auto" "$WORKSPACE"
make -j$NUMPROC tests
make clean
-
-
pkg_check() {
for pkg
do
- if command -v $pkg
+ if command -v "$pkg"
then
echo "$pkg is installed. Good."
else
### Cleanup previous runs
-! [ -z "$WORKSPACE" ] || die "No WORKSPACE"
+[ -n "$WORKSPACE" ] || die "No WORKSPACE"
[ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
do_cleanup() {
NUMPROC="$(nproc)" || NUMPROC=1
-cd $WORKSPACE/build
+cd "$WORKSPACE"/build
ctest -D ExperimentalStart || true
-Denable_jedule=ON -Denable_mallocators=OFF \
-Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=ON -Denable_model-checking=OFF \
-Denable_memcheck=OFF -Denable_memcheck_xml=OFF -Denable_smpi_ISP_testsuite=ON -Denable_coverage=OFF\
- -Denable_fortran=OFF -Denable_python=OFF -DLTO_EXTRA_FLAG="auto" ${SANITIZER_OPTIONS} $WORKSPACE
+ -Denable_fortran=OFF -Denable_python=OFF -DLTO_EXTRA_FLAG="auto" "${SANITIZER_OPTIONS}" "$WORKSPACE"
make -j$NUMPROC tests
ctest --no-compress-output -D ExperimentalTest || true
if [ -f Testing/TAG ] ; then
- xsltproc $WORKSPACE/tools/jenkins/ctest2junit.xsl Testing/$(head -n 1 < Testing/TAG)/Test.xml > CTestResults_${SANITIZER}.xml
- mv CTestResults_${SANITIZER}.xml $WORKSPACE
+ xsltproc "$WORKSPACE"/tools/jenkins/ctest2junit.xsl Testing/"$(head -n 1 < Testing/TAG)"/Test.xml > CTestResults_"${SANITIZER}".xml
+ mv CTestResults_"${SANITIZER}".xml "$WORKSPACE"
fi
make clean
shift
[ $# -gt 0 ] || set -- "Error - Halting"
echo "$@" >&2
- exit $status
+ exit "$status"
}
# Get an ON/OFF string from a command:
echo "XX"
echo "XX Get out of the tree"
echo "XX"
-if [ -d $WORKSPACE/build ]
+if [ -d "$WORKSPACE"/build ]
then
# Windows cannot remove the directory if it's still used by the previous build
- rm -rf $WORKSPACE/build || sleep 10 && rm -rf $WORKSPACE/build || sleep 10 && rm -rf $WORKSPACE/build
+ rm -rf "$WORKSPACE"/build || sleep 10 && rm -rf "$WORKSPACE"/build || sleep 10 && rm -rf "$WORKSPACE"/build
fi
-mkdir $WORKSPACE/build
-cd $WORKSPACE/build
+mkdir "$WORKSPACE"/build
+cd "$WORKSPACE"/build
have_NS3="no"
if dpkg -l libns3-dev 2>&1|grep -q "ii libns3-dev" ; then
echo "XX"
echo "XX Build the archive out of the tree"
-echo "XX pwd: "$(pwd)
+echo "XX pwd: $(pwd)"
echo "XX"
-cmake -G"$GENERATOR" -Denable_documentation=OFF $WORKSPACE
+cmake -G"$GENERATOR" -Denable_documentation=OFF "$WORKSPACE"
make dist -j $NUMBER_OF_PROCESSORS
SIMGRID_VERSION=$(cat VERSION)
echo "XX"
echo "XX Open the resulting archive"
echo "XX"
-gunzip ${SIMGRID_VERSION}.tar.gz
-tar xf ${SIMGRID_VERSION}.tar
-mkdir ${WORKSPACE}/build/${SIMGRID_VERSION}/build
-cd ${WORKSPACE}/build/${SIMGRID_VERSION}/build
+gunzip "${SIMGRID_VERSION}".tar.gz
+tar xf "${SIMGRID_VERSION}".tar
+mkdir "${WORKSPACE}"/build/"${SIMGRID_VERSION}"/build
+cd "${WORKSPACE}"/build/"${SIMGRID_VERSION}"/build
SRCFOLDER="${WORKSPACE}/build/${SIMGRID_VERSION}"
echo "XX"
echo "XX Configure and build SimGrid"
-echo "XX pwd: "$(pwd)
+echo "XX pwd: $(pwd)"
echo "XX"
set -x
-Denable_java=$(onoff test "$build_mode" = "ModelChecker") \
-Denable_msg=$(onoff test "$build_mode" = "ModelChecker") \
-DLTO_EXTRA_FLAG="auto" \
- $SRCFOLDER
+ "$SRCFOLDER"
# -Denable_lua=$(onoff test "$build_mode" != "DynamicAnalysis") \
set +x
ctest -T test --output-on-failure --no-compress-output || true
-if test -n "$INSTALL" && [ ${branch_name} = "origin/master" ] ; then
+if test -n "$INSTALL" && [ "${branch_name}" = "origin/master" ] ; then
echo "XX"
echo "XX Test done. Install everything since it's a regular build, not on a Windows."
echo "XX"
then
BOOST=$(grep -m 1 "Found Boost:" ./consoleText | sed "s/.*-- Found Boost:.*found suitable version \"\([a-zA-Z0-9\.]*\)\",.*/\1/g")
fi
- echo $BOOST
+ echo "$BOOST"
}
get_compiler(){
get_ns3(){
found=$(grep -c "ns-3 found" ./consoleText)
- if [ $found != 0 ]; then
+ if [ "$found" != 0 ]; then
echo "✔"
else
echo ""
get_python(){
found=$(grep -c "Compile Python bindings .....: ON" ./consoleText)
- if [ $found != 0 ]; then
+ if [ "$found" != 0 ]; then
grep -m 1 "Found PythonInterp" ./consoleText| sed "s/.*-- Found PythonInterp.*found suitable version \"\([a-zA-Z0-9\.]*\)\",.*/\1/g"
else
echo ""
fi
-if [ -z $BUILD_URL ]; then
+if [ -z "$BUILD_URL" ]; then
BUILD_URL="https://ci.inria.fr/simgrid/job/SimGrid/lastBuild"
fi
v1[i] = parseInt(v1[i], 10);
v2[i] = parseInt(v2[i], 10);
if (v1[i] > v2[i]) return 1;
- if (v1[i] < v2[i]) return -1;
+ if (v1[i] < v2[i]) return -1;
}
return v1.length == v2.length ? 0: (v1.length < v2.length ? -1 : 1);
}</script>
color1=""
color2=""
#in case of success, replace blue by green in status balls
- wget --quiet https://ci.inria.fr/simgrid/buildStatus/text?job=SimGrid%2Fbuild_mode%3DDebug%2Cnode%3D${node} -O status >/dev/null 2>&1
+ wget --quiet https://ci.inria.fr/simgrid/buildStatus/text?job=SimGrid%2Fbuild_mode%3DDebug%2Cnode%3D"${node}" -O status >/dev/null 2>&1
status=$(cat status)
- if [ $status == "Success" ]; then
+ if [ "$status" == "Success" ]; then
color1="&color=green"
fi
rm status
statusmc="<img src=https://ci.inria.fr/simgrid/images/24x24/grey.png>"
- wget --quiet https://ci.inria.fr/simgrid/buildStatus/text?job=SimGrid%2Fbuild_mode%3DModelChecker%2Cnode%3D${node} -O status >/dev/null 2>&1
+ wget --quiet https://ci.inria.fr/simgrid/buildStatus/text?job=SimGrid%2Fbuild_mode%3DModelChecker%2Cnode%3D"${node}" -O status >/dev/null 2>&1
status=$(cat status)
- if [ $status ]; then
- if [ $status == "Success" ]; then
+ if [ "$status" ]; then
+ if [ "$status" == "Success" ]; then
color2="&color=green"
fi
statusmc="<a href=\"build_mode=ModelChecker,node=${node}/\"><img src=\"https://ci.inria.fr/simgrid/job/SimGrid/build_mode=ModelChecker,node=${node}/badge/icon?style=ball-24x24${color2}\"/>"
fi
rm status
- echo "<tr> <td class=\"matrix-leftcolumn\">$node</td><td class=\"matrix-cell\" style=\"text-align:left\">$os</td><td class=\"matrix-cell\" style=\"text-align:left\">$compiler</td><td class=\"matrix-cell\" style=\"text-align:left\">$boost</td><td class=\"matrix-cell\" style=\"text-align:left\">$java</td><td class=\"matrix-cell\" style=\"text-align:left\">$cmake</td><td class=\"matrix-cell\" style=\"text-align:center\">$ns3</td><td class=\"matrix-cell\" style=\"text-align:center\">$py</td><td class="matrix-cell" style="text-align:center"><a href="build_mode=Debug,node=${node}/"><img src="https://ci.inria.fr/simgrid/job/SimGrid/build_mode=Debug,node=${node}/badge/icon?style=ball-24x24${color1}"/></td><td class="matrix-cell" style="text-align:center">${statusmc}</td></tr>"
+ echo "<tr> <td class=\"matrix-leftcolumn\">$node</td><td class=\"matrix-cell\" style=\"text-align:left\">$os</td><td class=\"matrix-cell\" style=\"text-align:left\">$compiler</td><td class=\"matrix-cell\" style=\"text-align:left\">$boost</td><td class=\"matrix-cell\" style=\"text-align:left\">$java</td><td class=\"matrix-cell\" style=\"text-align:left\">$cmake</td><td class=\"matrix-cell\" style=\"text-align:center\">$ns3</td><td class=\"matrix-cell\" style=\"text-align:center\">$py</td><td class=\"matrix-cell\" style=\"text-align:center\"><a href=\"build_mode=Debug,node=${node}/\"><img src=\"https://ci.inria.fr/simgrid/job/SimGrid/build_mode=Debug,node=${node}/badge/icon?style=ball-24x24${color1}\"/></td><td class=\"matrix-cell\" style=\"text-align:center\">${statusmc}</td></tr>"
rm consoleText
done
#Travis - get ID of the last jobs with the API
BUILD_NUM=$(curl -s 'https://api.travis-ci.org/repos/simgrid/simgrid/builds?limit=1' | grep -o '^\[{"id":[0-9]*,' | grep -o '[0-9]' | tr -d '\n')
-BUILDS=($(curl -s https://api.travis-ci.org/repos/simgrid/simgrid/builds/${BUILD_NUM} | grep -o '{"id":[0-9]*,' | grep -o '[0-9]*'| tail -n 3))
-OS=($(curl -s https://api.travis-ci.org/repos/simgrid/simgrid/builds/${BUILD_NUM} | grep -o '"os":"[a-z]*",' | sed 's/"os":"\([a-z]*\)",/\1/g'| tail -n 3))
+BUILDS=($(curl -s https://api.travis-ci.org/repos/simgrid/simgrid/builds/"${BUILD_NUM}" | grep -o '{"id":[0-9]*,' | grep -o '[0-9]*'| tail -n 3))
+OS=($(curl -s https://api.travis-ci.org/repos/simgrid/simgrid/builds/"${BUILD_NUM}" | grep -o '"os":"[a-z]*",' | sed 's/"os":"\([a-z]*\)",/\1/g'| tail -n 3))
for id in "${!BUILDS[@]}"
do
- wget --quiet https://api.travis-ci.org/v3/job/${BUILDS[$id]}/log.txt -O ./consoleText >/dev/null 2>&1
+ wget --quiet https://api.travis-ci.org/v3/job/"${BUILDS[$id]}"/log.txt -O ./consoleText >/dev/null 2>&1
sed -i -e "s/\r//g" ./consoleText
- if [ ${OS[$id]} == "linux" ]; then
+ if [ "${OS[$id]}" == "linux" ]; then
node="travis-linux (<a href=\"https://travis-ci.org/simgrid/simgrid/jobs/${BUILDS[$id]}\">log</a>)"
os="Ubuntu <a href=\"https://docs.travis-ci.com/user/reference/bionic/\">18.04 bionic</a>"
- elif [ ${OS[$id]} == "osx" ]; then
+ elif [ "${OS[$id]}" == "osx" ]; then
node="travis-mac (<a href=\"https://travis-ci.org/simgrid/simgrid/jobs/${BUILDS[$id]}\">log</a>)"
os="Mac OS X <a href=\"https://docs.travis-ci.com/user/reference/osx/\">Catalina (10.15)</a> "
- elif [ ${OS[$id]} == "windows" ]; then
+ elif [ "${OS[$id]}" == "windows" ]; then
node="travis-windows (<a href=\"https://travis-ci.org/simgrid/simgrid/jobs/${BUILDS[$id]}\">log</a>)"
os="Windows <a href=\"https://docs.travis-ci.com/user/reference/windows/\">Server 1809</a>"
fi
#Appveyor - get ID of the last job with the API
BUILD_ID=$(curl -s "https://ci.appveyor.com/api/projects/mquinson/simgrid" | grep -o '\[{"jobId":"[a-zA-Z0-9]*",' | sed "s/\[{\"jobId\":\"//" | sed "s/\",//")
-wget --quiet https://ci.appveyor.com/api/buildjobs/$BUILD_ID/log -O ./consoleText >/dev/null 2>&1
+wget --quiet https://ci.appveyor.com/api/buildjobs/"$BUILD_ID"/log -O ./consoleText >/dev/null 2>&1
sed -i -e "s/\r//g" ./consoleText
-node="<a href="https://ci.appveyor.com/project/mquinson/simgrid">appveyor</a>"
+node="<a href=\"https://ci.appveyor.com/project/mquinson/simgrid\">appveyor</a>"
os="Windows Server 2012 - VS2015 + mingw64 5.3.0"
boost=$(get_boost)
compiler=$(get_compiler)