File: valgrind.sh

package info (click to toggle)
cppad 2026.00.00.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,584 kB
  • sloc: cpp: 112,960; sh: 6,146; ansic: 179; python: 71; sed: 12; makefile: 10
file content (70 lines) | stat: -rwxr-xr-x 1,947 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#! /bin/bash -eu
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
# SPDX-FileCopyrightText: Bradley M. Bell <bradbell@seanet.com>
# SPDX-FileContributor: 2003-22 Bradley M. Bell
# ----------------------------------------------------------------------------
# bash function that echos and executes a command
echo_eval() {
   echo $*
   eval $*
}
# -----------------------------------------------------------------------------
if [ "$0" != "bin/valgrind.sh" ]
then
   echo "bin/valgrind.sh: must be executed from its parent directory"
   exit 1
fi
if [ "$#" != '0' ]
then
   echo 'usage: bin/valgrind.sh.sh'
   exit 1
fi
# -----------------------------------------------------------------------------
list=`find build -perm -700 -type f | \
   sed -e '/^build\/cppad-*/d'  -e '/\/CMakeFiles\//d'`
for program in $list
do
   arguments=''
   if echo "$program" | grep '\/speed\/' > /dev/null
   then
      arguments='correct none'
   fi
   echo "valgrind $program $arguments 2> valgrind.log"
   valgrind $program $arguments 2> valgrind.log
   if ! grep '^==[0-9]*== ERROR SUMMARY: 0' valgrind.log
   then
      grep 'ERROR SUMMARY' valgrind.log
      exit 1
   fi
   if ! grep '^==[0-9]*== *definitely lost: 0' valgrind.log
   then
      if grep '^==[0-9]*== *definitely lost:' valgrind.log
      then
         exit 1
      fi
   fi
   if ! grep '^==[0-9]*== *indirectly lost: 0' valgrind.log
   then
      if grep '^==[0-9]*== *indirectly lost:' valgrind.log
      then
         exit 1
      fi
   fi
   if ! grep '^==[0-9]*== *possibly lost: 0' valgrind.log
   then
      if grep '^==[0-9]*== *possibly lost:' valgrind.log
      then
         exit 1
      fi
   fi
   if ! grep '^==[0-9]*== *suppressed: 0' valgrind.log
   then
      if grep '^==[0-9]*== *suppressed:' valgrind.log
      then
         exit 1
      fi
   fi
done
# -----------------------------------------------------------------------------
echo 'bin/valgrind.sh: OK'
exit 0