* tests/sample-test: Update copyright date to 2007.
[coreutils.git] / README-valgrind
blob5d8a8a36a4aba58ea1c3877f6645b658e731505f
1 #! /bin/bash
2 # Convert this package for use with valgrind.
4 # Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 # 02110-1301, USA.
21 # Convert Makefile.am files:
22 # find tests -name Makefile.am | xargs grep -wl PATH|xargs perl -pi -e \
23 # 's,src(\$\(PATH_SEPARATOR\)\$\$PATH),src/vg$1,'
24 # To restore:
25 # find tests -name Makefile.am|xargs grep -wl PATH|xargs perl -pi -e 's,src/vg,src,'
27 # Create this symlink for suppressions (this is no longer necessary,
28 # with linux-2.6.9 and valgrind-2.2.0):
29 # ln -s $PWD/.vg-suppressions /tmp/cu-vg
31 # Create src/vg:
33 coreutils=$(echo 'spy:;@echo $(all_programs)' | (cd src; make -f Makefile -f - spy | tr -s '\n ' ' '))
34 mkdir -p src/vg
35 pwd=`pwd`
36 srcdir=$pwd/src
37 _path='export PATH='$srcdir':${PATH#*:}'
38 pre='#!/bin/sh\n'"$_path"'\n'
39 n=15
40 vg='exec /usr/bin/valgrind --suppressions=/tmp/cu-vg --log-fd=3 --leak-check=yes --track-fds=yes --leak-check=full --num-callers='$n
41 cat <<EOF > src/vg/gen
42 for i in $coreutils; do
43 printf "$pre$vg -- \$i"' "\$@"\n' > \$i
44 chmod a+x \$i
45 done
46 EOF
47 cd src/vg
48 . ./gen