]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
test: check also minimum outgoing packet interval
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 3 Jun 2014 13:02:47 +0000 (15:02 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 3 Jun 2014 16:10:27 +0000 (18:10 +0200)
test/simulation/003-largefreqoffset
test/simulation/004-largetimeoffset
test/simulation/005-externalstep
test/simulation/103-initstepslew
test/simulation/104-driftfile
test/simulation/109-makestep
test/simulation/111-knownclient
test/simulation/test.common

index e463f0e7ec10ff634e91d4d3fc487bbecd238b00..4c47b859c71457abce0bde4f1554179264092af2 100755 (executable)
@@ -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
 
index 273056c87fbfa08eeec914b4c4b17b95a52a40c0..4c982cfe08b9115e68815768a9837185af3fca3c 100755 (executable)
@@ -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
 
index cffc795e900ed9794df6f193be0eed5041e2d32d..77393458fccab38977b7c6de74edd0ee029d41ac 100755 (executable)
@@ -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
 
index eaadf733d2a80744905f4ee072ee906a62f2c8cc..8f384f69e74e58bdb8d47c02e8ce0352d4448acf 100755 (executable)
@@ -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
 
index b65452d9060fca8a979a900e622c9e7461609149..50399d6bf75f6d24acb48661c24ae411e93a32cd 100755 (executable)
@@ -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
 
index 40fe779872e8e45fa33bc4f3b32419469d87098b..421c6af1740382d42a4c770c400e343cc819d472 100755 (executable)
@@ -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
 
index 34f6227fff361c262421a12c01c28f050b4ff681..13374ac219fc22c19f399b68ed6d2ca8ef64a694 100755 (executable)
@@ -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
 
index 611b31f54f08b36492eb228daa150a489f63d014..42f358b7d6293d1d2a07a45dde731db962990563 100644 (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)
-
-               test_message 3 0 "node $i: $(printf '%.2e %.2e' \
-                       $in_interval $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.
+               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 %.2e %.2e' \
+                       $mean_in_interval $mean_out_interval $min_in_interval $min_out_interval)"
+
+               # 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 $mean_out_interval 0.0 $mean_in_interval) && \
                        ([ $i -le $[$servers * $server_strata] ] || \
-                               check_stat $out_interval 0.0 $in_interval) && \
+                               check_stat $min_out_interval \
+                                       $([ $servers -gt 1 ] && echo 0.18 || echo 1.8) inf) && \
                        test_ok || test_bad
 
                [ $? -eq 0 ] || ret=1