1
0
Fork 0
mirror of https://passt.top/passt synced 2025-05-22 09:15:34 +02:00

test: Add wait_for() shell helper

Add a shell helper function to wait for some command to succeed - typically
a test for something to be done by a background process.  Use it in the
context code which waits for the guest to respond to ssh-over-vsock
connections.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
David Gibson 2022-09-26 20:43:36 +10:00 committed by Stefano Brivio
parent 8978f6552b
commit 05a2c7ae3c
2 changed files with 9 additions and 3 deletions
test/lib

View file

@ -123,3 +123,11 @@ get_info_cols() {
__j=$((__j + 1))
done
}
# wait_for() - Retry a command until it succeeds
# $@: Command to run
wait_for() {
while ! "$@"; do
sleep 0.1 || sleep 1
done
}