#! /bin/sh

dir=`dirname $0`

$dir/../../tests/filter_stderr_basic                    |

# Anonymise addresses
$dir/../../tests/filter_addresses                       |

# Remove "Helgrind, ..." line and the following copyright line.
sed "/^Helgrind, a thread error detector/ , /./ d" |

# Anonymise line numbers in hg_intercepts.c
sed "s/hg_intercepts.c:[0-9]*/hg_intercepts.c:.../g"  |

# Change (eg) "/lib64/libpthread-2.5.so" into "/lib/libpthread..."
sed \
 -e "s/lib64/lib/g" \
 -e "s/libpthread.*so/libpthread\.\.\./g" |

# Change (eg) "pthread_create@@GLIBC_2.2.5" into "pthread_create@GLIBC"
#    and (eg) "pthread_create@GLIBC_2.1"    into "pthread_create@GLIBC"
sed "s/@@*GLIBC_2[0123456789\.]*/@GLIBC_/g" |

# Tidy up in cases where glibc (+ libdl + libpthread + ld) have
# been built with debugging information, hence source locs are present
sed \
 -e "s/(createthread.c:[0-9]*)/(in \/lib\/libpthread...)/g" \
 -e "s/(clone.S:[0-9]*)/(in \/...libc...)/g" \
 -e "s/start_thread (pthread_create.c:[0-9]*)$/start_thread (in \/lib\/libpthread...)/g" |

# get rid of the numbers in bits of text "Thread #n", "thread #n",
# "Thread n" and "thread n",
# as these make some tests more scheduling sensitive -- those where
# there are multiple threads which play interchangeable roles.
sed \
 -e "s/hread #[0-9][0-9]*/hread #x/g" \
 -e "s/hread [0-9][0-9]*/hread x/g"

$dir/../../tests/filter_test_paths
