From: Stephen D. <sd...@us...> - 2005-08-04 05:29:52
|
Update of /cvsroot/naviserver/naviserver/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30326/tests Modified Files: all.tcl Added Files: ns_log.test Log Message: * nsd/nsd.h: * nsd/nsconf.h: * nsd/nsconf.c: * nsd/log.c: Use efficient table lookups to convert from severity strings to severity levels and back again. Localize global log configuration into log.c. * tests/ns_log.test: Add some simple tests for the ns_log and ns_logctl commands. * tests/all.tcl: tcltest does not actually get confused by log messages... Index: all.tcl =================================================================== RCS file: /cvsroot/naviserver/naviserver/tests/all.tcl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** all.tcl 3 Apr 2005 06:38:01 -0000 1.2 --- all.tcl 4 Aug 2005 05:29:41 -0000 1.3 *************** *** 44,49 **** eval configure $argv -singleproc true -testdir [file dirname [info script]] - # Output on stderr confuses tcltest - ns_logctl hold runAllTests --- 44,47 ---- --- NEW FILE: ns_log.test --- # # $Header: /cvsroot/naviserver/naviserver/tests/ns_log.test,v 1.1 2005/08/04 05:29:41 sdeasey Exp $ # package require tcltest 2.2 namespace import -force ::tcltest::* eval ::tcltest::configure $argv test ns_log-1.1 {basic syntax} -body { ns_log } -returnCodes error -result {wrong # args: should be "ns_log severity string ?string ...?"} test ns_log-1.2 {basic syntax} -body { ns_log ? ? } -returnCodes error -result {unknown severity: "?": should be notice, warning, error, fatal, bug, debug, dev or integer value} test ns_log-2.1 {basic syntax} -body { ns_logctl } -returnCodes error -result {wrong # args: should be "ns_logctl option ?arg?"} test ns_log-2.2 {basic syntax} -body { ns_logctl ? } -returnCodes error -result {bad option "?": must be hold, count, get, peek, flush, release, or truncate} ns_logctl hold ns_logctl trunc test ns_log-3.1 {severity} -body { ns_log notice test ns_logctl get } -match glob -result "* Notice: test\n" test ns_log-3.2 {severity} -body { ns_log warning test ns_logctl get } -match glob -result "* Warning: test\n" test ns_log-3.3 {severity} -body { ns_log error test ns_logctl get } -match glob -result "* Error: test\n" test ns_log-3.4 {severity} -body { ns_log fatal test ns_logctl get } -match glob -result "* Fatal: test\n" test ns_log-3.5 {severity} -body { ns_log bug test ns_logctl get } -match glob -result "* Bug: test\n" test ns_log-3.6 {severity} -constraints knownBug -body { ns_log debug test ns_logctl get } -match glob -result "* Debug: test\n" test ns_log-3.7 {severity} -constraints knownBug -body { ns_log dev test ns_logctl get } -match glob -result "* Dev: test\n" test ns_log-4.1 {multiple args} -body { ns_log notice one two ns_logctl get } -match glob -result "* Notice: one two\n" test ns_log-4.2 {multiple args} -body { ns_log notice one two three ns_logctl get } -match glob -result "* Notice: one two three\n" test ns_log-5.1 {buffering} -body { ns_log notice one ns_log notice two ns_logctl get } -match glob -result "* Notice: one\n* Notice: two\n" test ns_log-5.2 {count buffered log entries} -body { ns_log notice one ns_log notice two set n [ns_logctl count] ns_logctl trunc set n } -result 2 test ns_log-5.3 {peek} -body { ns_log notice test set equal [string equal [ns_logctl peek] [ns_logctl peek]] ns_logctl trunc set equal } -result 1 test ns_log-5.4 {trunc} -body { ns_log notice test ns_logctl trunc ns_logctl get } -result {} test ns_log-5.5 {trunc} -body { ns_log notice test ns_logctl trunc [expr [string length [ns_logctl peek]] - 2] ns_logctl get } -match glob -result {* Notice: tes} test ns_log-5.6 {get} -body { ns_log notice test ns_logctl get ns_logctl get } -result {} test ns_log-5.7 {get} -body { ns_log notice test set n [ns_logctl count] ns_logctl get lappend n [ns_logctl count] } -result {1 0} test ns_log-5.8 {flush} -body { ns_log notice test ns_logctl flush ns_logctl get } -result {} test ns_log-5.9 {flush} -body { ns_log notice test set n [ns_logctl count] ns_logctl flush lappend n [ns_logctl count] } -result {1 0} ns_logctl trunc ns_logctl release cleanupTests |