Logo AND Algorithmique Numérique Distribuée

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