test: Check sending log messages to remote server works
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
72bbee7812
commit
8f459d349a
@ -14,6 +14,7 @@ addons:
|
|||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- tree
|
- tree
|
||||||
|
- tshark
|
||||||
|
|
||||||
# Custom build script for the time being, no "make test" yet
|
# Custom build script for the time being, no "make test" yet
|
||||||
script:
|
script:
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
EXTRA_DIST = start.sh stop.sh
|
EXTRA_DIST = start.sh stop.sh
|
||||||
EXTRA_DIST += local.sh
|
EXTRA_DIST += local.sh remote.sh
|
||||||
CLEANFILES = *~ *.trs *.log
|
CLEANFILES = *~ *.trs *.log
|
||||||
TEST_EXTENSIONS = .sh
|
TEST_EXTENSIONS = .sh
|
||||||
|
|
||||||
TESTS = start.sh
|
TESTS = start.sh
|
||||||
TESTS += local.sh
|
TESTS += local.sh
|
||||||
|
TESTS += remote.sh
|
||||||
TESTS += stop.sh
|
TESTS += stop.sh
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
|
|
||||||
MSG="foobar"
|
MSG="foobar"
|
||||||
|
|
||||||
../src/logger -u ${SCK} ${MSG}
|
../src/logger -u ${SOCK} ${MSG}
|
||||||
|
|
||||||
grep ${MSG} ${LOG}
|
grep ${MSG} ${LOG}
|
||||||
|
22
test/remote.sh
Executable file
22
test/remote.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -x
|
||||||
|
. ./test.rc
|
||||||
|
|
||||||
|
MSG="kilroy"
|
||||||
|
|
||||||
|
tshark -Qni lo -w ${CAP} port ${PORT} 2>/dev/null &
|
||||||
|
#tcpdump -qlni lo -w ${CAP} port ${PORT} 2>/dev/null &
|
||||||
|
PID="$!"
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
echo "Hej"
|
||||||
|
../src/logger -u ${SOCK} ${MSG}
|
||||||
|
|
||||||
|
echo "Nej"
|
||||||
|
sleep 1
|
||||||
|
kill -TERM ${PID}
|
||||||
|
wait ${PID}
|
||||||
|
|
||||||
|
tshark -d udp.port==${PORT},syslog -r ${CAP} | grep ${MSG}
|
||||||
|
rm ${CAP}
|
||||||
|
|
@ -5,11 +5,12 @@ if [ x"${srcdir}" = x ]; then
|
|||||||
srcdir=.
|
srcdir=.
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat <<EOF > ${CFG}
|
cat <<EOF > ${CONF}
|
||||||
*.* -${LOG}
|
*.* -${LOG}
|
||||||
*.* @192.168.1.1
|
*.* @127.0.0.2
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
../src/syslogd -d -n -f ${CFG} -p ${SCK} -P ${PID} &
|
../src/syslogd -b :${PORT} -d -n -f ${CONF} -p ${SOCK} &
|
||||||
|
echo "$!" > ${PID}
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
@ -2,10 +2,12 @@
|
|||||||
. ./test.rc
|
. ./test.rc
|
||||||
|
|
||||||
if [ -e ${PID} ]; then
|
if [ -e ${PID} ]; then
|
||||||
|
echo "Killing `cat ${PID}` ..."
|
||||||
kill `cat ${PID}`
|
kill `cat ${PID}`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f ${CFG}
|
|
||||||
rm -f ${LOG}
|
rm -f ${LOG}
|
||||||
rm -f ${PID}
|
rm -f ${PID}
|
||||||
rm -f ${SCK}
|
rm -f ${CAP}
|
||||||
|
rm -f ${SOCK}
|
||||||
|
rm -f ${CONF}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
NM=syslog-test
|
NM=syslog-test
|
||||||
CFG=/tmp/${NM}.conf
|
|
||||||
LOG=/tmp/${NM}.log
|
LOG=/tmp/${NM}.log
|
||||||
PID=/tmp/${NM}.pid
|
PID=/tmp/${NM}.pid
|
||||||
SCK=/tmp/${NM}.sock
|
CAP=/tmp/${NM}.pcapng
|
||||||
|
CONF=/tmp/${NM}.conf
|
||||||
|
SOCK=/tmp/${NM}.sock
|
||||||
|
PORT=5514
|
Loading…
Reference in New Issue
Block a user