]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
test: add port number check
authorMiroslav Lichvar <mlichvar@redhat.com>
Fri, 21 Mar 2014 11:04:10 +0000 (12:04 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 21 Mar 2014 12:20:36 +0000 (13:20 +0100)
test/simulation/test.common

index 6635128521eaf98b5cec103b5133b5b7cebcfcbe..a6cde3c11e07dbf900c1c7aee3b8df52513d38c5 100644 (file)
@@ -313,6 +313,25 @@ check_chronyc_output() {
        return $ret
 }
 
+# Check if only NTP port (123) was used
+check_packet_port() {
+       local i ret=0 port=123
+
+       test_message 2 1 "checking port numbers in packet log:"
+
+       for i in $(seq 1 $(get_chronyd_nodes)); do
+               test_message 3 0 "node $i:"
+
+               grep -E -q "    $port   [0-9]+\$" tmp/log.packets && \
+                       ! grep -E "^[0-9e.+-]+  $i      " tmp/log.packets | \
+                       grep -E -q -v " $port   [0-9]+\$" && \
+                       test_ok || test_bad
+               [ $? -eq 0 ] || ret=1
+       done
+
+       return $ret
+}
+
 # Print test settings which differ from default value
 print_nondefaults() {
        local defopt defoptname optname