mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Merge remote-tracking branch 'origin/topic/etyp/centos-missing-file-test-fail'
* origin/topic/etyp/centos-missing-file-test-fail: Fix flaky `missing-file-initially` test
This commit is contained in:
commit
c826118385
3 changed files with 23 additions and 5 deletions
|
@ -7,17 +7,21 @@ if [[ $# -ne 2 ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
SLEEP_INTERVAL=0.1
|
||||
SLEEP_INTERVAL_MS=100
|
||||
|
||||
wait_file=$1
|
||||
max_wait=$2
|
||||
wait_count=0
|
||||
# Avoid floating point arithmetic by using milliseconds
|
||||
wait_countdown=$((${max_wait}000 / SLEEP_INTERVAL_MS))
|
||||
|
||||
while [[ ! -e $wait_file ]]; do
|
||||
let "wait_count += 1"
|
||||
wait_countdown=$((wait_countdown - 1))
|
||||
|
||||
if [[ $wait_count -ge $max_wait ]]; then
|
||||
if [[ $wait_countdown -le 0 ]]; then
|
||||
echo >&2 "error: file '$wait_file' does not exist after $max_wait seconds"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
sleep $SLEEP_INTERVAL
|
||||
done
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue