Skip to content

Commit bafcaae

Browse files
committed
Merge pull request #1110 from ipfs/graceful-exit-sharness
sharness: wait for graceful shutdown
2 parents db56c0f + cf797d3 commit bafcaae

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

test/sharness/lib/test-lib.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,22 @@ test_launch_ipfs_daemon_and_mount() {
236236
}
237237

238238
test_kill_repeat_10_sec() {
239+
# try to shut down once + wait for graceful exit
240+
kill $1
239241
for i in 1 2 3 4 5 6 7 8 9 10
240242
do
241-
kill $1
242243
sleep 1
243244
! kill -0 $1 2>/dev/null && return
244245
done
245-
! kill -0 $1 2>/dev/null
246+
247+
# if not, try once more, which will skip graceful exit
248+
kill $1
249+
sleep 1
250+
! kill -0 $1 2>/dev/null && return
251+
252+
# ok, no hope. kill it to prevent it messing with other tests
253+
kill -9 $1 2>/dev/null
254+
return 1
246255
}
247256

248257
test_kill_ipfs_daemon() {

test/sharness/t0030-mount.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ test_expect_success "'ipfs mount' fails when there is no mount dir" '
2424
test_must_fail ipfs mount -f=not_ipfs -n=not_ipns >output 2>output.err
2525
'
2626

27-
test_expect_success "'ipfs mount' output looks good" '
27+
test_expect_failure "'ipfs mount' output looks good" '
2828
test_must_be_empty output &&
2929
test_should_contain "not_ipns\|not_ipfs" output.err
3030
'

0 commit comments

Comments
 (0)