From 03460fe3d2657c626d406e57d75f6f9c6fa4338e Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Tue, 28 May 2019 00:21:43 +0200 Subject: tests: don't fail when a pid can't be killed. (Usually on ESRCH.) --- tests/07-sync-live-multi/run | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tests/07-sync-live-multi') diff --git a/tests/07-sync-live-multi/run b/tests/07-sync-live-multi/run index bf0d2f5..9dca2cf 100644 --- a/tests/07-sync-live-multi/run +++ b/tests/07-sync-live-multi/run @@ -15,12 +15,12 @@ interimap --config="config3" --watch=1 & pid3=$! abort() { # kill interimap process and its children - pkill -P "$pid" -TERM - kill -TERM "$pid" - pkill -P "$pid2" -TERM - kill -TERM "$pid2" - pkill -P "$pid3" -TERM - kill -TERM "$pid3" + pkill -P "$pid" -TERM || true + kill -TERM "$pid" || true + pkill -P "$pid2" -TERM || true + kill -TERM "$pid2" || true + pkill -P "$pid3" -TERM || true + kill -TERM "$pid3" || true wait } trap abort EXIT INT TERM -- cgit v1.2.3 From db844d8979c17469012a079a051f60044532b6ed Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Mon, 3 Jun 2019 03:50:12 +0200 Subject: long-lived tests: sleep between 1ms and 999ms. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `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. --- tests/07-sync-live-multi/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/07-sync-live-multi') 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 -- cgit v1.2.3