Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Duplicate cleanup instructions for jenkins builds in other scripts.
[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 -rf /tmp/simgrid-java*
15 rm -rf /var/tmp/simgrid-java*
16 rm -rf /tmp/jvm-*
17 find "$WORKSPACE" -name "hs_err_pid*.log" -exec rm -f {} +
18 ls /tmp
19 df -h
20 echo "XXXX Let's go"
21
22 set -e
23
24 ### Check the node installation
25
26 pkg_check() {
27   for pkg
28   do
29     if command -v "$pkg"
30     then
31        echo "$pkg is installed. Good."
32     else
33        die "please install $pkg before proceeding"
34     fi
35   done
36 }
37
38 pkg_check valgrind pcregrep
39
40 ### Cleanup previous runs
41
42 do_cleanup() {
43   for d
44   do
45     if [ -d "$d" ]
46     then
47       rm -rf "$d" || die "Could not remove $d"
48     fi
49     mkdir "$d" || die "Could not create $d"
50   done
51   find "$WORKSPACE" -name "memcheck_test_*.memcheck" -exec rm {} \;
52 }
53
54 do_cleanup "$WORKSPACE/build" "$WORKSPACE/memcheck"
55
56 NUMPROC="$(nproc)" || NUMPROC=1
57
58 cd "$WORKSPACE"/build
59
60 ### Proceed with the tests
61 ctest -D ExperimentalStart || true
62
63 cmake -Denable_documentation=OFF -Denable_lua=OFF -Denable_python=OFF \
64       -Denable_compile_optimizations=OFF -Denable_compile_warnings=ON \
65       -Denable_jedule=OFF -Denable_mallocators=OFF \
66       -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=OFF -Denable_model-checking=OFF \
67       -Denable_memcheck_xml=ON -DLTO_EXTRA_FLAG="auto" "$WORKSPACE"
68
69
70 make -j$NUMPROC tests
71 ctest --no-compress-output -D ExperimentalTest -j$NUMPROC || true
72
73 cd "$WORKSPACE"/build
74 if [ -f Testing/TAG ] ; then
75    find "$WORKSPACE" -iname "*.memcheck" -exec mv {} "$WORKSPACE"/memcheck \;
76    #remove all "empty" files
77    grep -r -L "error>" "$WORKSPACE"/memcheck | xargs rm -f
78    mv Testing/"$(head -n 1 < Testing/TAG)"/Test.xml  "$WORKSPACE"/DynamicAnalysis.xml
79 fi