Skip to content

Commit e13048f

Browse files
committed
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>
1 parent d85e9f6 commit e13048f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tests/test-offset-truncate.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,23 @@ function do_test_info ()
5050
function do_test_read512 ()
5151
{
5252
nbdkit -U - --filter=offset --filter=truncate pattern size=1024 \
53-
"$@" --run 'nbdsh -u "$uri" -c "h.pread (512, 0)"'
53+
"$@" --run 'nbdsh -u "$uri" -c "
54+
try:
55+
h.pread (512, 0)
56+
except nbd.Error as ex:
57+
exit (1)
58+
"'
5459
}
5560

5661
function do_test_zero512 ()
5762
{
5863
nbdkit -U - --filter=offset --filter=truncate memory size=1024 \
59-
"$@" --run 'nbdsh -u "$uri" -c "h.zero (512, 0)"'
64+
"$@" --run 'nbdsh -u "$uri" -c "
65+
try:
66+
h.zero (512, 0)
67+
except nbd.Error as ex:
68+
exit (1)
69+
"'
6070
}
6171

6272
function expect_fail ()

0 commit comments

Comments
 (0)