Index: openacs-4/packages/acs-automated-testing/tcl/aa-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/tcl/aa-test-procs.tcl,v diff -u -r1.79.2.76 -r1.79.2.77 --- openacs-4/packages/acs-automated-testing/tcl/aa-test-procs.tcl 28 Jul 2024 17:00:03 -0000 1.79.2.76 +++ openacs-4/packages/acs-automated-testing/tcl/aa-test-procs.tcl 20 Aug 2024 09:15:07 -0000 1.79.2.77 @@ -663,7 +663,7 @@ # # Run each testcase # - foreach testcase_id $testcase_ids { + foreach testcase_id [lsort $testcase_ids] { ns_log notice "========================================= start $testcase_id (Errors: [dict get [ns_logctl stats] Error])" aa_test_start aa_run_testcase $testcase_id @@ -751,6 +751,8 @@ aa_log_result "fail" "$testcase_id: Error calling testcase function _${package_key}__$testcase_id: $msg" } + aa_check_leftovers -silent end + # # Unstub any stubbed functions # @@ -867,7 +869,7 @@ return [set ::__aa_testing_mode 1] } -ad_proc -public aa_test_end {} { +ad_proc -private aa_test_end {} { Clear the flag indicating that a regressoin test is running. It is not always necessary to call this procedurfe explicitly, since @@ -2409,6 +2411,52 @@ } } +ad_proc -public aa_check_leftovers {-silent:boolean {msg final}} { + # + # Perform cleanup tests to check for object/command leaks in + # either the called functions or in the test itself. + # +} { + if {[namespace which ::xo::at_cleanup] ne ""} { + ::xo::at_cleanup + } + + set domNodes [list {*}[info commands domNode0*] {*}[info commands domDoc0x*]] + set xotclObjs [::xotcl::Object info instances -closure] + set nxObjs [::nx::Object info instances -closure] + set tmpObjs [info commands ::nsf::__#*] + set nsSets [expr {[acs::icanuse "ns_set stats"] ? [list [ns_set stats]] : [llength [ns_set list]]}] + + dict set stats tdom [llength $domNodes] + dict set stats nssets [llength $nsSets] + dict set stats xotcl [llength $xotclObjs] + dict set stats nx [llength $nxObjs] + dict set stats tmpobjs [llength $tmpObjs] + + dict with stats { + aa_equals "$msg leftover temp objects" $tmpobjs 0 + if {$tmpobjs > 0} { + foreach obj $tmpObjs { + set isXotcl [::nsf::dispatch $obj ::nsf::methods::object::info::hastype ::xotcl::Object] + set isNx [::nsf::dispatch $obj ::nsf::methods::object::info::hastype ::nx::Object] + aa_log obj $obj (isXotcl $isXotcl isNx $isNx) + aa_log
[$obj serialize]
+ } + } + aa_equals "$msg leftover tdom cmds" $tdom 0 + foreach n $domNodes { + if {[string match domDoc0x* $n]} { + aa_log node:$n\n
[ns_quotehtml [$n asXML -indent 4]]
+ } + } + if {$silent_p} { + aa_log "$msg xotcl objects: $xotcl nx objects: $nx nssets: $nssets" + } + } +} + + + ad_proc -private aa_selenium_init {} { Setup a global Selenium RC server connection