Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[appveyor] request the image that is intended for MinGW
[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 test "$(uname -o)" != "Msys"; then
53   echo "XX"
54   echo "XX Get out of the tree"
55   echo "XX"
56   if [ -d $WORKSPACE/build ]
57   then
58     rm -rf $WORKSPACE/build
59   fi
60   mkdir $WORKSPACE/build
61   cd $WORKSPACE/build
62
63   echo "XX"
64   echo "XX Build the archive out of the tree"
65   echo "XX   pwd: `pwd`"
66   echo "XX"
67
68   cmake -G"$GENERATOR" -Denable_documentation=OFF $WORKSPACE
69   make dist -j$NUMBER_OF_PROCESSORS
70
71   echo "XX"
72   echo "XX Open the resulting archive"
73   echo "XX"
74   tar xzf `cat VERSION`.tar.gz
75   cd `cat VERSION`
76 fi
77
78 echo "XX"
79 echo "XX Configure and build SimGrid"
80 echo "XX   pwd: `pwd`"
81 echo "XX"
82 cmake -G"$GENERATOR"\
83   -Denable_debug=ON -Denable_documentation=OFF -Denable_coverage=OFF \
84   -Denable_model-checking=$(onoff test "$build_mode" = "ModelChecker") \
85   -Denable_compile_optimizations=$(onoff test "$build_mode" = "Debug") \
86   -Denable_smpi_MPICH3_testsuite=$(onoff test "$build_mode" != "DynamicAnalysis") \
87   -Denable_lua=$(onoff test "$build_mode" != "DynamicAnalysis") \
88   -Denable_mallocators=$(onoff test "$build_mode" != "DynamicAnalysis") \
89   -Denable_memcheck=$(onoff test "$build_mode" = "DynamicAnalysis") \
90   -Denable_compile_warnings=ON -Denable_smpi=ON -Denable_lib_static=OFF \
91   -Denable_latency_bound_tracking=OFF -Denable_gtnets=OFF -Denable_jedule=OFF \
92   -Denable_tracing=ON -Denable_java=ON
93 make -j$NUMBER_OF_PROCESSORS VERBOSE=1
94
95 if test "$(uname -o)" != "Msys"; then
96   cd $WORKSPACE/build
97   cd `cat VERSION`
98 fi
99
100 TRES=0
101
102 echo "XX"
103 echo "XX Run the tests"
104 echo "XX   pwd: `pwd`"
105 echo "XX"
106
107 ctest -T test --output-on-failure --no-compress-output || true
108 if [ -f Testing/TAG ] ; then
109    xsltproc $WORKSPACE/buildtools/jenkins/ctest2junit.xsl Testing/`head -n 1 < Testing/TAG`/Test.xml > CTestResults.xml
110    mv CTestResults.xml $WORKSPACE
111 fi
112
113 echo "XX"
114 echo "XX Done. Return the results to cmake"
115 echo "XX"
116
117 if [ "$build_mode" = "DynamicAnalysis" ]
118 then
119   ctest -D ContinuousStart
120   ctest -D ContinuousConfigure
121   ctest -D ContinuousBuild
122   ctest -D ContinuousMemCheck
123   ctest -D ContinuousSubmit
124 fi
125
126 ctest -D ContinuousStart
127 ctest -D ContinuousConfigure
128 ctest -D ContinuousBuild
129 ctest -D ContinuousTest
130 ctest -D ContinuousSubmit
131
132 rm -rf `cat VERSION`