Changeset 2068 for trunk


Ignore:
Timestamp:
Jan 26, 2011, 5:58:26 PM (14 years ago)
Author:
braffert
Message:

Small fixes for regression tester

Location:
trunk/tester
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/tester/tclIndex

    r2053 r2068  
    6262set auto_index(::Rappture::ResultsPage::_reorder) [list source [file join $dir resultspage.tcl]]
    6363set auto_index(::Rappture::ResultsPage::resultset) [list source [file join $dir resultspage.tcl]]
     64set auto_index(::Rappture::Tester::TestBuilder) [list source [file join $dir testbuilder.tcl]]
     65set auto_index(::Rappture::Tester::TestBuilder::tool) [list source [file join $dir testbuilder.tcl]]
     66set auto_index(::Rappture::Tester::TestBuilder::constructor) [list source [file join $dir testbuilder.tcl]]
    6467set auto_index(::Rappture::Tester::selectionHandler) [list source [file join $dir tester.tcl]]
    6568set auto_index(::Rappture::Tester::regoldenize) [list source [file join $dir tester.tcl]]
     69set auto_index(::Rappture::Tester::makeTest) [list source [file join $dir tester.tcl]]
    6670set auto_index(::Rappture::Tester::TestTree) [list source [file join $dir testtree.tcl]]
    6771set auto_index(::Rappture::Tester::TestTree::constructor) [list source [file join $dir testtree.tcl]]
     72set auto_index(::Rappture::Tester::TestTree::destructor) [list source [file join $dir testtree.tcl]]
    6873set auto_index(::Rappture::Tester::TestTree::testdir) [list source [file join $dir testtree.tcl]]
    6974set auto_index(::Rappture::Tester::TestTree::toolxml) [list source [file join $dir testtree.tcl]]
  • trunk/tester/test.tcl

    r2055 r2068  
    8080    itcl::delete object $_toolobj
    8181    itcl::delete object $_testobj
    82     if {$_ran} {
     82    if {$_ran && $_testobj != $_runobj} {
    8383        itcl::delete object $_runobj
    8484    }
     
    193193# USAGE: getResult
    194194#
    195 # Returns the result of the test - either Pass, Fail, or Error.  Throws
    196 # an error if 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.
    197197# ----------------------------------------------------------------------
    198198itcl::body Rappture::Tester::Test::getResult {} {
    199     if {!$_ran} {
    200         error "Test has not yet been ran."
    201     }
    202199    return $_result
    203200}
     
    294291itcl::body Rappture::Tester::Test::run {} {
    295292    # Delete existing library if rerun
    296     if {$_ran} {
     293    if {$_ran && $_result != "Error"} {
    297294        itcl::delete object $_runobj
    298295    }
  • trunk/tester/tester.tcl

    r2053 r2068  
    6565        exit 1
    6666    }
    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)\""
    6972    exit 1
    7073}
     
    7477# ----------------------------------------------------------------------
    7578wm title . "Rappture Regression Tester"
     79
     80menu .mb
     81menu .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
    7692panedwindow .pw
    7793
  • trunk/tester/testtree.tcl

    r2055 r2068  
    4646    protected method getLeaves {{id 0}}
    4747    protected method getSelected {}
    48     protected method populate {}
     48    protected method populate {args}
    4949    protected method runSelected {}
    5050    protected method runTest {id}
     
    116116        error "no -toolxml configuration option given."
    117117    }
     118
    118119}
    119120
     
    135136# ----------------------------------------------------------------------
    136137itcl::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"
    139144    }
    140145}
     
    146151# tree if -toolxml is changed, but only if -testdir has already been
    147152# defined.
     153# ----------------------------------------------------------------------
    148154itcl::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"
    151161    }
    152162}
     
    194204# added later for the given tree node id.  Mainly needed to update the
    195205# 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.
    197208# ----------------------------------------------------------------------
    198209itcl::body Rappture::Tester::TestTree::refresh {args} {
    199210    if {[llength $args] == 0} {
    200          set id [$itk_component(treeview) index focus]
     211        foreach id [getLeaves] {
     212            refresh $id
     213        }
     214        populate -noclear
    201215    } elseif {[llength $args] == 1} {
    202216        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]
    203222    } else {
    204223        error "wrong # args: should be refresh ?id?"
    205224    }
    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]
    211225}
    212226
     
    267281
    268282# ----------------------------------------------------------------------
    269 # USAGE: populate
     283# USAGE: populate ?-noclear?
    270284#
    271285# Used internally to insert nodes into the treeview for each test xml
     
    273287# information at path test.label.  Relies on the autocreate treeview
    274288# 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# ----------------------------------------------------------------------
     291itcl::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    }
    282299    # TODO: add an appropriate icon
    283300    set icon [Rappture::icon molvis-3dorth]
     
    286303        set lib [Rappture::library $testxml]
    287304        set testpath [$lib get test.label]
    288         if {$testpath != ""} {
     305        if {$testpath != "" && \
     306            [$itk_component(treeview) find -full $testpath] == ""} {
    289307            set test [Rappture::Tester::Test ::#auto \
    290308                $itk_option(-toolxml) $testxml]
     
    296314    $itk_component(treeview) open -recurse root
    297315    # TODO: Fix width of main treeview column
     316    updateLabel
    298317}
    299318
Note: See TracChangeset for help on using the changeset viewer.