From: Guilhem Moulin Date: Mon, 3 Jun 2019 01:50:12 +0000 (+0200) Subject: long-lived tests: sleep between 1ms and 999ms. X-Git-Url: https://git.g-eek.se/?a=commitdiff_plain;h=db844d8979c17469012a079a051f60044532b6ed;p=interimap.git long-lived tests: sleep between 1ms and 999ms. `shuf -n1 -i1-99` produces a number between 1 and 99, hence `sleep "0.$(shuf -n1 -i1-99)"` pauses for some time between 100ms and 990ms. Moreover it's not uniformly distributed as multiples of 100ms (0.100, 0.200, …, 0.900) have twice the probability of other numbers. --- diff --git a/tests/07-sync-live-multi/run b/tests/07-sync-live-multi/run index 9dca2cf..15a27fd 100644 --- a/tests/07-sync-live-multi/run +++ b/tests/07-sync-live-multi/run @@ -101,7 +101,7 @@ while [ $(date +%s) -le $timer ]; do done # sleep a little bit - sleep "0.$(shuf -n1 -i1-99)" + sleep "$(printf "0.%03d" "$(shuf -n1 -i1-999)")" done # wait a little longer so interimap has time to run loop() again and diff --git a/tests/07-sync-live/run b/tests/07-sync-live/run index 00cd826..04d8247 100644 --- a/tests/07-sync-live/run +++ b/tests/07-sync-live/run @@ -63,7 +63,7 @@ while [ $(date +%s) -le $timer ]; do done # sleep a little bit - sleep "0.$(shuf -n1 -i1-99)" + sleep "$(printf "0.%03d" "$(shuf -n1 -i1-999)")" done # wait a little longer so interimap has time to run loop() again and