This is the mail archive of the
mailing list for the elfutils project.
Re: [PATCH 3/5] tests: Add run-readelf-unknown-self.sh test to check for unknown DWARF codes.
- From: Roland McGrath <roland at hack dot frob dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Tue, 14 Aug 2012 11:28:58 -0700
- Subject: Re: [PATCH 3/5] tests: Add run-readelf-unknown-self.sh test to check for unknown DWARF codes.
> +# Make sure there are no unknown DWARF codes.
> +testrun_on_self_nomatch "unknown_0x[0-9a-f]+|lo_user\+0x[0-9a-f]" ../src/readelf -N -w
You'll have to make it smarter without the unknown_ prefix,
but it's better to work harder to write a test than to make
the output of a user tool uglier.
> + for file in $self_test_files; do
> + testrun $* $file | egrep -o "$pattern" | sort -u > self_matches.out \
Indent by two spaces, not four. Use "$@" (with quotes), not $*.
> + || :
Why do you want to succeed if the pipeline fails?
Anyway this really should do testrun separately so it can check
the exit status of the tested command before it does grep.
> + if test -s self_matches.out; then
> + echo "*** failure in $* $file"; cat self_matches.out; exit_status=1;
Use separate lines rather than ;.
> + # Only exit if something failed
> + if test $exit_status != 0; then exit $exit_status; fi
If you want to do this on one line, use:
test $exit_status = 0 || exit $exit_status