[MERGED] osmo-ttcn3-hacks[master]: ttcn3-tcpdump-stop.sh: Wait to receive last packets before s...
gerrit-no-reply at lists.osmocom.org
Thu Feb 15 17:22:52 UTC 2018
Harald Welte has submitted this change and it was merged.
Change subject: ttcn3-tcpdump-stop.sh: Wait to receive last packets before stopping tcpdump
ttcn3-tcpdump-stop.sh: Wait to receive last packets before stopping tcpdump
There's a time delay between packets are sent through the system and
tcpdump reads, buffers and stores them into the pcap file. We need to
give it more time to process everything before killing it, otherwise
last (or all) packets from the test are not captured.
1 file changed, 19 insertions(+), 0 deletions(-)
Harald Welte: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/ttcn3-tcpdump-stop.sh b/ttcn3-tcpdump-stop.sh
index 575c0ef..a085bf7 100755
@@ -1,6 +1,25 @@
+if [ "z$TTCN3_PCAP_PATH" = "z" ]; then
+# Wait for up to 2 seconds if we keep receiving traffinc from tcpdump,
+# otherwise we might lose last packets from test.
+count=$(stat --format="%s" "$TTCN3_PCAP_PATH/$TESTCASE.pcap")
+while [ $count -gt $prev_count ] && [ $i -lt 2 ]
+ echo "Waiting for tcpdump to finish... $i (prev_count=$prev_count, count=$count)"
+ sleep 1
+ count=$(stat --format="%s" "$TTCN3_PCAP_PATH/$TESTCASE.pcap")
if [ -e $PIDFILE ]; then
# NOTE: This requires you to be root or something like
To view, visit https://gerrit.osmocom.org/6483
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
More information about the gerrit-log