Logo AND Algorithmique Numérique Distribuée

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