Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Use std::unique_ptr for Process::heap
[simgrid.git] / tools / jenkins / build.sh
1 #!/bin/sh
2
3 # This script is used by various build projects on Jenkins
4
5 # See https://ci.inria.fr/simgrid/job/SimGrid-Multi/configure
6 # See https://ci.inria.fr/simgrid/job/Simgrid-Windows/configure
7
8 set -e
9
10 # Cleanup previous attempts
11 rm -rf /tmp/simgrid*tmp
12 rm -rf /tmp/surf-java*tmp
13
14 # Help older cmakes
15 if [ -e /usr/lib/jvm/java-7-openjdk-amd64 ] ; 
16 then
17   export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
18 fi
19
20 # usage: die status message...
21 die () {
22   local status=${1:-1}
23   shift
24   [ $# -gt 0 ] || set -- "Error - Halting"
25   echo "$@" >&2
26   exit $status
27 }
28
29 # Get an ON/OFF string from a command:
30 onoff() {
31   if "$@" > /dev/null ; then
32     echo ON
33   else
34     echo OFF
35   fi
36 }
37
38 build_mode="$1"
39 echo "Build mode $build_mode on $(uname -np)" >&2
40 case "$build_mode" in
41   "Debug")
42   ;;
43
44   "ModelChecker")
45   ;;
46
47   "DynamicAnalysis")
48   ;;
49
50   *)
51     die 1 "Unknown build_mode $build_mode"
52   ;;
53 esac
54
55 if test "$(uname -o)" = "Msys"; then
56   if [ -z "$NUMBER_OF_PROCESSORS" ]; then
57     NUMBER_OF_PROCESSORS=1
58   fi
59   GENERATOR="MSYS Makefiles"
60 else
61   NUMBER_OF_PROCESSORS="$(nproc)" || NUMBER_OF_PROCESSORS=1
62   GENERATOR="Unix Makefiles"
63 fi
64
65 ulimit -c 0 || true
66
67 if test "$(uname -o)" != "Msys"; then
68   echo "XX"
69   echo "XX Get out of the tree"
70   echo "XX"
71   if [ -d $WORKSPACE/build ]
72   then
73     rm -rf $WORKSPACE/build
74   fi
75   mkdir $WORKSPACE/build
76   cd $WORKSPACE/build
77
78   echo "XX"
79   echo "XX Build the archive out of the tree"
80   echo "XX   pwd: `pwd`"
81   echo "XX"
82
83   cmake -G"$GENERATOR" -Denable_documentation=OFF $WORKSPACE
84   make dist -j$NUMBER_OF_PROCESSORS
85
86   echo "XX"
87   echo "XX Open the resulting archive"
88   echo "XX"
89   tar xzf `cat VERSION`.tar.gz
90   cd `cat VERSION`
91 fi
92
93 echo "XX"
94 echo "XX Configure and build SimGrid"
95 echo "XX   pwd: `pwd`"
96 echo "XX"
97 cmake -G"$GENERATOR"\
98   -Denable_debug=ON -Denable_documentation=OFF -Denable_coverage=OFF \
99   -Denable_model-checking=$(onoff test "$build_mode" = "ModelChecker") \
100   -Denable_smpi_ISP_testsuite=$(onoff test "$build_mode" = "ModelChecker") \
101   -Denable_compile_optimizations=$(onoff test "$build_mode" = "Debug") \
102   -Denable_smpi_MPICH3_testsuite=$(onoff test "$build_mode" != "DynamicAnalysis") \
103   -Denable_mallocators=$(onoff test "$build_mode" != "DynamicAnalysis") \
104   -Denable_memcheck=$(onoff test "$build_mode" = "DynamicAnalysis") \
105   -Denable_compile_warnings=ON -Denable_smpi=ON \
106   -Denable_latency_bound_tracking=OFF -Denable_jedule=OFF \
107   -Denable_tracing=ON -Denable_java=ON -Denable_lua=OFF
108 #  -Denable_lua=$(onoff test "$build_mode" != "DynamicAnalysis") \
109
110
111 make -j$NUMBER_OF_PROCESSORS VERBOSE=1
112
113 if test "$(uname -o)" != "Msys"; then
114   cd $WORKSPACE/build
115   cd `cat VERSION`
116 fi
117
118 TRES=0
119
120 echo "XX"
121 echo "XX Run the tests"
122 echo "XX   pwd: `pwd`"
123 echo "XX"
124
125 ctest -T test --output-on-failure --no-compress-output || true
126 if [ -f Testing/TAG ] ; then
127    xsltproc $WORKSPACE/tools/jenkins/ctest2junit.xsl Testing/`head -n 1 < Testing/TAG`/Test.xml > CTestResults.xml
128    mv CTestResults.xml $WORKSPACE
129 fi
130
131 echo "XX"
132 echo "XX Done. Return the results to cmake"
133 echo "XX"
134
135 if [ "$build_mode" = "DynamicAnalysis" ]
136 then
137   ctest -D ContinuousStart
138   ctest -D ContinuousConfigure
139   ctest -D ContinuousBuild
140   ctest -D ContinuousMemCheck
141   ctest -D ContinuousSubmit
142 fi
143
144 ctest -D ContinuousStart
145 ctest -D ContinuousConfigure
146 ctest -D ContinuousBuild
147 ctest -D ContinuousTest
148 ctest -D ContinuousSubmit
149
150 rm -rf `cat VERSION`