Skip to content

Commit d0dc993

Browse files
committed
tests/should-fail: Verify exit code 1
Some of these runs were exiting with SIGSEGV but because we were just checking that the command failed, we masked that error... Fix the test code here to verify that the process exited with code 1. Signed-off-by: Colin Walters <walters@verbum.org>
1 parent c0591cd commit d0dc993

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/test-should-fail.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@ shift
77
tmpd=$(mktemp -d -t lcfs-test.XXXXXX)
88
trap 'rm -rf -- "$tmpd"' EXIT
99
for f in $@; do
10-
if $bindir/mkcomposefs --from-file $f $tmpd/out.cfs &>/dev/null; then
10+
rc=0
11+
$bindir/mkcomposefs --from-file $f $tmpd/out.cfs >/dev/null 2>$tmpd/err.txt || rc=$?
12+
if test $rc == 0; then
1113
fatal "Test case $f should have failed"
1214
fi
15+
if test $rc != 1; then
16+
cat $tmpd/err.txt
17+
fatal "Test case $f exited with code $rc, not 1"
18+
fi
1319
echo "ok $f"
1420
done

0 commit comments

Comments
 (0)