3 # This script is used by various build projects on Jenkins
5 # See https://ci.inria.fr/simgrid/job/SimGrid-Multi/configure
6 # See https://ci.inria.fr/simgrid/job/Simgrid-Windows/configure
10 # ensure that the locales are set, so that perl keeps its nerves
13 echo "XXXX Cleanup previous attempts. Remaining content of /tmp:"
14 rm -rf /tmp/simgrid-java*
16 find /builds/workspace/SimGrid-Multi/ -name "hs_err_pid*.log" | xargs rm -f
22 if [ -e /usr/lib/jvm/java-7-openjdk-amd64 ] ;
24 export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
27 # usage: die status message...
31 [ $# -gt 0 ] || set -- "Error - Halting"
36 # Get an ON/OFF string from a command:
38 if "$@" > /dev/null ; then
45 # Check that we have what we need, or die quickly.
46 # The paths are not the same on all platforms, unfortunately.
47 #test -e /bin/tar || die 1 "I need tar to compile. Please fix your slave."
48 #test -e /bin/gzip || die 1 "I need gzip to compile. Please fix your slave."
49 #test -e /usr/include/libunwind.h || die 1 "I need libunwind to compile. Please fix your slave."
50 #test -e /usr/include/valgrind/valgrind.h || die 1 "I need valgrind to compile. Please fix your slave."
53 echo "Build mode $build_mode on $(uname -np)" >&2
65 die 1 "Unknown build_mode $build_mode"
69 NUMBER_OF_PROCESSORS="$(nproc)" || NUMBER_OF_PROCESSORS=1
70 GENERATOR="Unix Makefiles"
75 echo "XX Get out of the tree"
77 if [ -d $WORKSPACE/build ]
79 # Windows cannot remove the directory if it's still used by the previous build
80 rm -rf $WORKSPACE/build || sleep 10 && rm -rf $WORKSPACE/build || sleep 10 && rm -rf $WORKSPACE/build
82 mkdir $WORKSPACE/build
86 if dpkg -l libns3-dev 2>&1|grep -q "ii libns3-dev" ; then
89 echo "XX have_NS3: ${have_NS3}"
91 # This is for Windows:
92 PATH="$WORKSPACE/build/lib:$PATH"
95 echo "XX Build the archive out of the tree"
99 cmake -G"$GENERATOR" -Denable_documentation=OFF $WORKSPACE
100 make dist -j$NUMBER_OF_PROCESSORS
101 SIMGRID_VERSION=$(cat VERSION)
104 echo "XX Open the resulting archive"
106 gunzip ${SIMGRID_VERSION}.tar.gz
107 tar xf ${SIMGRID_VERSION}.tar
108 mkdir ${WORKSPACE}/build/${SIMGRID_VERSION}/build
109 cd ${WORKSPACE}/build/${SIMGRID_VERSION}/build
110 SRCFOLDER="${WORKSPACE}/build/${SIMGRID_VERSION}"
113 echo "XX Configure and build SimGrid"
114 echo "XX pwd: "$(pwd)
117 if [ "$build_mode" = "ModelChecker" ] ; then
118 INSTALL="-DCMAKE_INSTALL_PREFIX=/builds/mc_simgrid_install"
119 elif [ "$build_mode" = "Debug" ] ; then
120 INSTALL="-DCMAKE_INSTALL_PREFIX=/builds/simgrid_install"
123 if cmake --version | grep -q 3\.11 ; then
124 # -DCMAKE_DISABLE_SOURCE_CHANGES=ON is broken with java on CMake 3.11
125 # https://gitlab.kitware.com/cmake/cmake/issues/17933
126 MAY_DISABLE_SOURCE_CHANGE=""
128 MAY_DISABLE_SOURCE_CHANGE="-DCMAKE_DISABLE_SOURCE_CHANGES=ON"
131 cmake -G"$GENERATOR" $INSTALL \
132 -Denable_debug=ON -Denable_documentation=OFF -Denable_coverage=OFF \
133 -Denable_model-checking=$(onoff test "$build_mode" = "ModelChecker") \
134 -Denable_smpi_ISP_testsuite=$(onoff test "$build_mode" = "ModelChecker") \
135 -Denable_compile_optimizations=$(onoff test "$build_mode" != "DynamicAnalysis") \
136 -Denable_smpi_MPICH3_testsuite=$(onoff test "$build_mode" = "Debug") \
137 -Denable_mallocators=$(onoff test "$build_mode" != "DynamicAnalysis") \
138 -Denable_memcheck=$(onoff test "$build_mode" = "DynamicAnalysis") \
139 -Denable_compile_warnings=$(onoff test "$GENERATOR" != "MSYS Makefiles") -Denable_smpi=ON \
140 -Denable_ns3=$(onoff test "$have_NS3" = "yes" -a "$build_mode" = "Debug") \
141 -Denable_jedule=OFF -Denable_java=ON -Denable_lua=OFF ${MAY_DISABLE_SOURCE_CHANGE} \
143 # -Denable_lua=$(onoff test "$build_mode" != "DynamicAnalysis") \
146 make -j$NUMBER_OF_PROCESSORS VERBOSE=1
149 echo "XX Run the tests"
150 echo "XX pwd: "$(pwd)
153 ctest -T test --output-on-failure --no-compress-output || true
154 if [ -f Testing/TAG ] ; then
155 xsltproc $WORKSPACE/tools/jenkins/ctest2junit.xsl Testing/$( head -n 1 < Testing/TAG )/Test.xml > CTestResults.xml
156 mv CTestResults.xml $WORKSPACE
159 if test "$(uname)" != "Msys" && test "${build_mode}" = "Debug" -o "${build_mode}" = "ModelChecker" ; then
161 echo "XX Test done. Install everything since it's a regular build, not on a Windows."
164 test "${build_mode}" = "Debug" && rm -rf /builds/simgrid_install
165 test "${build_mode}" = "ModelChecker" && rm -rf /builds/mc_simgrid_install
171 echo "XX Done. Return the results to cmake"