Filter away "main" differences in filter_fdleak
[valgrind.git] / none / tests / filter_fdleak
bloba558021dc227caf3ddfa19048018e13d4bb9d609
1 #! /bin/sh
3 dir=`dirname $0`
5 ./filter_stderr |
7 perl -p -e 's/^Open AF_UNIX socket [0-9]*: <unknown>/Open AF_UNIX socket ...: <unknown>/' |
8 perl -p -e 's/^Open (AF_UNIX socket|file descriptor) [0-9]*: \/dev\/null/Open $1 ...: \/dev\/null/' |
9 # Solaris-specific, translate /devices/pseudo/mm@0:null to /dev/null
10 perl -p -e 's/^Open (AF_UNIX socket|file descriptor) [0-9]*: \/devices\/pseudo\/mm\@0:null/Open $1 ...: \/dev\/null/' |
11 # Nb: on Darwin, /tmp is a symlink to /private/tmp, so sometimes it's
12 # necessary to filter out the "/private" part.
13 perl -p -e 's/^Open (AF_UNIX socket|file descriptor) [0-9]*: (\/private)?\/tmp\/(sock|data1|data2|file)\.[0-9]*/Open $1 ...: \/tmp\/$3/' |
14 perl -p -e 's/^Open file descriptor [0-9]*: .*/Open file descriptor ...: .../' |
15 perl -p -e 's/^Open file descriptor [0-9]*:$/Open file descriptor ...:/' |
16 perl -p -e 's/127.0.0.1:[0-9]*/127.0.0.1:.../g' |
17 perl -p -e 's/socket\.c:[1-9][0-9]*/in \/...libc.../' |
18 # arm systems substitute open for creat
19 perl -p -e 's/open \(open64\.c:[1-9][0-9]*\)/creat (in \/...libc...)/' |
20 perl -p -e "s/: open \(/: creat (/" |
22 # FreeBSD specific fdleak filters
23 perl -p -e 's/ _close / close /;s/ _openat / creat /;s/internet/AF_INET socket 4: 127.0.0.1:... <-> 127.0.0.1:.../' |
25 # Solaris specific fdleak filters
26 perl -p -e 's/ __close / close /' |
27 sed '/ _so_socket /d;' |
28 awk '/ socket /{sub(/ by /, " at "); print; next}{print}' |
29 awk '/ at .* _syscall6 /{getline; getline; sub(/ by /, " at "); print; next}{print}' |
31 # Stack traces showing where fds were created have lots of variations:
32 # different numbers of entries, line numbers or not depending on whether
33 # libc debug info is present, 'main' vs. '(below main)', etc.
35 # So we just cut out the entire stack trace. It's coarse but effective;
36 # before we did this we had a plethora of expected outputs, with only
37 # painfully minor variations between them.
38 perl -p -0 -e 's/(Open[^\n]*\n)( (at|by)[^\n]*\n)+/$1 ...\n/gs' |
40 sed "s/by 0x........: (below main)/by 0x........: main/" |
41 sed "s/by 0x........: main (.*)/by 0x........: main/" |
43 # With glibc debuginfo installed we might see syscall-template.S, close.c or creat64.c
44 perl -p -e "s/\(syscall-template.S:[0-9]*\)/(in \/...libc...)/" |
45 perl -p -e "s/\(close.c:[0-9]*\)/(in \/...libc...)/" |
46 perl -p -e "s/\(creat(?:64)?.c:[0-9]*\)/(in \/...libc...)/"