Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Polish jenkins scripts without MSG.
[simgrid.git] / tools / jenkins / Flags.sh
1 #!/usr/bin/env sh
2
3 set -e
4
5 echo "Starting Flags.sh $*"
6
7 die() {
8     echo "$@"
9     exit 1
10 }
11
12 # Get an ON/OFF string from a command:
13 onoff() {
14   if "$@" > /dev/null ; then
15     echo ON
16   else
17     echo OFF
18   fi
19 }
20
21 [ $# -eq 3 ] || die "Needs 4 arguments : MC SMPI DEBUG"
22
23 ### Cleanup previous runs
24
25 [ -n "$WORKSPACE" ] || die "No WORKSPACE"
26 [ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
27
28 do_cleanup() {
29   for d
30   do
31     if [ -d "$d" ]
32     then
33       rm -rf "$d" || die "Could not remove $d"
34     fi
35     mkdir "$d" || die "Could not create $d"
36   done
37 }
38
39 do_cleanup "$WORKSPACE/build"
40
41 NUMPROC="$(nproc)" || NUMPROC=1
42
43 cd "$WORKSPACE"/build
44
45 #we can't just receive ON or OFF as values as display is bad in the resulting jenkins matrix
46
47 if [ "$1" = "MC" ]
48 then
49   buildmc="ON"
50 else
51   buildmc="OFF"
52 fi
53
54 if [ "$2" = "SMPI" ]
55 then
56   buildsmpi="ON"
57 else
58   buildsmpi="OFF"
59 fi
60
61 if [ "$3" = "DEBUG" ]
62 then
63   builddebug="ON"
64 else
65   builddebug="OFF"
66 fi
67
68 echo "Step ${STEP}/${NSTEPS} - Building with debug=${builddebug}, SMPI=${buildsmpi}, MC=${buildmc}"
69 cmake -Denable_documentation=OFF \
70       -Denable_compile_optimizations=OFF -Denable_compile_warnings=ON \
71       -Denable_mallocators=ON -Denable_debug=${builddebug} \
72       -Denable_smpi=${buildsmpi} -Denable_smpi_MPICH3_testsuite=${buildsmpi} -Denable_model-checking=${buildmc} \
73       -Denable_memcheck=OFF -Denable_memcheck_xml=OFF -Denable_smpi_MBI_testsuite=OFF \
74       -Denable_ns3=$(onoff test "$buildmc" != "ON") -DNS3_HINT=/builds/ns-3-dev/build/ \
75       -Denable_coverage=OFF -DLTO_EXTRA_FLAG="auto" -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
76       "$WORKSPACE"
77
78 make -j$NUMPROC tests
79 cd ..
80 rm -rf build