mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-06 11:25:06 -05:00
test: indicate failed sync stats
This commit is contained in:
@@ -239,7 +239,7 @@ check_config_h() {
|
|||||||
|
|
||||||
# Check if the clock was well synchronized
|
# Check if the clock was well synchronized
|
||||||
check_sync() {
|
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
|
local rms_time_error rms_freq_error
|
||||||
|
|
||||||
test_message 2 1 "checking clock sync time, max/rms time/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_time_error=$(get_stat 'RMS offset' $i)
|
||||||
rms_freq_error=$(get_stat 'RMS frequency' $i)
|
rms_freq_error=$(get_stat 'RMS frequency' $i)
|
||||||
|
|
||||||
test_message 3 0 "node $i: $sync_time $(printf '%.2e %.2e %.2e %.2e' \
|
r=0
|
||||||
$max_time_error $max_freq_error $rms_time_error $rms_freq_error)"
|
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 && \
|
test_message 3 0 "node $i: $msg"
|
||||||
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
|
|
||||||
|
|
||||||
[ $? -eq 0 ] || ret=1
|
[ $r -eq 0 ] || ret=1
|
||||||
|
[ $r -eq 0 ] && test_ok || test_bad
|
||||||
done
|
done
|
||||||
|
|
||||||
return $ret
|
return $ret
|
||||||
|
|||||||
Reference in New Issue
Block a user