]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
test: add option to dump traffic to pcaps
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 3 Apr 2023 12:36:30 +0000 (14:36 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 3 Apr 2023 12:36:30 +0000 (14:36 +0200)
This will be useful for debugging.

test/simulation/test.common

index 70bbde142eebc7552b645a2fe6c51747506dadc1..3f6e80be16a52c32473a4953b1bcd95babe0a149 100644 (file)
@@ -78,6 +78,7 @@ default_client_min_mean_out_interval=0.0
 default_client_max_min_out_interval=inf
 
 default_cmdmon_unix=1
+default_pcap_dumps=0
 default_dns=0
 
 # Initialize test settings from their defaults
@@ -469,6 +470,9 @@ run_test() {
 
                for i in $(seq 1 $n); do
                        test_message 2 0 "starting node $node:"
+
+                       [ $pcap_dumps -ne 0 ] && export CLKNETSIM_PCAP_DUMP=tmp/pcap.$node
+
                        if [ $stratum -eq 1 ]; then
                                step=$server_step
                                start=$server_start
@@ -509,6 +513,8 @@ run_test() {
        for i in $(seq 1 $[$nodes - $node + 1]); do
                test_message 2 0 "starting node $node:"
 
+               [ $pcap_dumps -ne 0 ] && export CLKNETSIM_PCAP_DUMP=tmp/pcap.$node
+
                options=$([ $dns -eq 0 ] && printf "%s" "-n")
                if [ $cmdmon_unix -ne 0 ]; then
                        options+=" -h /clknetsim/unix/$[$node - $clients]:1"