2019-10-30 17:14:29 +01:00
|
|
|
#!/bin/sh
|
2019-10-31 10:04:36 +01:00
|
|
|
set -ex
|
2019-11-07 18:58:25 +01:00
|
|
|
if [ x"${srcdir}" = x ]; then
|
|
|
|
srcdir=.
|
|
|
|
fi
|
2019-11-04 20:09:54 +01:00
|
|
|
. ${srcdir}/test.rc
|
2019-10-30 17:14:29 +01:00
|
|
|
|
|
|
|
MSG="kilroy"
|
|
|
|
|
2019-10-31 12:07:52 +01:00
|
|
|
# Start collector in background, note: might need sudo!
|
2019-11-12 13:27:07 +01:00
|
|
|
#tshark -Qni lo -w ${CAP} port ${PORT} &
|
|
|
|
tshark -Qni lo -w ${CAP} port 514 &
|
2019-10-30 17:14:29 +01:00
|
|
|
PID="$!"
|
2019-10-31 12:07:52 +01:00
|
|
|
|
|
|
|
# Wait for tshark to start up properly
|
2019-11-14 01:40:33 +01:00
|
|
|
sleep 3
|
2019-10-30 17:14:29 +01:00
|
|
|
|
|
|
|
../src/logger -u ${SOCK} ${MSG}
|
|
|
|
|
2019-10-31 12:07:52 +01:00
|
|
|
# Wait for any OS delays, in particular on Travis
|
2019-11-14 01:40:33 +01:00
|
|
|
sleep 1
|
2019-10-31 12:07:52 +01:00
|
|
|
|
|
|
|
# Stop tshark collector
|
2019-10-31 10:46:49 +01:00
|
|
|
kill -TERM ${PID}
|
2019-10-30 17:14:29 +01:00
|
|
|
wait ${PID}
|
|
|
|
|
2019-10-31 12:07:52 +01:00
|
|
|
# Analyze content, should have $MSG now ...
|
2019-11-12 13:27:07 +01:00
|
|
|
#tshark -d udp.port==${PORT},syslog -r ${CAP} | grep ${MSG}
|
|
|
|
tshark -r ${CAP} | grep ${MSG}
|
2019-10-30 17:14:29 +01:00
|
|
|
rm ${CAP}
|
|
|
|
|