diff options
author | Vincent Blut <vincent.debian@free.fr> | 2016-06-11 18:45:40 +0200 |
---|---|---|
committer | Vincent Blut <vincent.debian@free.fr> | 2016-06-11 18:45:40 +0200 |
commit | 63d1a0d29c506f0471c32fc804e310d7f8759391 (patch) | |
tree | 144691dd942ba75080716220f76d35984aa87b70 /test/simulation | |
parent | da8fd617a2b9bbcdb8c5f16c25d0ee7eed69dd33 (diff) |
Imported Upstream version 2.4
Diffstat (limited to 'test/simulation')
-rwxr-xr-x | test/simulation/105-ntpauth | 47 | ||||
-rwxr-xr-x | test/simulation/110-chronyc | 4 | ||||
-rwxr-xr-x | test/simulation/115-cmdmontime | 4 | ||||
-rwxr-xr-x | test/simulation/121-orphan | 23 |
4 files changed, 62 insertions, 16 deletions
diff --git a/test/simulation/105-ntpauth b/test/simulation/105-ntpauth index 1b9dd48..5cfdf32 100755 --- a/test/simulation/105-ntpauth +++ b/test/simulation/105-ntpauth @@ -4,17 +4,40 @@ test_start "NTP authentication" -server_conf="keyfile tmp/keys" -client_conf="keyfile tmp/keys" - -cat > tmp/keys <<-EOF -1 $(tr -c -d 'a-zA-Z0-9' < /dev/urandom 2> /dev/null | head -c 24) -2 ASCII:$(tr -c -d 'a-zA-Z0-9' < /dev/urandom 2> /dev/null | head -c 24) -3 MD5 ASCII:$(tr -c -d 'a-zA-Z' < /dev/urandom 2> /dev/null | head -c 24) -4 MD5 HEX:$(tr -c -d '0-9A-F' < /dev/urandom 2> /dev/null | head -c 32) +server_conf="keyfile tmp/server.keys" +client_conf="keyfile tmp/client.keys" + +cat > tmp/server.keys <<-EOF +1 MD5 HEX:6B5D3C6A2E4A74775E4F6F3B7A35453E6E5C5F302D783D2979505C663C295A5E +2 MD5 HEX:6B5D3C6A2E4A74775E4F6F3B7A35453E6E5C5F302D783D2979505C663C295A5E +3 MD5 HEX:6B5D3C6A2E4A74775E4F6F3B7A35453E6E5C5F302D783D2979505C663C295A5E +4 MD5 HEX:6B5D3C6A2E4A74775E4F6F3B7A35453E6E5C5F302D783D2979505C663C295A5E +EOF + +cat > tmp/client.keys <<-EOF +1 k]<j.Jtw^Oo;z5E>n\_0-x=)yP\f<)Z^ +2 ASCII:k]<j.Jtw^Oo;z5E>n\_0-x=)yP\f<)Z^ +3 MD5 ASCII:k]<j.Jtw^Oo;z5E>n\_0-x=)yP\f<)Z^ +4 MD5 HEX:6B5D3C6A2E4A74775E4F6F3B7A35453E6E5C5F302D783D2979505C663C295A5E EOF -for key in 1 2 3 4; do +keys=4 + +if grep -q 'FEAT_SECHASH 1' ../../config.h; then + hashes="MD5 SHA1 SHA256 SHA384 SHA512" +else + hashes="MD5" +fi + +for hash in $hashes; do + keys=$[$keys + 1] + key=$(echo $keys $hash HEX:$(tr -c -d '0-9A-F' < /dev/urandom 2> /dev/null | \ + head -c $[$RANDOM % 64 * 2 + 2])) + echo "$key" >> tmp/server.keys + echo "$key" >> tmp/client.keys +done + +for key in $(seq $keys); do client_server_options="key $key" run_test || test_fail check_chronyd_exit || test_fail @@ -31,7 +54,7 @@ check_chronyd_exit || test_fail check_sync && test_fail check_packet_interval || test_fail -server_conf="keyfile tmp/keys" +server_conf="keyfile tmp/server.keys" client_conf="" run_test || test_fail @@ -40,10 +63,10 @@ check_chronyd_exit || test_fail check_sync && test_fail check_packet_interval || test_fail -client_conf="keyfile tmp/keys" +client_conf="keyfile tmp/client.keys" clients=2 peers=2 -max_sync_time=300 +max_sync_time=500 base_delay="$default_base_delay (* -1 (equal 0.1 from 3) (equal 0.1 to 1))" client_lpeer_options="key 1" client_rpeer_options="key 1" diff --git a/test/simulation/110-chronyc b/test/simulation/110-chronyc index 29ade1c..34ee283 100755 --- a/test/simulation/110-chronyc +++ b/test/simulation/110-chronyc @@ -13,7 +13,7 @@ check_chronyd_exit || test_fail check_chronyc_output "^Reference ID : 192\.168\.123\.1 \(192\.168\.123\.1\) Stratum : 2 -Ref time \(UTC\) : Fri Jan 1 00:1.:.. 2010 +Ref time \(UTC\) : Fri Jan 01 00:1.:.. 2010 System time : 0\.0000..... seconds (slow|fast) of NTP time Last offset : [+-]0\.000...... seconds RMS offset : 0\.000...... seconds @@ -25,7 +25,7 @@ Root dispersion : 0\.000... seconds Update interval : [0-9]+\.. seconds Leap status : Normal 210 Number of sources = 1 -MS Name/IP address Stratum Poll Reach LastRx Last sample +MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== \^\* 192\.168\.123\.1 1 [67] 377 [0-9]+ [0-9 +-]+[un]s\[[0-9 +-]+[un]s\] \+/-[ 0-9]+[un]s 210 Number of sources = 1 diff --git a/test/simulation/115-cmdmontime b/test/simulation/115-cmdmontime index 6eb495a..2806a1f 100755 --- a/test/simulation/115-cmdmontime +++ b/test/simulation/115-cmdmontime @@ -10,11 +10,11 @@ grep -q 'HAVE_LONG_TIME_T 1' ../../config.h || test_skip limit=2 client_server_options="noselect" client_conf="local stratum 1" -chronyc_start="0.5" +chronyc_start="1.5" chronyc_conf="tracking" for year in `seq 1850 100 2300`; do - date="Jan 1 00:00:00 $year" + date="Jan 01 00:00:00 $year" export CLKNETSIM_START_DATE=$(date -d "$date UTC" +'%s') run_test || test_fail check_chronyd_exit || test_fail diff --git a/test/simulation/121-orphan b/test/simulation/121-orphan new file mode 100755 index 0000000..ed92153 --- /dev/null +++ b/test/simulation/121-orphan @@ -0,0 +1,23 @@ +#!/bin/bash + +. ./test.common + +test_start "orphan option" + +server_strata=3 +server_conf="local stratum 5 orphan +server 192.168.123.1 +server 192.168.123.2 +server 192.168.123.3" +max_sync_time=500 +chronyc_start=300 +chronyc_conf="tracking" +time_rms_limit=5e-4 + +run_test || test_fail +check_chronyd_exit || test_fail +check_source_selection || test_fail +check_sync || test_fail +check_chronyc_output "^.*Stratum *: 7.*$" || test_fail + +test_pass |