From 855eb09d5877e86ac554d94c59f537aac4950644 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Tue, 3 Jun 2014 15:02:47 +0200 Subject: [PATCH] test: check also minimum outgoing packet interval --- test/simulation/003-largefreqoffset | 1 + test/simulation/004-largetimeoffset | 1 + test/simulation/005-externalstep | 3 +++ test/simulation/103-initstepslew | 2 ++ test/simulation/104-driftfile | 1 + test/simulation/109-makestep | 2 ++ test/simulation/111-knownclient | 1 - test/simulation/test.common | 33 +++++++++++++++++------------ 8 files changed, 30 insertions(+), 14 deletions(-) diff --git a/test/simulation/003-largefreqoffset b/test/simulation/003-largefreqoffset index e463f0e..4c47b85 100755 --- a/test/simulation/003-largefreqoffset +++ b/test/simulation/003-largefreqoffset @@ -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 diff --git a/test/simulation/004-largetimeoffset b/test/simulation/004-largetimeoffset index 273056c..4c982cf 100755 --- a/test/simulation/004-largetimeoffset +++ b/test/simulation/004-largetimeoffset @@ -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 diff --git a/test/simulation/005-externalstep b/test/simulation/005-externalstep index cffc795..7739345 100755 --- a/test/simulation/005-externalstep +++ b/test/simulation/005-externalstep @@ -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 diff --git a/test/simulation/103-initstepslew b/test/simulation/103-initstepslew index eaadf73..8f384f6 100755 --- a/test/simulation/103-initstepslew +++ b/test/simulation/103-initstepslew @@ -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 diff --git a/test/simulation/104-driftfile b/test/simulation/104-driftfile index b65452d..50399d6 100755 --- a/test/simulation/104-driftfile +++ b/test/simulation/104-driftfile @@ -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 diff --git a/test/simulation/109-makestep b/test/simulation/109-makestep index 40fe779..421c6af 100755 --- a/test/simulation/109-makestep +++ b/test/simulation/109-makestep @@ -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 diff --git a/test/simulation/111-knownclient b/test/simulation/111-knownclient index 34f6227..13374ac 100755 --- a/test/simulation/111-knownclient +++ b/test/simulation/111-knownclient @@ -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 diff --git a/test/simulation/test.common b/test/simulation/test.common index 611b31f..42f358b 100644 --- a/test/simulation/test.common +++ b/test/simulation/test.common @@ -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