maint: Clarify ambiguous refs to Linux kernels or GNU/Linux systems
[platform/upstream/coreutils.git] / README-valgrind
1 #! /bin/bash
2 # Convert this package for use with valgrind.
3
4 # Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
5
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.
10
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.
15
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/>.
18
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,'
24 #
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
28
29 # Create src/vg:
30
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