1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
package require tcltest
package require syslog
::tcltest::test syslog-template-1.0 {literal payload roundtrip via test server} \
-constraints hasSyslogWatcher \
-body {
puts "pwd: [pwd]"
package require harness
set msg "${::base}-literal"
syslog -pid -ident test_ident -facility local2 critical $msg
set hit [::syslogtest::harness::wait_for_response $msg 8000]
expr {[dict get $hit payload] eq $msg}
} -result 1
::tcltest::test syslog-template-1.1 {regexp payload match via test server} \
-constraints hasSyslogWatcher \
-body {
package require harness
set msg "${::base}-regexp seq=0101"
syslog -pid -ident test_ident -facility local2 notice $msg
set hit [::syslogtest::harness::wait_for_response {seq=[0-9]+} 8000 regexp]
regexp -- {seq=[0-9]+} [dict get $hit payload]
} -result 1
::tcltest::test syslog-template-1.2 {test basic ::syslog::open ::syslog::log option handling} \
-constraints hasSyslogWatcher \
-body {
package require harness
set r [catch {
set msg "${::base}-regexp seq=0102"
::syslog::open -ident "test1.2"
::syslog::log -facility local2 notice $msg
}]
set r
} -result 0
|