]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
test: add tests of local directive options
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 4 Apr 2024 13:00:20 +0000 (15:00 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 4 Apr 2024 14:24:02 +0000 (16:24 +0200)
test/simulation/110-chronyc
test/simulation/121-local [new file with mode: 0755]
test/simulation/121-orphan [deleted file]

index a4f486a1520529a0e6aa3b3f15a3e3d2e2ca42f0..0e8460902b1879a4107924981c197607ae961349 100755 (executable)
@@ -145,7 +145,7 @@ for chronyc_conf in \
        "dfreq 1.0e-3" \
        "doffset -1.0" \
        "dump" \
-       "local stratum 5 distance 1.0 orphan" \
+       "local stratum 5 distance 1.0 activate 0.5 orphan" \
        "local off" \
        "makestep 10.0 3" \
        "makestep" \
diff --git a/test/simulation/121-local b/test/simulation/121-local
new file mode 100755 (executable)
index 0000000..ba99efc
--- /dev/null
@@ -0,0 +1,90 @@
+#!/usr/bin/env bash
+
+. ./test.common
+
+test_start "local options"
+
+check_config_h 'FEAT_CMDMON 1' || test_skip
+
+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=900
+client_start=140
+chronyc_start=700
+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
+
+limit=4000
+wander=0.0
+jitter=0.0
+server_strata=1
+server_conf=""
+client_server_options="minpoll 6 maxpoll 6 minsamples 64"
+chronyc_start=1
+chronyc_conf="timeout 1000000
+tracking
+tracking
+tracking
+tracking"
+base_delay=$(cat <<-EOF | tr -d '\n'
+  (+ 1e-4
+     (* 990
+        (equal 0.1 from 3))
+     (* -1
+        (equal 0.1 from 1)
+        (equal 0.1 (max (% time 2000) 1000) 1000)))
+EOF
+)
+
+client_conf="local
+maxclockerror 1000"
+
+run_test || test_fail
+check_chronyd_exit || test_fail
+check_chronyc_output "^.*7F7F0101.*C0A87B01.*7F7F0101.*C0A87B01.*$" || test_fail
+
+client_conf="local distance 0.5
+maxclockerror 1000"
+
+run_test || test_fail
+check_chronyd_exit || test_fail
+check_chronyc_output "^.*7F7F0101.*C0A87B01.*7F7F0101.*C0A87B01.*$" || test_fail
+
+client_conf="local distance 2.0
+maxclockerror 1000"
+
+run_test || test_fail
+check_chronyd_exit || test_fail
+check_chronyc_output "^.*7F7F0101.*C0A87B01.*C0A87B01.*C0A87B01.*$" || test_fail
+
+client_conf="local activate 1e-4
+maxclockerror 1000"
+
+run_test || test_fail
+check_chronyd_exit || test_fail
+check_chronyc_output "^.* 00000000 .*C0A87B01.*C0A87B01.*C0A87B01.*$" || test_fail
+
+client_conf="local activate 1e-1
+maxclockerror 1000"
+
+run_test || test_fail
+check_chronyd_exit || test_fail
+check_chronyc_output "^.* 00000000 .*C0A87B01.*7F7F0101.*C0A87B01.*$" || test_fail
+
+client_conf="local activate 1e-1 distance 2.0
+maxclockerror 1000"
+
+run_test || test_fail
+check_chronyd_exit || test_fail
+check_chronyc_output "^.* 00000000 .*C0A87B01.*C0A87B01.*C0A87B01.*$" || test_fail
+
+test_pass
diff --git a/test/simulation/121-orphan b/test/simulation/121-orphan
deleted file mode 100755 (executable)
index 7579997..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-
-. ./test.common
-
-test_start "orphan option"
-
-check_config_h 'FEAT_CMDMON 1' || test_skip
-
-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=900
-client_start=140
-chronyc_start=700
-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