Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
unPERLifies a bit the routing: use the object, not its name
[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 valgrind pcregrep
24 do
25    if command -v $pkg
26    then 
27       echo "$pkg is installed. Good."
28    else 
29       die "please install $pkg before proceeding" 
30    fi
31 done
32
33 ###¬†Cleanup previous runs
34
35 ! [ -z "$WORKSPACE" ] || die "No WORKSPACE"
36 [ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
37
38 do_cleanup
39
40 for d in "$WORKSPACE/build" "$WORKSPACE/memcheck"
41 do
42   mkdir "$d" || die "Could not create $d"
43 done
44
45 NUMPROC="$(nproc)" || NUMPROC=1
46
47 cd $WORKSPACE/build
48
49 ###¬†Proceed with the tests
50 ctest -D ExperimentalStart || true
51
52 cmake -Denable_documentation=OFF -Denable_lua=OFF  \
53       -Denable_compile_optimizations=OFF -Denable_compile_warnings=ON \
54       -Denable_jedule=OFF -Denable_mallocators=OFF \
55       -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=ON -Denable_model-checking=OFF \
56       -Denable_memcheck_xml=ON $WORKSPACE
57
58
59 make -j$NUMPROC
60 ctest -D ExperimentalTest -j$NUMPROC || true
61
62 cd $WORKSPACE/build
63 if [ -f Testing/TAG ] ; then
64    find $WORKSPACE -iname "*.memcheck" -exec mv {} $WORKSPACE/memcheck \;
65    #remove all "empty" files
66    pcregrep -r -l -M "status\>\n\n\<errorcounts" $WORKSPACE/memcheck/* | xargs rm -f
67    mv Testing/`head -n 1 < Testing/TAG`/Test.xml  $WORKSPACE/DynamicAnalysis.xml
68 fi
69