Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
tests: Silence python stack trace during expected failure
test-offset-truncate.sh intentionally provokes out-of-bound reads
under the shell function expect_fail; but does so in a way that causes
nbdsh to die with a python stack dump.  Abrt then picked this up and
tried to report it as an application crash.  Improve the test by
gracefully letting python exit with non-zero status without a crash.

Signed-off-by: Eric Blake <eblake@redhat.com>
  • Loading branch information
ebblake committed Sep 4, 2020
1 parent d85e9f6 commit e13048f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/test-offset-truncate.sh
Expand Up @@ -50,13 +50,23 @@ function do_test_info ()
function do_test_read512 ()
{
nbdkit -U - --filter=offset --filter=truncate pattern size=1024 \
"$@" --run 'nbdsh -u "$uri" -c "h.pread (512, 0)"'
"$@" --run 'nbdsh -u "$uri" -c "
try:
h.pread (512, 0)
except nbd.Error as ex:
exit (1)
"'
}

function do_test_zero512 ()
{
nbdkit -U - --filter=offset --filter=truncate memory size=1024 \
"$@" --run 'nbdsh -u "$uri" -c "h.zero (512, 0)"'
"$@" --run 'nbdsh -u "$uri" -c "
try:
h.zero (512, 0)
except nbd.Error as ex:
exit (1)
"'
}

function expect_fail ()
Expand Down

0 comments on commit e13048f

Please sign in to comment.