Logo AND Algorithmique Numérique Distribuée

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