osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/41204?usp=email )
Change subject: ttcn3-tcpdump-start: fix default TTCN3_PCAP_PATH ......................................................................
ttcn3-tcpdump-start: fix default TTCN3_PCAP_PATH
Fix that manually running testsuites (as described in README.md) would unsucessfully attempt to start dumpcap for 10s before running each test:
NOTE: unable to use dumpcap due to missing permissions in /tmp Warning: Named pipe already exists: /tmp/cmderr sudo -n /usr/bin/tcpdump -U -s 1520 -n -i any -w "/tmp/smdpp_Tests.TC_rsp_complete_flow.pcap" >/tmp/smdpp_Tests.TC_rsp_complete_flow.pcap.stdout 2>/tmp/cmderr & Waiting for packet dumper to start... 0 Waiting for packet dumper to start... 1 Waiting for packet dumper to start... 2 Waiting for packet dumper to start... 3 Waiting for packet dumper to start... 4 Waiting for packet dumper to start... 5 Waiting for packet dumper to start... 6 Waiting for packet dumper to start... 7 Waiting for packet dumper to start... 8 Waiting for packet dumper to start... 9 Packet dumper didn't start filling pcap file after 10 seconds!!!
This happens because /tmp is owned by root and not by the user running ttcn3-tcpdump-start. Put the pcaps in /tmp/pcap by default instead of /tmp and create this directory as the current user if it does not exist. This also prevents cluttering /tmp.
Note that this is only relevant when manually running the testsuites and not setting TTCN3_PCAP_PATH, e.g. testenv sets this variable already.
Change-Id: I1eb80d7f9e8dd491387e4d1da9b4ac6ac5cb7dc5 --- M ttcn3-dumpcap-start.sh M ttcn3-tcpdump-start.sh 2 files changed, 4 insertions(+), 2 deletions(-)
Approvals: laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, but someone else must approve Jenkins Builder: Verified osmith: Looks good to me, approved
diff --git a/ttcn3-dumpcap-start.sh b/ttcn3-dumpcap-start.sh index ddd4eb4..4bdd3ec 100755 --- a/ttcn3-dumpcap-start.sh +++ b/ttcn3-dumpcap-start.sh @@ -19,7 +19,8 @@ date
if [ "z$TTCN3_PCAP_PATH" = "z" ]; then - TTCN3_PCAP_PATH=/tmp + TTCN3_PCAP_PATH=/tmp/pcap + mkdir -p "$TTCN3_PCAP_PATH" fi
kill_rm_pidfile $PIDFILE_NETCAT diff --git a/ttcn3-tcpdump-start.sh b/ttcn3-tcpdump-start.sh index 2c2f8c5..4b5244c 100755 --- a/ttcn3-tcpdump-start.sh +++ b/ttcn3-tcpdump-start.sh @@ -24,7 +24,8 @@ date
if [ "z$TTCN3_PCAP_PATH" = "z" ]; then - TTCN3_PCAP_PATH=/tmp + TTCN3_PCAP_PATH=/tmp/pcap + mkdir -p "$TTCN3_PCAP_PATH" fi
kill_rm_pidfile $PIDFILE_NETCAT