2019-10-30 21:44:29 +05:30
|
|
|
#!/bin/sh
|
2019-10-31 14:34:36 +05:30
|
|
|
set -ex
|
2019-11-07 23:28:25 +05:30
|
|
|
if [ x"${srcdir}" = x ]; then
|
|
|
|
srcdir=.
|
|
|
|
fi
|
2019-11-05 00:39:54 +05:30
|
|
|
. ${srcdir}/test.rc
|
2019-10-30 21:44:29 +05:30
|
|
|
|
|
|
|
MSG="kilroy"
|
|
|
|
|
2019-10-31 16:37:52 +05:30
|
|
|
# Start collector in background, note: might need sudo!
|
2019-11-12 17:57:07 +05:30
|
|
|
#tshark -Qni lo -w ${CAP} port ${PORT} &
|
|
|
|
tshark -Qni lo -w ${CAP} port 514 &
|
2019-10-30 21:44:29 +05:30
|
|
|
PID="$!"
|
2019-10-31 16:37:52 +05:30
|
|
|
|
|
|
|
# Wait for tshark to start up properly
|
|
|
|
sleep 2
|
2019-10-30 21:44:29 +05:30
|
|
|
|
|
|
|
../src/logger -u ${SOCK} ${MSG}
|
|
|
|
|
2019-10-31 16:37:52 +05:30
|
|
|
# Wait for any OS delays, in particular on Travis
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
# Stop tshark collector
|
2019-10-31 15:16:49 +05:30
|
|
|
kill -TERM ${PID}
|
2019-10-30 21:44:29 +05:30
|
|
|
wait ${PID}
|
|
|
|
|
2019-10-31 16:37:52 +05:30
|
|
|
# Analyze content, should have $MSG now ...
|
2019-11-12 17:57:07 +05:30
|
|
|
#tshark -d udp.port==${PORT},syslog -r ${CAP} | grep ${MSG}
|
|
|
|
tshark -r ${CAP} | grep ${MSG}
|
2019-10-30 21:44:29 +05:30
|
|
|
rm ${CAP}
|
|
|
|
|