| 1 |
#! /bin/sh |
| 2 |
# tests/filter_stderr_basic. Generated from filter_stderr_basic.in by configure. |
| 3 |
|
| 4 |
SED=/usr/bin/sed |
| 5 |
|
| 6 |
# This filter should be applied to *every* stderr result. It removes |
| 7 |
# Valgrind startup stuff and pid numbers. |
| 8 |
# |
| 9 |
# Nb: The GNU and BSD implementations of 'sed' are quite different, so |
| 10 |
# anything remotely complicated (e.g. "\(a\|b\)" alternatives) can't be |
| 11 |
# easily done. Use Perl instead for any such cases. |
| 12 |
|
| 13 |
dir=`dirname $0` |
| 14 |
|
| 15 |
# Remove ==pid== and --pid-- and **pid** strings |
| 16 |
perl -p -e 's/(==|--|\*\*)[0-9]{1,7}\1 //' | |
| 17 |
|
| 18 |
# Do NOT remove debug level output, i.e. lines beginning with --pid: |
| 19 |
# Doing so would also remove asserts from the address space manager |
| 20 |
# and we always to see those. |
| 21 |
|
| 22 |
# Remove "Command: line". (If wrapping occurs, it won't remove the |
| 23 |
# subsequent lines...) |
| 24 |
$SED "/^Command: .*$/d" | |
| 25 |
|
| 26 |
# Remove "WARNING: assuming toc 0x.." strings |
| 27 |
$SED "/^WARNING: assuming toc 0x*/d" | |
| 28 |
|
| 29 |
# Remove "Using Valgrind-$VERSION and LibVEX..." line. |
| 30 |
# Tools have to filter their own line themselves. |
| 31 |
$SED "/^Using Valgrind-.* and LibVEX; rerun with -h for copyright info/ d" | |
| 32 |
|
| 33 |
# Anonymise line numbers in vg_replace_malloc.c, remove dirname if present |
| 34 |
perl -p -e "s/(m_replacemalloc\/)?vg_replace_malloc.c:\d+\)/vg_replace_malloc.c:...\)/" | |
| 35 |
|
| 36 |
# Likewise for valgrind.h |
| 37 |
perl -p -e "s/valgrind\.h:\d+\)/valgrind\.h:...\)/" | |
| 38 |
|
| 39 |
# Hide suppressed error counts |
| 40 |
$SED "s/^\(ERROR SUMMARY[^(]*(suppressed: \)[0-9]*\( from \)[0-9]*)$/\10\20)/" | |
| 41 |
|
| 42 |
# Reduce some libc incompatibility |
| 43 |
$dir/filter_libc | |
| 44 |
|
| 45 |
# Remove line info out of order warnings |
| 46 |
$SED "/warning: line info addresses out of order/d" | |
| 47 |
|
| 48 |
# FreeBSD sanity level >= 3 warnings |
| 49 |
$SED "/main Warning: due to transparent memory mappings with MAP_STACK/d" | |
| 50 |
$SED "/main --sanity-level=3 and above may give spurious errors./d" | |
| 51 |
|
| 52 |
# Filter out abnormal termination messages. Depending on which shell is |
| 53 |
# pointed to by /bin/sh those messages will be written to stderr or not. |
| 54 |
# E.g. dash writes them to stderr, whereas bash does not. |
| 55 |
perl -n -e 'print if !/^(Illegal instruction|Segmentation fault|Alarm clock|Aborted|Bus error|Killed)( \(core dumped\))?$/' | |
| 56 |
|
| 57 |
# Similar as above, but for ksh on Solaris/illumos. |
| 58 |
perl -n -e 'print if !/^(Memory fault|Killed) $/' | |
| 59 |
# bash on Illumos |
| 60 |
$SED "/sh: [1-9][0-9]*: \(Memory fault\|Alarm call\|Terminated\|Killed\|Abort\)/d" | |
| 61 |
|
| 62 |
# Translate intercepted glibc functions back to their canonical name |
| 63 |
perl -p -e "s/: memcpy\@\@?GLIBC_[.1-9]+ \(vg_replace_strmem.c:.*?\)/: memcpy \(vg_replace_strmem.c:...\)/" | |
| 64 |
$SED -e "s/: \(__GI_\|__\|\)\(memcmp\|memcpy\|strcpy\|strncpy\|strchr\|strrchr\)\(\|_sse4_1\|_sse42\|_sse2_unaligned\|_sse2\) (vg_replace_strmem.c:/: \2 (vg_replace_strmem.c:/" | |
| 65 |
|
| 66 |
# Remove any ": dumping core" message as the user might have a |
| 67 |
# limit set that prevents the core dump |
| 68 |
$SED "s/\(signal [0-9]* (SIG[A-Z]*)\): dumping core/\1/" | |
| 69 |
|
| 70 |
# Remove the size in "The main thread stack size..." message. |
| 71 |
$SED "s/The main thread stack size used in this run was [0-9]*/The main thread stack size used in this run was .../" | |
| 72 |
|
| 73 |
# Remove the size in "10482464 bytes below stack pointer" message. |
| 74 |
$SED "s/[0-9][0-9]* bytes below stack pointer/.... bytes below stack pointer/" | |
| 75 |
|
| 76 |
# Suppress warnings from incompatible debug info |
| 77 |
$SED '/warning: the debug information found in "[^"]*" does not match/d' | |
| 78 |
|
| 79 |
# Suppress warnings from Dwarf reader |
| 80 |
$SED '/warning: evaluate_Dwarf3_Expr: unhandled DW_OP_/d' |
| 81 |
|
| 82 |
# Suppress Darwin dyld errors |
| 83 |
$SED '/^used_suppression:.*OSX.*dyld.*default.supp:*/d' |