test: check also minimum outgoing packet interval

This commit is contained in:
Miroslav Lichvar 2014-06-03 15:02:47 +02:00
parent ead3ca14a0
commit 855eb09d58
8 changed files with 30 additions and 14 deletions

View file

@ -12,6 +12,7 @@ for freq_offset in -5e-2 -5e-3 5e-3 5e-2; do
run_test || test_fail
check_chronyd_exit || test_fail
check_source_selection || test_fail
check_packet_interval || test_fail
check_sync || test_fail
done

View file

@ -11,6 +11,7 @@ for time_offset in -1e2 1e2; do
run_test || test_fail
check_chronyd_exit || test_fail
check_source_selection || test_fail
check_packet_interval || test_fail
check_sync || test_fail
done

View file

@ -12,6 +12,7 @@ for step in -1e2 1e2; do
client_step="(* $step (equal 0.1 (sum 1.0) 150))"
run_test || test_fail
check_chronyd_exit || test_fail
check_packet_interval || test_fail
check_sync || test_fail
done
@ -24,6 +25,7 @@ for step in -1e8 -1e5 1e5 1e8; do
client_step="(* $step (equal 0.1 (sum 1.0) 5000))"
run_test || test_fail
check_chronyd_exit || test_fail
check_packet_interval || test_fail
check_sync || test_fail
done
@ -37,6 +39,7 @@ for step in -1e4 1e4; do
client_step="(* $step (equal 0.1 (% (sum 1.0) 500) 0))"
run_test || test_fail
check_chronyd_exit || test_fail
check_packet_interval || test_fail
check_sync || test_fail
done

View file

@ -16,6 +16,7 @@ max_sync_time=35
for time_offset in -2.0 -0.2 0.2 2.0; do
run_test || test_fail
check_chronyd_exit || test_fail
check_packet_interval || test_fail
check_sync || test_fail
done
@ -24,6 +25,7 @@ max_sync_time=5
for time_offset in -1e8 -1e2 1e2 1e8; do
run_test || test_fail
check_packet_interval || test_fail
check_sync || test_fail
done

View file

@ -16,6 +16,7 @@ for freq_offset in -5e-2 -5e-4 -5e-6 5e-6 5e-4 5e-2; do
awk "BEGIN {printf \"%.9e 1\", 1e6 - 1 / (1 + $freq_offset) * 1e6}" > tmp/drift
run_test || test_fail
check_chronyd_exit || test_fail
check_packet_interval || test_fail
check_sync || test_fail
done

View file

@ -14,6 +14,7 @@ for time_offset in -1.0 -0.1 0.1 1.0; do
run_test || test_fail
check_chronyd_exit || test_fail
check_source_selection || test_fail
check_packet_interval || test_fail
check_sync || test_fail
done
@ -24,6 +25,7 @@ for time_offset in -1e8 -1e2 1e2 1e8; do
run_test || test_fail
check_chronyd_exit || test_fail
check_source_selection || test_fail
check_packet_interval || test_fail
check_sync || test_fail
done

View file

@ -11,7 +11,6 @@ client_conf="acquisitionport 123"
run_test || test_fail
check_chronyd_exit || test_fail
check_source_selection || test_fail
check_packet_interval || test_fail
check_packet_port || test_fail
check_sync || test_fail

View file

@ -266,27 +266,34 @@ check_source_selection() {
# Check if incoming and outgoing packet intervals are sane
check_packet_interval() {
local i ret=0 in_interval out_interval
local i ret=0 mean_in_interval mean_out_interval min_in_interval min_out_interval
test_message 2 1 "checking incoming and outgoing packet interval:"
test_message 2 1 "checking mean/min incoming/outgoing packet interval:"
for i in $(seq 1 $(get_chronyd_nodes)); do
in_interval=$(get_stat 'Mean incoming packet interval' $i)
out_interval=$(get_stat 'Mean outgoing packet interval' $i)
mean_in_interval=$(get_stat 'Mean incoming packet interval' $i)
mean_out_interval=$(get_stat 'Mean outgoing packet interval' $i)
min_in_interval=$(get_stat 'Minimum incoming packet interval' $i)
min_out_interval=$(get_stat 'Minimum outgoing packet interval' $i)
test_message 3 0 "node $i: $(printf '%.2e %.2e' \
$in_interval $out_interval)"
test_message 3 0 "node $i: $(printf '%.2e %.2e %.2e %.2e' \
$mean_in_interval $mean_out_interval $min_in_interval $min_out_interval)"
# Check that the intervals are non-zero and shorter than limit,
# incoming is not longer than outgoing for stratum 1 servers, and
# outgoing is not longer than incoming for clients.
# Check that the mean intervals are non-zero and shorter than
# limit, incoming is not longer than outgoing for stratum 1
# servers, outgoing is not longer than incoming for clients,
# and the minimum outgoing interval is not shorter than the NTP
# sampling separation or iburst interval for clients
nodes=$[$servers * $server_strata + $clients]
check_stat $in_interval 0.1 inf && \
check_stat $out_interval 0.1 inf && \
check_stat $mean_in_interval 0.1 inf && \
check_stat $mean_out_interval 0.1 inf && \
([ $i -gt $servers ] || \
check_stat $in_interval 0.0 $out_interval) && \
check_stat $mean_in_interval 0.0 $mean_out_interval) && \
([ $i -le $[$servers * $server_strata] ] || \
check_stat $out_interval 0.0 $in_interval) && \
check_stat $mean_out_interval 0.0 $mean_in_interval) && \
([ $i -le $[$servers * $server_strata] ] || \
check_stat $min_out_interval \
$([ $servers -gt 1 ] && echo 0.18 || echo 1.8) inf) && \
test_ok || test_bad
[ $? -eq 0 ] || ret=1