Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
only cleanup previous build when starting a new one. Jenkins needs some data in these...
[simgrid.git] / tools / jenkins / DynamicAnalysis.sh
1 #!/bin/sh
2
3 set -e
4
5 die() {
6     echo "$@"
7     exit 1
8 }
9
10 do_cleanup() {
11   for d in "$WORKSPACE/build" "$WORKSPACE/memcheck"
12   do
13     if [ -d "$d" ]
14     then
15       rm -rf "$d" || die "Could not remote $d"
16     fi
17   done
18   find $WORKSPACE -name "memcheck_test_*.memcheck" -exec rm {} \;
19 }
20
21 ### Check the node installation
22
23 for pkg in xsltproc valgrind 
24 do
25    if dpkg -l |grep -q $pkg 
26    then 
27       echo "$pkg is installed. Good."
28    else 
29       die "please install $pkg before proceeding" 
30    fi
31 done
32
33 if [ -e /usr/local/gcovr-3.1/scripts/gcovr ] 
34 then
35   echo "gcovr is installed, good."
36 else
37   die "Please install /usr/local/gcovr-3.1/scripts/gcovr"
38 fi
39
40 ###¬†Cleanup previous runs
41
42 ! [ -z "$WORKSPACE" ] || die "No WORKSPACE"
43 [ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
44
45 do_cleanup
46
47 for d in "$WORKSPACE/build" "$WORKSPACE/memcheck"
48 do
49   mkdir "$d" || die "Could not create $d"
50 done
51
52 cd $WORKSPACE/build
53
54 ###¬†Proceed with the tests
55
56 cmake -Denable_documentation=OFF -Denable_lua=OFF -Denable_tracing=ON \
57       -Denable_compile_optimizations=OFF -Denable_compile_warnings=ON \
58       -Denable_latency_bound_tracking=OFF -Denable_jedule=OFF -Denable_mallocators=OFF \
59       -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=OFF -Denable_model-checking=OFF \
60       -Denable_memcheck_xml=ON $WORKSPACE
61 make
62
63 ctest -D ExperimentalStart || true
64 ctest -D ExperimentalConfigure || true
65 ctest -D ExperimentalBuild || true
66 ctest -D ExperimentalMemCheck || true
67
68 cd $WORKSPACE/build
69 if [ -f Testing/TAG ] ; then
70    find . -iname "*.memcheck" -exec mv {} $WORKSPACE/memcheck \;
71    mv Testing/`head -n 1 < Testing/TAG`/DynamicAnalysis.xml  $WORKSPACE
72 fi
73
74 make clean
75
76 cmake -Denable_documentation=OFF -Denable_lua=OFF -Denable_tracing=ON \
77       -Denable_compile_optimizations=OFF -Denable_compile_warnings=ON \
78       -Denable_latency_bound_tracking=OFF -Denable_jedule=OFF -Denable_mallocators=OFF \
79       -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=OFF -Denable_model-checking=OFF  \
80       -Denable_memcheck=OFF -Denable_memcheck_xml=OFF -Denable_coverage=ON $WORKSPACE
81
82 make
83 ctest -D ExperimentalStart || true
84 ctest -D ExperimentalConfigure || true
85 ctest -D ExperimentalBuild || true
86 ctest -D ExperimentalTest || true
87 ctest -D ExperimentalCoverage || true
88
89 if [ -f Testing/TAG ] ; then
90    /usr/local/gcovr-3.1/scripts/gcovr -r .. --xml-pretty -o $WORKSPACE/xml_coverage.xml
91    xsltproc $WORKSPACE/tools/jenkins/ctest2junit.xsl Testing/`head -n 1 < Testing/TAG`/Test.xml > CTestResults_memcheck.xml
92    mv CTestResults_memcheck.xml $WORKSPACE
93 fi