Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Try to help the cmake of oldstable to find the java stuff we need
[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_lua=$(onoff test "$build_mode" != "DynamicAnalysis") \
104   -Denable_mallocators=$(onoff test "$build_mode" != "DynamicAnalysis") \
105   -Denable_memcheck=$(onoff test "$build_mode" = "DynamicAnalysis") \
106   -Denable_compile_warnings=ON -Denable_smpi=ON -Denable_lib_static=OFF \
107   -Denable_latency_bound_tracking=OFF -Denable_jedule=OFF \
108   -Denable_tracing=ON -Denable_java=ON
109 make -j$NUMBER_OF_PROCESSORS VERBOSE=1
110
111 if test "$(uname -o)" != "Msys"; then
112   cd $WORKSPACE/build
113   cd `cat VERSION`
114 fi
115
116 TRES=0
117
118 echo "XX"
119 echo "XX Run the tests"
120 echo "XX   pwd: `pwd`"
121 echo "XX"
122
123 ctest -T test --output-on-failure --no-compress-output || true
124 if [ -f Testing/TAG ] ; then
125    xsltproc $WORKSPACE/tools/jenkins/ctest2junit.xsl Testing/`head -n 1 < Testing/TAG`/Test.xml > CTestResults.xml
126    mv CTestResults.xml $WORKSPACE
127 fi
128
129 echo "XX"
130 echo "XX Done. Return the results to cmake"
131 echo "XX"
132
133 if [ "$build_mode" = "DynamicAnalysis" ]
134 then
135   ctest -D ContinuousStart
136   ctest -D ContinuousConfigure
137   ctest -D ContinuousBuild
138   ctest -D ContinuousMemCheck
139   ctest -D ContinuousSubmit
140 fi
141
142 ctest -D ContinuousStart
143 ctest -D ContinuousConfigure
144 ctest -D ContinuousBuild
145 ctest -D ContinuousTest
146 ctest -D ContinuousSubmit
147
148 rm -rf `cat VERSION`