blob: 3e5ca5e71da6299989163921c098ef9e6bd0bf3e [file] [log] [blame]
#!/bin/sh
. ./wvtest/wvtest.sh
export VERSIONFILE='./testdata/version'
WVSTART "prefix-logs"
contains() {
[ "$1" != "${1%$2*}" ]
}
WVPASS contains foible ib
WVPASS contains 'big deal' ' '
WVFAIL contains foible ' '
echo "time stamp crap silly whatever hostname foo: blue message ☺
2015-09-30T22:37:34.207817-04:00 whatever.xxx.corp.google.com CRON[1734]: pam_unix(cron:session): session closed for user root
Sep 30 19:42:10 blob102 apenwarr: hello world
" |
./prefix-logs | {
export IFS='[] '
# prefix-logs always prepends an initial T: line as well as printing
# additional ones on a schedule. Test the initial one.
read level ts fac version timeval date time ntp junk
WVPASSEQ "$fac" "T:"
WVFAIL contains "$version" ' '
WVPASS [ "$timeval" -gt 0 ]
WVPASSEQ "$ntp" "ntp=1"
WVPASSEQ "$junk" ""
# our actual log messages from above.
read level ts fac msg
WVPASSEQ "$fac" "foo:"
WVPASSEQ "$msg" "blue message ☺"
read level ts fac msg
WVPASSEQ "$fac" "CRON:"
WVPASSEQ "$msg" "pam_unix(cron:session): session closed for user root"
read level ts fac msg
WVPASSEQ "$fac" "apenwarr:"
WVPASSEQ "$msg" "hello world"
}