From 3cc81376a6f0d33a8385018565f9ca5ac13eac0e Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Fri, 21 Mar 2014 12:04:10 +0100 Subject: [PATCH] test: add port number check --- test/simulation/test.common | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/simulation/test.common b/test/simulation/test.common index 6635128..a6cde3c 100644 --- a/test/simulation/test.common +++ b/test/simulation/test.common @@ -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