Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove unused jenkins scripts, and document some others
[simgrid.git] / buildtools / jenkins / build.sh
1 #!/bin/sh
2
3 # This script is used by various build projects on Jenkins
4
5 # See https://ci.inria.fr/simgrid/job/SimGrid-Multi/configure
6 # See https://ci.inria.fr/simgrid/job/Simgrid-Windows/configure
7
8 set -e
9
10 # usage: die status message...
11 die () {
12   local status=${1:-1}
13   shift
14   [ $# -gt 0 ] || set -- "Error - Halting"
15   echo "$@" >&2
16   exit $status
17 }
18
19 # Get an ON/OFF string from a command:
20 onoff() {
21   if "$@" > /dev/null ; then
22     echo ON
23   else
24     echo OFF
25   fi
26 }
27
28 build_mode="$1"
29 echo "Build mode $build_mode on $(uname -np)" >&2
30 case "$build_mode" in
31   "Debug")
32   ;;
33
34   "ModelChecker")
35   ;;
36
37   "DynamicAnalysis")
38   ;;
39
40   *)
41     die 1 "Unknown build_mode $build_mode"
42   ;;
43 esac
44
45 if test "$(uname -o)" = "Msys"; then
46   if [ -z "$NUMBER_OF_PROCESSORS" ]; then
47     NUMBER_OF_PROCESSORS=1
48   fi
49   GENERATOR="MSYS Makefiles"
50 else
51   NUMBER_OF_PROCESSORS="$(nproc)" || NUMBER_OF_PROCESSORS=1
52   GENERATOR="Unix Makefiles"
53 fi
54
55 ulimit -c 0 || true
56
57 if test "$(uname -o)" != "Msys"; then
58   echo "XX"
59   echo "XX Get out of the tree"
60   echo "XX"
61   if [ -d $WORKSPACE/build ]
62   then
63     rm -rf $WORKSPACE/build
64   fi
65   mkdir $WORKSPACE/build
66   cd $WORKSPACE/build
67
68   echo "XX"
69   echo "XX Build the archive out of the tree"
70   echo "XX   pwd: `pwd`"
71   echo "XX"
72
73   cmake -G"$GENERATOR" -Denable_documentation=OFF $WORKSPACE
74   make dist -j$NUMBER_OF_PROCESSORS
75
76   echo "XX"
77   echo "XX Open the resulting archive"
78   echo "XX"
79   tar xzf `cat VERSION`.tar.gz
80   cd `cat VERSION`
81 fi
82
83 echo "XX"
84 echo "XX Configure and build SimGrid"
85 echo "XX   pwd: `pwd`"
86 echo "XX"
87 cmake -G"$GENERATOR"\
88   -Denable_debug=ON -Denable_documentation=OFF -Denable_coverage=OFF \
89   -Denable_model-checking=$(onoff test "$build_mode" = "ModelChecker") \
90   -Denable_smpi_ISP_testsuite=$(onoff test "$build_mode" = "ModelChecker") \
91   -Denable_compile_optimizations=$(onoff test "$build_mode" = "Debug") \
92   -Denable_smpi_MPICH3_testsuite=$(onoff test "$build_mode" != "DynamicAnalysis") \
93   -Denable_lua=$(onoff test "$build_mode" != "DynamicAnalysis") \
94   -Denable_mallocators=$(onoff test "$build_mode" != "DynamicAnalysis") \
95   -Denable_memcheck=$(onoff test "$build_mode" = "DynamicAnalysis") \
96   -Denable_compile_warnings=ON -Denable_smpi=ON -Denable_lib_static=OFF \
97   -Denable_latency_bound_tracking=OFF -Denable_jedule=OFF \
98   -Denable_tracing=ON -Denable_java=ON
99 make -j$NUMBER_OF_PROCESSORS VERBOSE=1
100
101 if test "$(uname -o)" != "Msys"; then
102   cd $WORKSPACE/build
103   cd `cat VERSION`
104 fi
105
106 TRES=0
107
108 echo "XX"
109 echo "XX Run the tests"
110 echo "XX   pwd: `pwd`"
111 echo "XX"
112
113 ctest -T test --output-on-failure --no-compress-output || true
114 if [ -f Testing/TAG ] ; then
115    xsltproc $WORKSPACE/buildtools/jenkins/ctest2junit.xsl Testing/`head -n 1 < Testing/TAG`/Test.xml > CTestResults.xml
116    mv CTestResults.xml $WORKSPACE
117 fi
118
119 echo "XX"
120 echo "XX Done. Return the results to cmake"
121 echo "XX"
122
123 if [ "$build_mode" = "DynamicAnalysis" ]
124 then
125   ctest -D ContinuousStart
126   ctest -D ContinuousConfigure
127   ctest -D ContinuousBuild
128   ctest -D ContinuousMemCheck
129   ctest -D ContinuousSubmit
130 fi
131
132 ctest -D ContinuousStart
133 ctest -D ContinuousConfigure
134 ctest -D ContinuousBuild
135 ctest -D ContinuousTest
136 ctest -D ContinuousSubmit
137
138 rm -rf `cat VERSION`