Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
9358cf6b9360994cdefe8830b124aff778b6079e
[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 5 ] || die "Needs 5 arguments : JAVA MC SMPI DEBUG MSG"
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" = "JAVA" ]
48 then
49   buildjava="ON"
50 else
51   buildjava="OFF"
52 fi
53
54 if [ "$2" = "MC" ]
55 then
56   buildmc="ON"
57 else
58   buildmc="OFF"
59 fi
60
61 if [ "$3" = "SMPI" ]
62 then
63   buildsmpi="ON"
64 else
65   buildsmpi="OFF"
66 fi
67
68 if [ "$4" = "DEBUG" ]
69 then
70   builddebug="ON"
71 else
72   builddebug="OFF"
73 fi
74
75 if [ "$5" = "MSG" ]
76 then
77   buildmsg="ON"
78 else
79   buildmsg="OFF"
80 fi
81
82 if [ $buildmsg = "OFF" ] && [ $buildjava = "ON" ]
83 then
84   echo "Don't even try to build Java without MSG"
85   exit 0
86 fi
87
88 echo "Step ${STEP}/${NSTEPS} - Building with java=${buildjava}, debug=${builddebug}, SMPI=${buildsmpi}, MC=${buildmc}, MSG=${buildmsg}"
89 cmake -Denable_documentation=OFF -Denable_java=${buildjava} -Denable_msg=${buildmsg} \
90       -Denable_compile_optimizations=OFF -Denable_compile_warnings=ON \
91       -Denable_mallocators=ON -Denable_debug=${builddebug} \
92       -Denable_smpi=${buildsmpi} -Denable_smpi_MPICH3_testsuite=${buildsmpi} -Denable_model-checking=${buildmc} \
93       -Denable_memcheck=OFF -Denable_memcheck_xml=OFF -Denable_smpi_ISP_testsuite=OFF \
94       -Denable_ns3=$(onoff test "$buildmc" != "ON") -Denable_coverage=OFF -DLTO_EXTRA_FLAG="auto" "$WORKSPACE"
95
96 make -j$NUMPROC tests
97 make clean