From 6f381fa78bda92fcb1f87ddc2310096047312b75 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Thu, 14 Nov 2024 13:40:43 +0100 Subject: [PATCH] test: indicate failed sync stats --- test/simulation/test.common | 40 +++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/test/simulation/test.common b/test/simulation/test.common index 42a2917..604df61 100644 --- a/test/simulation/test.common +++ b/test/simulation/test.common @@ -239,7 +239,7 @@ check_config_h() { # Check if the clock was well synchronized check_sync() { - local i sync_time max_time_error max_freq_error ret=0 + local i msg sync_time max_time_error max_freq_error r ret=0 local rms_time_error rms_freq_error test_message 2 1 "checking clock sync time, max/rms time/freq error:" @@ -254,17 +254,37 @@ check_sync() { rms_time_error=$(get_stat 'RMS offset' $i) rms_freq_error=$(get_stat 'RMS frequency' $i) - test_message 3 0 "node $i: $sync_time $(printf '%.2e %.2e %.2e %.2e' \ - $max_time_error $max_freq_error $rms_time_error $rms_freq_error)" + r=0 + msg="$sync_time" + if ! check_stat $sync_time $min_sync_time $max_sync_time; then + msg+="!" + r=1 + fi + msg+="$(printf ' %.2e' $max_time_error)" + if ! check_stat $max_time_error 0.0 $time_max_limit; then + msg+="!" + r=1 + fi + msg+="$(printf ' %.2e' $max_freq_error)" + if ! check_stat $max_freq_error 0.0 $freq_max_limit; then + msg+="!" + r=1 + fi + msg+="$(printf ' %.2e' $rms_time_error)" + if ! check_stat $rms_time_error 0.0 $time_rms_limit; then + msg+="!" + r=1 + fi + msg+="$(printf ' %.2e' $rms_freq_error)" + if ! check_stat $rms_freq_error 0.0 $freq_rms_limit; then + msg+="!" + r=1 + fi - check_stat $sync_time $min_sync_time $max_sync_time && \ - check_stat $max_time_error 0.0 $time_max_limit && \ - check_stat $max_freq_error 0.0 $freq_max_limit && \ - check_stat $rms_time_error 0.0 $time_rms_limit && \ - check_stat $rms_freq_error 0.0 $freq_rms_limit && \ - test_ok || test_bad + test_message 3 0 "node $i: $msg" - [ $? -eq 0 ] || ret=1 + [ $r -eq 0 ] || ret=1 + [ $r -eq 0 ] && test_ok || test_bad done return $ret