]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
test: enable chronyc to use Unix domain socket
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 15 Sep 2021 14:57:09 +0000 (16:57 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 23 Sep 2021 12:48:59 +0000 (14:48 +0200)
test/simulation/110-chronyc
test/simulation/test.common

index e8d6e2183e49589ac06cc8a890ad4c86d46be81a..e6253280ff5672b9fcddd1b17afd336623be6656 100755 (executable)
@@ -14,6 +14,7 @@ server 192.168.123.2"
 client_conf="
 refclock SHM 0 noselect
 smoothtime 400 0.001 leaponly"
+cmdmon_unix=0
 
 chronyc_conf="activity
 tracking
index 9d85a5ca607d317444add66661ed82179aa070d6..cb68020d40238f009fb6010483c02818150d80b9 100644 (file)
@@ -76,6 +76,7 @@ default_max_sync_time=210
 default_client_min_mean_out_interval=0.0
 default_client_max_min_out_interval=inf
 
+default_cmdmon_unix=1
 default_dns=0
 
 # Initialize test settings from their defaults
@@ -434,6 +435,7 @@ run_simulation() {
        test_message 2 0 "running simulation:"
 
        start_server $nodes \
+               -n 2 \
                -o tmp/log.offset -f tmp/log.freq -p tmp/log.packets \
                -R $(awk "BEGIN {print $update_interval < 0 ? 2^-($update_interval) : 1}") \
                -r $(awk "BEGIN {print $max_sync_time * 2^$update_interval}") \
@@ -449,6 +451,8 @@ run_test() {
        nodes=$(get_chronyd_nodes)
        [ -n "$chronyc_conf" ] && nodes=$[$nodes + $clients]
 
+       export CLKNETSIM_UNIX_SUBNET=$[$cmdmon_unix != 0 ? 2 : 0]
+
        for i in $(seq 1 $nodes); do
                echo "node${i}_shift_pll = $shift_pll"
                for j in $(seq 1 $nodes); do
@@ -503,9 +507,15 @@ run_test() {
        for i in $(seq 1 $[$nodes - $node + 1]); do
                test_message 2 0 "starting node $node:"
 
+               options=$([ $dns -eq 0 ] && printf "%s" "-n")
+               if [ $cmdmon_unix -ne 0 ]; then
+                       options+=" -h /clknetsim/unix/$[$node - $clients]:1"
+               else
+                       options+=" -h $(get_node_name $[$node - $clients])"
+               fi
+
                echo "node${node}_start = $chronyc_start" >> tmp/conf
-               start_client $node chronyc "$chronyc_conf" "" \
-                       "$([ $dns -eq 0 ] && printf "%s" "-n") -h $(get_node_name $[$node - $clients]) $chronyc_options" && \
+               start_client $node chronyc "$chronyc_conf" "" "$options $chronyc_options" && \
                        test_ok || test_error
 
                [ $? -ne 0 ] && return 1