Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge remote-tracking branch 'upstream/master' into issue95
[simgrid.git] / tools / jenkins / DynamicAnalysis.sh
1 #!/usr/bin/env sh
2
3 die() {
4     echo "$@"
5     exit 1
6 }
7
8 [ -n "$WORKSPACE" ] || die "No WORKSPACE"
9 [ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
10
11 echo "XXXX Cleanup previous attempts. Remaining content of /tmp:"
12 rm -f /tmp/cc*
13 rm -f /tmp/*.so
14 rm -f /tmp/*.so.*
15 rm -rf /tmp/simgrid-java*
16 rm -rf /var/tmp/simgrid-java*
17 rm -rf /tmp/jvm-*
18 find "$WORKSPACE" -name "hs_err_pid*.log" -exec rm -f {} +
19 ls /tmp
20 df -h
21 echo "XXXX Let's go"
22
23 set -e
24
25 ### Check the node installation
26
27 pkg_check() {
28   for pkg
29   do
30     if command -v "$pkg"
31     then
32        echo "$pkg is installed. Good."
33     else
34        die "please install $pkg before proceeding"
35     fi
36   done
37 }
38
39 pkg_check valgrind pcregrep
40
41 ### Cleanup previous runs
42
43 do_cleanup() {
44   for d
45   do
46     if [ -d "$d" ]
47     then
48       rm -rf "$d" || die "Could not remove $d"
49     fi
50     mkdir "$d" || die "Could not create $d"
51   done
52   find "$WORKSPACE" -name "memcheck_test_*.memcheck" -exec rm {} \;
53 }
54
55 do_cleanup "$WORKSPACE/build" "$WORKSPACE/memcheck"
56
57 NUMPROC="$(nproc)" || NUMPROC=1
58
59 cd "$WORKSPACE"/build
60
61 ### Proceed with the tests
62 ctest -D ExperimentalStart || true
63
64 cmake -Denable_documentation=OFF -Denable_lua=OFF -Denable_python=OFF \
65       -Denable_compile_optimizations=OFF -Denable_compile_warnings=ON \
66       -Denable_mallocators=OFF \
67       -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=OFF -Denable_model-checking=OFF \
68       -Denable_memcheck_xml=ON -DLTO_EXTRA_FLAG="auto" "$WORKSPACE"
69
70
71 make -j$NUMPROC tests
72 ctest --no-compress-output -D ExperimentalTest -j$NUMPROC || true
73
74 cd "$WORKSPACE"/build
75 if [ -f Testing/TAG ] ; then
76    find "$WORKSPACE" -iname "*.memcheck" -exec mv {} "$WORKSPACE"/memcheck \;
77    #remove all "empty" files
78    grep -r -L "error>" "$WORKSPACE"/memcheck | xargs rm -f
79    mv Testing/"$(head -n 1 < Testing/TAG)"/Test.xml  "$WORKSPACE"/DynamicAnalysis.xml
80 fi