Logo AND Algorithmique Numérique Distribuée

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