Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / tools / jenkins / Flags.sh
1 #!/bin/sh
2
3 set -e
4
5 if [ $# -lt 4 ]
6   then
7     echo "Needs 4 arguments : JAVA MC SMPI DEBUG"
8     exit -1
9 fi
10
11
12
13 die() {
14     echo "$@"
15     exit 1
16 }
17
18 do_cleanup() {
19   for d in "$WORKSPACE/build"
20   do
21     if [ -d "$d" ]
22     then
23       rm -rf "$d" || die "Could not remote $d"
24     fi
25   done
26 }
27
28 # Get an ON/OFF string from a command:
29 onoff() {
30   if "$@" > /dev/null ; then
31     echo ON
32   else
33     echo OFF
34   fi
35 }
36
37 ###¬†Cleanup previous runs
38
39 ! [ -z "$WORKSPACE" ] || die "No WORKSPACE"
40 [ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
41
42 do_cleanup
43
44 for d in "$WORKSPACE/build"
45 do
46   mkdir "$d" || die "Could not create $d"
47 done
48
49 NUMPROC="$(nproc)" || NUMPROC=1
50
51 cd $WORKSPACE/build
52
53 #we can't just receive ON or OFF as values as display is bad in the resulting jenkins matrix
54
55 if [ $1 = "JAVA" ]
56 then 
57   buildjava="ON"
58 else
59   buildjava="OFF"
60 fi
61
62 if [ $2 = "MC" ]
63 then 
64   buildmc="ON"
65 else
66   buildmc="OFF"
67 fi
68
69 if [ $3 = "SMPI" ]
70 then 
71   buildsmpi="ON"
72 else
73   buildsmpi="OFF"
74 fi
75
76 if [ $4 = "DEBUG" ]
77 then 
78   builddebug="ON"
79 else
80   builddebug="OFF"
81 fi
82
83
84 echo "Step ${STEP}/${NSTEPS} - Building with java=${buildjava}, debug=${builddebug}, SMPI=${buildsmpi}, MC=${buildmc}" 
85 cmake -Denable_documentation=OFF -Denable_lua=ON -Denable_java=${buildjava} \
86       -Denable_compile_optimizations=OFF -Denable_compile_warnings=ON \
87       -Denable_jedule=ON -Denable_mallocators=ON -Denable_debug=${builddebug} \
88       -Denable_smpi=${buildsmpi} -Denable_smpi_MPICH3_testsuite=${buildsmpi} -Denable_model-checking=${buildmc} \
89       -Denable_memcheck=OFF -Denable_memcheck_xml=OFF -Denable_smpi_ISP_testsuite=OFF \
90       -Denable_ns3=$(onoff test "$buildmc" != "ON") -Denable_coverage=OFF $WORKSPACE
91
92 make -j$NUMPROC
93 make clean
94
95