Logo AND Algorithmique Numérique Distribuée

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