test: minor aesthetic, slightly improve test logging
Conforming tests should use SKIP/FAIL/OK, so let existing tests follow that better. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
parent
f29f31340c
commit
0a99c7f386
15
test/api.sh
15
test/api.sh
@ -7,11 +7,11 @@ setup
|
|||||||
|
|
||||||
export MSG="no-openlog-apitest"
|
export MSG="no-openlog-apitest"
|
||||||
|
|
||||||
echo "= Phase 1 - simple syslog(), no openlog() ==============="
|
print "Phase 1 - simple syslog(), no openlog()"
|
||||||
./api
|
./api
|
||||||
grep "api: ${MSG}" ${LOG}
|
grep "api: ${MSG}" ${LOG}
|
||||||
|
|
||||||
echo "= Phase 2 - syslog() with openlog() & custom facility ==="
|
print "Phase 2 - syslog() with openlog() & custom facility"
|
||||||
cat <<EOF >${CONFD}/console.conf
|
cat <<EOF >${CONFD}/console.conf
|
||||||
console.* -${LOGCONS}
|
console.* -${LOGCONS}
|
||||||
EOF
|
EOF
|
||||||
@ -20,11 +20,12 @@ reload
|
|||||||
./api -i foo
|
./api -i foo
|
||||||
grep "foo: ${MSG}" ${LOGCONS}
|
grep "foo: ${MSG}" ${LOGCONS}
|
||||||
|
|
||||||
echo "= Phase 3 - Verify setlogmask() filters out LOG_INFO ===="
|
print "Phase 3 - Verify setlogmask() filters out LOG_INFO"
|
||||||
./api -i xyzzy -l
|
./api -i xyzzy -l
|
||||||
grep "xyzzy: ${MSG}" ${LOGCONS} || true
|
grep "xyzzy: ${MSG}" "${LOGCONS}" && FAIL "Filtering w/ setlogmask() broken"
|
||||||
|
echo "Filtering w/ setlogmask() Works fine"
|
||||||
|
|
||||||
echo "= Phase 4 - Verify RFC5424 API with syslogp() ==========="
|
print "Phase 4 - Verify RFC5424 API with syslogp()"
|
||||||
cat <<EOF >${CONFD}/v1.conf
|
cat <<EOF >${CONFD}/v1.conf
|
||||||
ftp.* -${LOGV1} ;RFC5424
|
ftp.* -${LOGV1} ;RFC5424
|
||||||
EOF
|
EOF
|
||||||
@ -35,7 +36,9 @@ sleep 2
|
|||||||
ps fax |grep -A2 syslogd
|
ps fax |grep -A2 syslogd
|
||||||
grep "troglobit - MSGID - ${MSG}" ${LOGV1} || (echo "== ${LOGV1}"; tail -10 ${LOGV1}; echo "== ${LOG}"; tail -10 ${LOG}; cat ${CONFD}/v1.conf; FAIL "Cannot find troglobit")
|
grep "troglobit - MSGID - ${MSG}" ${LOGV1} || (echo "== ${LOGV1}"; tail -10 ${LOGV1}; echo "== ${LOG}"; tail -10 ${LOG}; cat ${CONFD}/v1.conf; FAIL "Cannot find troglobit")
|
||||||
|
|
||||||
echo "= Phase 4 - Verify RFC5424 API with logger(1) ==========="
|
print "Phase 4 - Verify RFC5424 API with logger(1)"
|
||||||
../src/logger -p ftp.notice -u ${SOCK} -m "MSDSD" -d '[exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"]' "waldo"
|
../src/logger -p ftp.notice -u ${SOCK} -m "MSDSD" -d '[exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"]' "waldo"
|
||||||
sleep 2
|
sleep 2
|
||||||
grep "exampleSDID@32473" ${LOGV1} || (echo "== ${LOGV1}"; tail -10 ${LOGV1}; FAIL "Cannot find exampleSDID@32473")
|
grep "exampleSDID@32473" ${LOGV1} || (echo "== ${LOGV1}"; tail -10 ${LOGV1}; FAIL "Cannot find exampleSDID@32473")
|
||||||
|
|
||||||
|
OK
|
||||||
|
@ -23,8 +23,11 @@ EOF
|
|||||||
|
|
||||||
setup2 -m0 -a 127.0.0.2:* -b ":${PORT2}"
|
setup2 -m0 -a 127.0.0.2:* -b ":${PORT2}"
|
||||||
|
|
||||||
|
print "TEST: Starting"
|
||||||
|
|
||||||
|
|
||||||
../src/logger -t fwd -p ntp.notice -u ${SOCK} -m "NTP123" ${MSG}
|
../src/logger -t fwd -p ntp.notice -u ${SOCK} -m "NTP123" ${MSG}
|
||||||
sleep 3
|
sleep 3
|
||||||
grep "fwd - NTP123 - ${MSG}" ${LOG2} || FAIL "Nothing forwarded."
|
grep "fwd - NTP123 - ${MSG}" ${LOG2} || FAIL "Nothing forwarded."
|
||||||
|
|
||||||
|
OK
|
||||||
|
@ -5,6 +5,8 @@ fi
|
|||||||
. ${srcdir}/lib.sh
|
. ${srcdir}/lib.sh
|
||||||
setup
|
setup
|
||||||
|
|
||||||
|
print "TEST: Starting"
|
||||||
|
|
||||||
MSG="foobar"
|
MSG="foobar"
|
||||||
MSG2="xyzzy"
|
MSG2="xyzzy"
|
||||||
|
|
||||||
@ -13,3 +15,4 @@ grep ${MSG} ${LOG} || FAIL "Cannot find: ${MSG}"
|
|||||||
|
|
||||||
../src/logger -u ${ALTSOCK} ${MSG2}
|
../src/logger -u ${ALTSOCK} ${MSG2}
|
||||||
grep ${MSG2} ${LOG} || FAIL "Cannot find: ${MSG2}"
|
grep ${MSG2} ${LOG} || FAIL "Cannot find: ${MSG2}"
|
||||||
|
OK
|
||||||
|
@ -12,3 +12,5 @@ EOF
|
|||||||
setup -m0 >"${LOG2}"
|
setup -m0 >"${LOG2}"
|
||||||
|
|
||||||
grep ';RFC5424,rotate=10000000:5' ${LOG2} || FAIL "Failed parsing RFC542 .conf"
|
grep ';RFC5424,rotate=10000000:5' ${LOG2} || FAIL "Failed parsing RFC542 .conf"
|
||||||
|
|
||||||
|
OK
|
||||||
|
@ -18,6 +18,8 @@ cat <<-EOF >${CONFD2}/50-default.conf
|
|||||||
|
|
||||||
setup2 -m0 -a 127.0.0.2:* -b ":${PORT2}"
|
setup2 -m0 -a 127.0.0.2:* -b ":${PORT2}"
|
||||||
|
|
||||||
|
print "TEST: Starting"
|
||||||
|
|
||||||
# Start collector in background, note: might need sudo!
|
# Start collector in background, note: might need sudo!
|
||||||
#tshark -Qni lo -w ${CAP} port ${PORT} &
|
#tshark -Qni lo -w ${CAP} port ${PORT} &
|
||||||
tshark -Qni lo -w ${CAP} port 514 2>/dev/null &
|
tshark -Qni lo -w ${CAP} port 514 2>/dev/null &
|
||||||
@ -39,3 +41,5 @@ wait ${TPID}
|
|||||||
# Analyze content, should have $MSG now ...
|
# Analyze content, should have $MSG now ...
|
||||||
#tshark -d udp.port==${PORT},syslog -r ${CAP} | grep ${MSG}
|
#tshark -d udp.port==${PORT},syslog -r ${CAP} | grep ${MSG}
|
||||||
tshark -r ${CAP} 2>/dev/null | grep ${MSG} || FAIL "Cannot find: ${MSG}"
|
tshark -r ${CAP} 2>/dev/null | grep ${MSG} || FAIL "Cannot find: ${MSG}"
|
||||||
|
|
||||||
|
OK
|
||||||
|
Loading…
Reference in New Issue
Block a user