Logo AND Algorithmique Numérique Distribuée

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