Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
get it to compile on clang on my machine
[simgrid.git] / buildtools / jenkins / run.sh
1 #!/bin/bash
2
3 WORKSPACE=$1
4 build_mode=$2
5
6 # usage: die status message...
7 die () {
8   local status=${1:-1}
9   shift
10   [ $# -gt 0 ] || set -- "Error - Halting"
11   echo "$@" >&2
12   exit $status
13 }
14
15 ulimit -c 0
16
17 rm -rf $WORKSPACE/build
18
19 mkdir $WORKSPACE/build
20 cd $WORKSPACE/build
21
22 export PATH=./lib/:../../lib:$PATH
23
24 if test "$(uname -o)" = "Msys"
25 then
26     #$NUMBER_OF_PROCESSORS should be already set on win
27     if [ -z "$NUMBER_OF_PROCESSORS" ]; then
28         NUMBER_OF_PROCESSORS=1
29     fi
30
31     cmake -G "MSYS Makefiles" -Denable_documentation=OFF $WORKSPACE || die 1 "Failed to do the first cmake - Halting"
32
33     make dist VERBOSE=1|| die 2 "Failed to build dist - Halting"
34
35     cmake -G "MSYS Makefiles" -Denable_java=ON -Denable_model-checking=OFF -Denable_lua=OFF -Denable_compile_optimizations=ON  -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=ON -Denable_compile_warnings=OFF -Denable_documentation=OFF . \
36     || die 5 "Failed to perform the Cmake for $build_mode - Halting"
37
38     make -j$NUMBER_OF_PROCESSORS VERBOSE=1|| die 5 "Build failure - Halting"
39
40     make nsis VERBOSE=1|| die 6 "Failure while generating the Windows executable - Halting"
41
42 else
43     # Linux:
44     cpuinfo_file="/proc/cpuinfo"
45     NUMBER_OF_PROCESSORS=$(lscpu -p 2>/dev/null | grep -c '^[^#]') || \
46     NUMBER_OF_PROCESSORS=$(grep -c "^processor[[:space:]]*:" ${cpuinfo_file} 2>/dev/null)
47     [ "0$NUMBER_OF_PROCESSORS" -gt 0 ] || NUMBER_OF_PROCESSORS=1
48
49     cmake -Denable_documentation=OFF $WORKSPACE || die 1 "Failed to do the first cmake - Halting"
50
51     rm Simgrid*.tar.gz
52     make dist VERBOSE=1 || die 2 "Failed to build dist - Halting"
53
54     tar xzf `cat VERSION`.tar.gz || die 3 "Failed to extract the generated tgz - Halting"
55
56     cd `cat VERSION` || die 4 "Path `cat VERSION` cannot be found - Halting"
57
58     if [ "$build_mode" = "Debug" ]
59     then
60     cmake -Denable_documentation=OFF -Denable_coverage=OFF -Denable_java=ON -Denable_model-checking=OFF -Denable_lua=ON -Denable_compile_optimizations=ON  -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=ON -Denable_compile_warnings=ON .
61     fi
62
63     if [ "$build_mode" = "ModelChecker" ]
64     then
65     cmake -Denable_documentation=OFF -Denable_coverage=OFF -Denable_java=ON -Denable_smpi=ON -Denable_model-checking=ON -Denable_lua=ON -Denable_compile_optimizations=OFF -Denable_compile_warnings=ON .
66     fi
67
68     if [ "$build_mode" = "DynamicAnalysis" ]
69     then
70     cmake -Denable_documentation=OFF -Denable_lua=OFF -Denable_java=ON -Denable_tracing=ON -Denable_smpi=ON -Denable_compile_optimizations=OFF -Denable_compile_warnings=ON -Denable_lib_static=OFF -Denable_model-checking=OFF -Denable_latency_bound_tracking=OFF -Denable_gtnets=OFF -Denable_jedule=OFF -Denable_mallocators=OFF -Denable_memcheck=ON .
71     fi
72
73     [ $? -eq 0 ] || die 5 "Failed to perform the Cmake for $build_mode - Halting"
74
75     make -j$NUMBER_OF_PROCESSORS VERBOSE=1 || die 6 "Build failure - Halting"
76 fi
77
78 echo "running tests with $NUMBER_OF_PROCESSORS processors"
79
80 ctest --output-on-failure -T test --no-compress-output  --timeout 100 -j$NUMBER_OF_PROCESSORS || true
81 if [ -f Testing/TAG ] ; then
82    xsltproc $WORKSPACE/buildtools/jenkins/ctest2junit.xsl -o "$WORKSPACE/CTestResults.xml" Testing/`head -n 1 < Testing/TAG`/Test.xml
83 fi
84
85 ctest -D ContinuousStart
86 ctest -D ContinuousConfigure
87 ctest -D ContinuousBuild
88 ctest -D ContinuousTest
89 ctest -D ContinuousSubmit
90
91 rm -rf `cat VERSION`