On Wed, Jan 14, 2015 at 1:24 AM, Bernhard Voelker <[email protected]> wrote: > On 01/14/2015 02:51 AM, Pádraig Brady wrote: >> On 13/01/15 08:13, Bernhard Voelker wrote: >>> expectExit 1 program ... || fail=1 >> >> Very good suggestions. I implemented the simplification wrapper >> (I called it returns_), and that in turn made a syntax check feasible. > > great, 'returns_' is a much better name, thanks. > >> From 92288f467759f84674bf00d2ffe8e4419347f46c Mon Sep 17 00:00:00 2001 >> From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]> >> Date: Tue, 13 Jan 2015 03:30:33 +0000 >> Subject: [PATCH] tests: add extra protection against unexpected exits ... >> --- a/tests/dd/misc.sh >> +++ b/tests/dd/misc.sh >> @@ -40,7 +40,7 @@ dd status=noxfer status=none if=$tmp_in of=/dev/null 2> >> err || fail=1 >> compare /dev/null err || fail=1 >> # check later status=noxfer overrides earlier status=none >> dd status=none status=noxfer if=$tmp_in of=/dev/null 2> err || fail=1 >> -compare /dev/null err && fail=1 >> +test -s err || fail=1 > > nice one!
Actually, I prefer the former. When some program produces unexpected output, that use of compare-vs-/dev/null will ensure that the surprising output is printed in the test's output. If you use only the "test -s err", you would have to instrument and rerun in order to see the offending output.
