From acc164a31683faae87e1a861e1399d8477c92865 Mon Sep 17 00:00:00 2001 From: Stephan Bauroth Date: Tue, 30 Sep 2025 12:59:56 +0200 Subject: [PATCH] bench.sh: detect failed runs and fail accordingly because redis has to be detected in a more complicated way, rework the output und remove superflouos sleeps while at it --- bench.sh | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/bench.sh b/bench.sh index c03fe2d..9a5a514 100755 --- a/bench.sh +++ b/bench.sh @@ -46,6 +46,8 @@ procs=8 repeats=1 # repeats of all tests test_repeats=1 # repeats per test sleep=0 # mini sleeps between tests seem to improve stability +error=0 # binary marker for errors during the run +failed_runs="" # accumulated failed runs case "$OSTYPE" in darwin*) darwin="1" @@ -559,16 +561,27 @@ function run_test_env_cmd { # "$outfile.server.txt" & - sleep 1s - $redis_dir/redis-cli flushall - sleep 1s + tmpfile=$(mktemp) + ( + $timecmd -a -o "$benchres.line" -f "$1${benchfill:${#1}} $2${allocfill:${#2}} %E %M %U %S %F %R" /usr/bin/env $3 $redis_dir/redis-server > "$outfile.server.txt" + echo $? > "$tmpfile" + ) & + sleep 0.1 + if [ -s "$tmpfile" ]; then + error="1" + failed_runs+="$1:$2 " + return + fi + rm -f "$tmpfile" + while true; do + $redis_dir/redis-cli flushall > /dev/null 2>&1 + if test "$?" = "0"; then + break + fi + done $4 >> "$outfile" - sleep 1s - $redis_dir/redis-cli flushall - sleep 1s - $redis_dir/redis-cli shutdown - sleep 1s + $redis_dir/redis-cli flushall > /dev/null + $redis_dir/redis-cli shutdown 2> /dev/null ;; security) echo $2 >> $outfile @@ -602,7 +615,12 @@ function run_test_env_cmd { # "$outfile";; + $timecmd -a -o "$benchres.line" -f "$1${benchfill:${#1}} $2${allocfill:${#2}} %E %M %U %S %F %R" /usr/bin/env $3 $4 < "$infile" > "$outfile" + if test "$?" != "0"; then + error="1" + failed_runs+="$1:$2 " + fi + ;; esac # fixup larson with relative time @@ -797,3 +815,8 @@ do echo "" fi done + +if test "$error" != "0"; then + echo "Failed tests: $failed_runs" + exit 1 +fi