- Timestamp:
- Jan 26, 2011, 5:58:26 PM (14 years ago)
- Location:
- trunk/tester
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tester/tclIndex
r2053 r2068 62 62 set auto_index(::Rappture::ResultsPage::_reorder) [list source [file join $dir resultspage.tcl]] 63 63 set auto_index(::Rappture::ResultsPage::resultset) [list source [file join $dir resultspage.tcl]] 64 set auto_index(::Rappture::Tester::TestBuilder) [list source [file join $dir testbuilder.tcl]] 65 set auto_index(::Rappture::Tester::TestBuilder::tool) [list source [file join $dir testbuilder.tcl]] 66 set auto_index(::Rappture::Tester::TestBuilder::constructor) [list source [file join $dir testbuilder.tcl]] 64 67 set auto_index(::Rappture::Tester::selectionHandler) [list source [file join $dir tester.tcl]] 65 68 set auto_index(::Rappture::Tester::regoldenize) [list source [file join $dir tester.tcl]] 69 set auto_index(::Rappture::Tester::makeTest) [list source [file join $dir tester.tcl]] 66 70 set auto_index(::Rappture::Tester::TestTree) [list source [file join $dir testtree.tcl]] 67 71 set auto_index(::Rappture::Tester::TestTree::constructor) [list source [file join $dir testtree.tcl]] 72 set auto_index(::Rappture::Tester::TestTree::destructor) [list source [file join $dir testtree.tcl]] 68 73 set auto_index(::Rappture::Tester::TestTree::testdir) [list source [file join $dir testtree.tcl]] 69 74 set auto_index(::Rappture::Tester::TestTree::toolxml) [list source [file join $dir testtree.tcl]] -
trunk/tester/test.tcl
r2055 r2068 80 80 itcl::delete object $_toolobj 81 81 itcl::delete object $_testobj 82 if {$_ran } {82 if {$_ran && $_testobj != $_runobj} { 83 83 itcl::delete object $_runobj 84 84 } … … 193 193 # USAGE: getResult 194 194 # 195 # Returns the result of the test - either Pass, Fail, or Error. Throws196 # an e rrorif the test has not been ran.195 # Returns the result of the test - either Pass, Fail, or Error. Returns 196 # an empty string if the test has not been ran. 197 197 # ---------------------------------------------------------------------- 198 198 itcl::body Rappture::Tester::Test::getResult {} { 199 if {!$_ran} {200 error "Test has not yet been ran."201 }202 199 return $_result 203 200 } … … 294 291 itcl::body Rappture::Tester::Test::run {} { 295 292 # Delete existing library if rerun 296 if {$_ran } {293 if {$_ran && $_result != "Error"} { 297 294 itcl::delete object $_runobj 298 295 } -
trunk/tester/tester.tcl
r2053 r2068 65 65 exit 1 66 66 } 67 } elseif {![file isdirectory $params(-testdir)]} { 68 puts "Test directory \"$params(-testdir)\" does not exist" 67 # If given test directory does not exist, create it. 68 } elseif {![file exists $params(-testdir)]} { 69 file mkdir $params(-testdir) 70 } else { 71 puts "Non-directory file exists at test location \"$params(-testdir)\"" 69 72 exit 1 70 73 } … … 74 77 # ---------------------------------------------------------------------- 75 78 wm title . "Rappture Regression Tester" 79 80 menu .mb 81 menu .mb.file -tearoff 0 82 .mb add cascade -label "File" -underline 0 -menu .mb.file 83 .mb.file add command -label "Select tool" -underline 7 \ 84 -command {set params(-tool) [tk_getOpenFile] 85 .tree configure -toolxml $params(-tool)} 86 .mb.file add command -label "Select test directory" -underline 12 \ 87 -command {set params(-testdir) [tk_chooseDirectory] 88 .tree configure -testdir $params(-testdir)} 89 .mb.file add command -label "Exit" -underline 1 -command {destroy .} 90 . configure -menu .mb 91 76 92 panedwindow .pw 77 93 -
trunk/tester/testtree.tcl
r2055 r2068 46 46 protected method getLeaves {{id 0}} 47 47 protected method getSelected {} 48 protected method populate { }48 protected method populate {args} 49 49 protected method runSelected {} 50 50 protected method runTest {id} … … 116 116 error "no -toolxml configuration option given." 117 117 } 118 118 119 } 119 120 … … 135 136 # ---------------------------------------------------------------------- 136 137 itcl::configbody Rappture::Tester::TestTree::testdir { 137 if {$itk_option(-toolxml) != ""} { 138 populate 138 if {[file isdirectory $itk_option(-testdir)]} { 139 if {$itk_option(-toolxml) != ""} { 140 populate 141 } 142 } else { 143 error "Test directory \"$itk_option(-testdir)\" does not exist" 139 144 } 140 145 } … … 146 151 # tree if -toolxml is changed, but only if -testdir has already been 147 152 # defined. 153 # ---------------------------------------------------------------------- 148 154 itcl::configbody Rappture::Tester::TestTree::toolxml { 149 if {$itk_option(-testdir) != ""} { 150 populate 155 if {[file exists $itk_option(-toolxml)]} { 156 if {$itk_option(-testdir) != ""} { 157 populate 158 } 159 } else { 160 error "Tool \"$itk_option(-testdir)\" does not exist" 151 161 } 152 162 } … … 194 204 # added later for the given tree node id. Mainly needed to update the 195 205 # result from Fail to Pass after regoldenizing a test. If no id is 196 # given, return the test associated with the currently focused node. 206 # given, refresh all tests and search the test directory again to check 207 # for new tests. 197 208 # ---------------------------------------------------------------------- 198 209 itcl::body Rappture::Tester::TestTree::refresh {args} { 199 210 if {[llength $args] == 0} { 200 set id [$itk_component(treeview) index focus] 211 foreach id [getLeaves] { 212 refresh $id 213 } 214 populate -noclear 201 215 } elseif {[llength $args] == 1} { 202 216 set id [lindex $args 0] 217 if {[lsearch -exact [getLeaves] $id] == -1} { 218 error "given id $id is not a leaf node." 219 } 220 set test [getTest $id] 221 setData $id [list result [$test getResult] test $test] 203 222 } else { 204 223 error "wrong # args: should be refresh ?id?" 205 224 } 206 if {[lsearch -exact [getLeaves] $id] == -1} {207 error "given id $id is not a leaf node."208 }209 set test [getTest $id]210 setData $id [list result [$test getResult] test $test]211 225 } 212 226 … … 267 281 268 282 # ---------------------------------------------------------------------- 269 # USAGE: populate 283 # USAGE: populate ?-noclear? 270 284 # 271 285 # Used internally to insert nodes into the treeview for each test xml … … 273 287 # information at path test.label. Relies on the autocreate treeview 274 288 # option so that branch nodes need not be explicitly created. Deletes 275 # any existing contents. 276 # ---------------------------------------------------------------------- 277 itcl::body Rappture::Tester::TestTree::populate {} { 278 foreach id [getLeaves] { 279 itcl::delete object [getTest $id] 280 } 281 $itk_component(treeview) delete 0 289 # any existing contents unless -noclear is given as an argument. 290 # ---------------------------------------------------------------------- 291 itcl::body Rappture::Tester::TestTree::populate {args} { 292 if {[lsearch $args -noclear] == -1} { 293 foreach id [getLeaves] { 294 itcl::delete object [getTest $id] 295 } 296 $itk_component(treeview) delete 0 297 $itk_component(treeview) selection clearall 298 } 282 299 # TODO: add an appropriate icon 283 300 set icon [Rappture::icon molvis-3dorth] … … 286 303 set lib [Rappture::library $testxml] 287 304 set testpath [$lib get test.label] 288 if {$testpath != ""} { 305 if {$testpath != "" && \ 306 [$itk_component(treeview) find -full $testpath] == ""} { 289 307 set test [Rappture::Tester::Test ::#auto \ 290 308 $itk_option(-toolxml) $testxml] … … 296 314 $itk_component(treeview) open -recurse root 297 315 # TODO: Fix width of main treeview column 316 updateLabel 298 317 } 299 318
Note: See TracChangeset
for help on using the changeset viewer.