Skip to content

Commit 2fbac9e

Browse files
committed
test: update tag.sh, include dots in name and verify tag in logfile
Issue #102 Signed-off-by: Joachim Wiberg <[email protected]>
1 parent b622711 commit 2fbac9e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/tag.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
#!/bin/sh
22
# Verify log filtering based on ident/tag.
3+
#DEBUG=true
34
. "${srcdir:-.}/lib.sh"
45

56
TG1=pimd
67
TG2=mrouted
8+
TG3=in.tftpd
79
MSG="Multicast, a perfect weapon for an imperfect time."
810
UNX="In UNIX we trust"
11+
DOT="We bring 512 byte block gifts"
912

1013
LOGDIR="$DIR/log"
1114
SYSLOG="${LOGDIR}/syslog"
1215
TG1LOG="${LOGDIR}/$TG1.log"
1316
TG2LOG="${LOGDIR}/$TG2.log"
17+
TG3LOG="${LOGDIR}/$TG3.log"
1418

1519
setup_syslogd()
1620
{
@@ -22,6 +26,8 @@ setup_syslogd()
2226
*.* $TG1LOG
2327
#!$TG2
2428
*.* $TG2LOG
29+
#!$TG3
30+
*.* $TG3LOG
2531
EOF
2632
setup -m0
2733
}
@@ -32,8 +38,8 @@ verify_tag()
3238
log="$1"; shift
3339
msg="$*"
3440

35-
logger -t "$tag" "$msg"
36-
grep "$msg" "$log"
41+
logger -ip user.debug -t "$tag" "$msg"
42+
grep "$msg" "$log" |grep "$tag"
3743
}
3844

3945
verify_log()
@@ -52,6 +58,7 @@ verify_not()
5258
run_step "Set up property based filtering syslogd" setup_syslogd
5359
run_step "Verify basic tag based filtering (1)" verify_tag "$TG1" "$TG1LOG" "$MSG"
5460
run_step "Verify basic tag based filtering (2)" verify_tag "$TG2" "$TG2LOG" "$MSG"
61+
run_step "Verify basic tag based filtering (3)" verify_tag "$TG3" "$TG3LOG" "$DOT"
5562
run_step "Verify not in syslog" verify_not "$SYSLOG" "$MSG"
5663

5764
run_step "Verify unfiltered tag logging" verify_tag "foo" "$SYSLOG" "$UNX"

0 commit comments

Comments
 (0)