From e057146df7b16f34bf7fd59510e692cb9691f85b Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 14 Feb 2018 15:42:14 +0100 Subject: re-organize configuration files; add tcpdump integration Let's make sure we share common configuration between the test suites and split the config file into a "default" part which is used (but not copied) in the Docker images, and a "local" part which is basically those overrides that the user (or docker image) wants to do from the default. Change-Id: I3db452e24e5238aa05254d903739c64d202e61db --- ttcn3-tcpdump-start.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 ttcn3-tcpdump-start.sh (limited to 'ttcn3-tcpdump-start.sh') diff --git a/ttcn3-tcpdump-start.sh b/ttcn3-tcpdump-start.sh new file mode 100755 index 00000000..1349cd70 --- /dev/null +++ b/ttcn3-tcpdump-start.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +PIDFILE=/tmp/tcpdump.pid +TESTCASE=$1 + +if [ "z$TTCN3_PCAP_PATH" = "z" ]; then + TTCN3_PCAP_PATH=/tmp +fi + +if [ -e $PIDFILE ]; then + kill "$(cat "$PIDFILE")" + rm $PIDFILE +fi + +# NOTE: This requires you to be root or something like +# "laforge ALL=NOPASSWD: /usr/sbin/tcpdump, /bin/kill" in your sudoers file +if [ "$(id -u)" = "0" ]; then + CMD=/usr/sbin/tcpdump +else + CMD="sudo /usr/sbin/tcpdump" +fi +$CMD -s 0 -n -i any -w "$TTCN3_PCAP_PATH/$TESTCASE.pcap" >/dev/null 2>&1 & +PID=$! +echo $PID > $PIDFILE -- cgit v1.2.3