This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Pau Espin Pedrol gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/6483 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. Change-Id: I240d8f1bdb2ca6ad353e60ef15937dc2bd4cbebd --- M ttcn3-tcpdump-stop.sh 1 file changed, 20 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/83/6483/1 diff --git a/ttcn3-tcpdump-stop.sh b/ttcn3-tcpdump-stop.sh index 575c0ef..0c6057d 100755 --- a/ttcn3-tcpdump-stop.sh +++ b/ttcn3-tcpdump-stop.sh @@ -1,6 +1,26 @@ #!/bin/sh PIDFILE=/tmp/tcpdump.pid +TCPDUMP=/usr/sbin/tcpdump +TESTCASE=$1 + +if [ "z$TTCN3_PCAP_PATH" = "z" ]; then + TTCN3_PCAP_PATH=/tmp +fi + +# Wait for up to 2 seconds if we keep receiving traffinc from tcpdump, +# otherwise we might lose last packets from test. +i=0 +prev_count=-1 +count=$($TCPDUMP -r "$TTCN3_PCAP_PATH/$TESTCASE.pcap" 2>/dev/null | wc -l) +while [ $count -gt $prev_count ] && [ $i -lt 2 ] +do + echo "Waiting for tcpdump to finish... $i (prev_count=$prev_count, count=$count)" + sleep 1 + prev_count=$count + count=$($TCPDUMP -r "$TTCN3_PCAP_PATH/$TESTCASE.pcap" 2>/dev/null | wc -l) + i=$((i+1)) +done 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-MessageType: newchange Gerrit-Change-Id: I240d8f1bdb2ca6ad353e60ef15937dc2bd4cbebd Gerrit-PatchSet: 1 Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>