2019-10-30 21:44:29 +05:30
|
|
|
#!/bin/sh
|
2021-11-22 19:46:05 +05:30
|
|
|
set -x
|
|
|
|
|
2021-11-22 15:52:04 +05:30
|
|
|
if [ x"${srcdir}" = x ]; then
|
|
|
|
srcdir=.
|
|
|
|
fi
|
2021-11-22 19:46:05 +05:30
|
|
|
. ${srcdir}/lib.sh
|
|
|
|
setup
|
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 &
|
2021-07-01 02:30:09 +05:30
|
|
|
TPID="$!"
|
2021-11-22 19:46:05 +05:30
|
|
|
echo "$TPID" >> "$DIR/PIDs"
|
2019-10-31 16:37:52 +05:30
|
|
|
|
|
|
|
# Wait for tshark to start up properly
|
2019-11-14 06:10:33 +05:30
|
|
|
sleep 3
|
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
|
2019-11-14 06:10:33 +05:30
|
|
|
sleep 1
|
2019-10-31 16:37:52 +05:30
|
|
|
|
|
|
|
# Stop tshark collector
|
2021-07-01 02:30:09 +05:30
|
|
|
kill -TERM ${TPID}
|
|
|
|
wait ${TPID}
|
2019-10-30 21:44:29 +05:30
|
|
|
|
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}
|
2021-11-22 19:46:05 +05:30
|
|
|
tshark -r ${CAP} | grep ${MSG} || FAIL "Cannot find: ${MSG}"
|
2019-10-30 21:44:29 +05:30
|
|
|
rm ${CAP}
|