Logo AND Algorithmique Numérique Distribuée

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