doc: tweak NEWS and coreutils.texi
[coreutils.git] / README-valgrind
blob151ec2de13c36f893aa263a7191d33274e5c9e39
1 #! /bin/bash
2 # Convert this package for use with valgrind.
4 # Copyright (C) 2002-2006, 2009-2010 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 3 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, see <http://www.gnu.org/licenses/>.
19 # Convert Makefile.am files:
20 # find tests -name Makefile.am | xargs grep -wl PATH|xargs perl -pi -e \
21 # 's,src(\$\(PATH_SEPARATOR\)\$\$PATH),src/vg$1,'
22 # To restore:
23 # find tests -name Makefile.am|xargs grep -wl PATH|xargs perl -pi -e 's,src/vg,src,'
25 # Create this symlink for suppressions (this is no longer necessary,
26 # with Linux kernel 2.6.9 and valgrind-2.2.0):
27 # ln -s $PWD/.vg-suppressions /tmp/cu-vg
29 # Create src/vg:
31 coreutils=$(echo 'spy:;@echo $(all_programs)' | (cd src; make -f Makefile -f - spy | tr -s '\n ' ' '))
32 mkdir -p src/vg
33 pwd=`pwd`
34 srcdir=$pwd/src
35 _path='export PATH='$srcdir':${PATH#*:}'
36 pre='#!/bin/sh\n'"$_path"'\n'
37 n=15
38 vg='exec /usr/bin/valgrind --suppressions=/tmp/cu-vg --log-fd=3 --leak-check=yes --track-fds=yes --leak-check=full --num-callers='$n
39 cat <<EOF > src/vg/gen
40 for i in $coreutils; do
41 printf "$pre$vg -- \$i"' "\$@"\n' > \$i
42 chmod a+x \$i
43 done
44 EOF
45 cd src/vg
46 . ./gen