Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
0c4a2e26448f31ea88c470252ed70d7cb96554c9
[simgrid.git] / buildtools / jenkins / build.sh
1 #!/bin/sh
2
3 set -e
4
5 # usage: die status message...
6 die () {
7   local status=${1:-1}
8   shift
9   [ $# -gt 0 ] || set -- "Error - Halting"
10   echo "$@" >&2
11   exit $status
12 }
13
14 # Get an ON/OFF string from a command:
15 onoff() {
16   if "$@" > /dev/null ; then
17     echo ON
18   else
19     echo OFF
20   fi
21 }
22
23 build_mode="$1"
24 echo "Build mode $build_mode on $(uname -np)" >&2
25 case "$build_mode" in
26   "Debug")
27   ;;
28
29   "ModelChecker")
30   ;;
31
32   "DynamicAnalysis")
33   ;;
34
35   *)
36     die 1 "Unknown build_mode $build_mode"
37   ;;
38 esac
39
40 if test "$(uname -o)" = "Msys"; then
41   if [ -z "$NUMBER_OF_PROCESSORS" ]; then
42     NUMBER_OF_PROCESSORS=1
43   fi
44   GENERATOR="MSYS Makefiles"
45 else
46   NUMBER_OF_PROCESSORS="$(nproc)" || NUMBER_OF_PROCESSORS=1
47   GENERATOR="Unix Makefiles"
48 fi
49
50 ulimit -c 0 || true
51
52 if [ -d $WORKSPACE/build ]
53 then
54   rm -rf $WORKSPACE/build
55 fi
56 mkdir $WORKSPACE/build
57 cd $WORKSPACE/build
58
59 cmake -G"$GENERATOR" -Denable_documentation=OFF $WORKSPACE
60 make dist -j$NUMBER_OF_PROCESSORS
61 tar xzf `cat VERSION`.tar.gz
62 cd `cat VERSION`
63
64 cmake -G"$GENERATOR"\
65   -Denable_debug=ON -Denable_documentation=OFF -Denable_coverage=OFF \
66   -Denable_model-checking=$(onoff test "$build_mode" = "ModelChecker") \
67   -Denable_compile_optimization=$(onoff test "$build_mode" = "Debug") \
68   -Denable_smpi_MPICH3_testsuite=$(onoff test "$build_mode" != "DynamicAnalysis") \
69   -Denable_lua=$(onoff test "$build_mode" != "DynamicAnalysis") \
70   -Denable_mallocators=$(onoff test "$build_mode" != "DynamicAnalysis") \
71   -Denable_memcheck=$(onoff test "$build_mode" = "DynamicAnalysis") \
72   -Denable_compile_warnings=ON -Denable_smpi=ON -Denable_lib_static=OFF \
73   -Denable_latency_bound_tracking=OFF -Denable_gtnets=OFF -Denable_jedule=OFF \
74   -Denable_tracing=ON -Denable_java=ON
75 make -j$NUMBER_OF_PROCESSORS
76
77 cd $WORKSPACE/build
78 cd `cat VERSION`
79
80 TRES=0
81
82 ctest -T test --output-on-failure --no-compress-output || true
83 if [ -f Testing/TAG ] ; then
84    xsltproc $WORKSPACE/buildtools/jenkins/ctest2junit.xsl Testing/`head -n 1 < Testing/TAG`/Test.xml > CTestResults.xml
85    mv CTestResults.xml $WORKSPACE
86 fi
87
88 if [ "$build_mode" = "DynamicAnalysis" ]
89 then
90   ctest -D ContinuousStart
91   ctest -D ContinuousConfigure
92   ctest -D ContinuousBuild
93   ctest -D ContinuousMemCheck
94   ctest -D ContinuousSubmit
95 fi
96
97 ctest -D ContinuousStart
98 ctest -D ContinuousConfigure
99 ctest -D ContinuousBuild
100 ctest -D ContinuousTest
101 ctest -D ContinuousSubmit
102
103 rm -rf `cat VERSION`