-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Use a function to wait for pid file to appear
Introduce wait_for_file function to wait for a file for a max. amount of time and have that function poll for the file to appear. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
- Loading branch information
1 parent
01eb4d3
commit 70f3e24
Showing
4 changed files
with
30 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
# For the license, see the LICENSE file in the root directory. | ||
|
||
function wait_for_file() | ||
{ | ||
local filename="$1" | ||
local timeout="$2" | ||
|
||
local loops=$((timeout * 10)) loop | ||
|
||
for ((loop=0; loop<loops; loop++)); do | ||
[ -f "${filename}" ] && return 1 | ||
sleep 0.1 | ||
done | ||
return 0 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters