Changeset 2053 for trunk


Ignore:
Timestamp:
Jan 19, 2011, 6:32:48 PM (14 years ago)
Author:
braffert
Message:

Regression tester: adding tabs to view heirarchy of inputs and outputs for each test

Location:
trunk/tester
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/tester/tclIndex

    r2026 r2053  
    77# a script that loads the command.
    88
     9set auto_index(::Rappture::Analyzer) [list source [file join $dir analyzer.tcl]]
     10set auto_index(::Rappture::Analyzer::constructor) [list source [file join $dir analyzer.tcl]]
     11set auto_index(::Rappture::Analyzer::destructor) [list source [file join $dir analyzer.tcl]]
     12set auto_index(::Rappture::Analyzer::simulate) [list source [file join $dir analyzer.tcl]]
     13set auto_index(::Rappture::Analyzer::reset) [list source [file join $dir analyzer.tcl]]
     14set auto_index(::Rappture::Analyzer::load) [list source [file join $dir analyzer.tcl]]
     15set auto_index(::Rappture::Analyzer::clear) [list source [file join $dir analyzer.tcl]]
     16set auto_index(::Rappture::Analyzer::_simState) [list source [file join $dir analyzer.tcl]]
     17set auto_index(::Rappture::Analyzer::_simOutput) [list source [file join $dir analyzer.tcl]]
     18set auto_index(::Rappture::Analyzer::_resultTooltip) [list source [file join $dir analyzer.tcl]]
     19set auto_index(::Rappture::Analyzer::_fixSimControl) [list source [file join $dir analyzer.tcl]]
     20set auto_index(::Rappture::Analyzer::_fixNotebook) [list source [file join $dir analyzer.tcl]]
     21set auto_index(::Rappture::Analyzer::_isPdbTrajectory) [list source [file join $dir analyzer.tcl]]
     22set auto_index(::Rappture::Analyzer::_isLammpsTrajectory) [list source [file join $dir analyzer.tcl]]
     23set auto_index(::Rappture::Analyzer::_pdbToSequence) [list source [file join $dir analyzer.tcl]]
     24set auto_index(::Rappture::Analyzer::_lammpsToSequence) [list source [file join $dir analyzer.tcl]]
     25set auto_index(::Rappture::Analyzer::_trajToSequence) [list source [file join $dir analyzer.tcl]]
     26set auto_index(::Rappture::Analyzer::simcontrol) [list source [file join $dir analyzer.tcl]]
     27set auto_index(::Rappture::Analyzer::notebookpage) [list source [file join $dir analyzer.tcl]]
    928set auto_index(::Rappture::Tester::Test) [list source [file join $dir test.tcl]]
    1029set auto_index(::Rappture::Tester::Test::constructor) [list source [file join $dir test.tcl]]
     30set auto_index(::Rappture::Tester::Test::destructor) [list source [file join $dir test.tcl]]
    1131set auto_index(::Rappture::Tester::Test::getAdded) [list source [file join $dir test.tcl]]
    1232set auto_index(::Rappture::Tester::Test::getDiffs) [list source [file join $dir test.tcl]]
     33set auto_index(::Rappture::Tester::Test::getInputs) [list source [file join $dir test.tcl]]
    1334set auto_index(::Rappture::Tester::Test::getMissing) [list source [file join $dir test.tcl]]
     35set auto_index(::Rappture::Tester::Test::getOutputs) [list source [file join $dir test.tcl]]
    1436set auto_index(::Rappture::Tester::Test::getResult) [list source [file join $dir test.tcl]]
    1537set auto_index(::Rappture::Tester::Test::getRunfile) [list source [file join $dir test.tcl]]
     38set auto_index(::Rappture::Tester::Test::getRunobj) [list source [file join $dir test.tcl]]
    1639set auto_index(::Rappture::Tester::Test::getTestxml) [list source [file join $dir test.tcl]]
     40set auto_index(::Rappture::Tester::Test::getTestobj) [list source [file join $dir test.tcl]]
    1741set auto_index(::Rappture::Tester::Test::hasRan) [list source [file join $dir test.tcl]]
    1842set auto_index(::Rappture::Tester::Test::regoldenize) [list source [file join $dir test.tcl]]
     
    2751set auto_index(::Rappture::ResultsPage::constructor) [list source [file join $dir resultspage.tcl]]
    2852set auto_index(::Rappture::ResultsPage::destructor) [list source [file join $dir resultspage.tcl]]
     53set auto_index(::Rappture::ResultsPage::promptcommand) [list source [file join $dir resultspage.tcl]]
    2954set auto_index(::Rappture::ResultsPage::_fixResult) [list source [file join $dir resultspage.tcl]]
    3055set auto_index(::Rappture::ResultsPage::download) [list source [file join $dir resultspage.tcl]]
     
    3661set auto_index(::Rappture::ResultsPage::_plot) [list source [file join $dir resultspage.tcl]]
    3762set auto_index(::Rappture::ResultsPage::_reorder) [list source [file join $dir resultspage.tcl]]
     63set auto_index(::Rappture::ResultsPage::resultset) [list source [file join $dir resultspage.tcl]]
    3864set auto_index(::Rappture::Tester::selectionHandler) [list source [file join $dir tester.tcl]]
    3965set auto_index(::Rappture::Tester::regoldenize) [list source [file join $dir tester.tcl]]
     
    5581set auto_index(::Rappture::Tester::TestView) [list source [file join $dir testview.tcl]]
    5682set auto_index(::Rappture::Tester::TestView::constructor) [list source [file join $dir testview.tcl]]
    57 set auto_index(::Rappture::Tester::TestView::toolxml) [list source [file join $dir testview.tcl]]
    5883set auto_index(::Rappture::Tester::TestView::test) [list source [file join $dir testview.tcl]]
    5984set auto_index(::Rappture::Tester::TestView::reset) [list source [file join $dir testview.tcl]]
    6085set auto_index(::Rappture::Tester::TestView::showDescription) [list source [file join $dir testview.tcl]]
    6186set auto_index(::Rappture::Tester::TestView::showStatus) [list source [file join $dir testview.tcl]]
    62 set auto_index(::Rappture::Tester::TestView::updateAnalyzer) [list source [file join $dir testview.tcl]]
    63 set auto_index(::Rappture::Tester::TestView::updateInfo) [list source [file join $dir testview.tcl]]
     87set auto_index(::Rappture::Tester::TestView::updateResults) [list source [file join $dir testview.tcl]]
     88set auto_index(::Rappture::Tester::TestView::updateInputs) [list source [file join $dir testview.tcl]]
     89set auto_index(::Rappture::Tester::TestView::updateOutputs) [list source [file join $dir testview.tcl]]
  • trunk/tester/test.tcl

    r2034 r2053  
    3535    public method getAdded {}
    3636    public method getDiffs {}
     37    public method getInputs {{path input}}
    3738    public method getMissing {}
     39    public method getOutputs {{path output}}
    3840    public method getResult {}
    3941    public method getRunfile {}
     
    6971    }
    7072    # HACK: Add a new input to differentiate between results
    71     $_testobj put input.run.current "Golden"
     73    $_testobj put input.TestRun.current "Golden"
    7274}
    7375
     
    110112}
    111113
     114# -----------------------------------------------------------------------
     115# USAGE: getInputs
     116#
     117# TODO
     118# -----------------------------------------------------------------------
     119itcl::body Rappture::Tester::Test::getInputs {{path input}} {
     120    set retval [list]
     121    foreach child [$_testobj children $path] {
     122        set fullpath $path.$child
     123        if {$fullpath != "input.TestRun"} {
     124            set val [$_testobj get $fullpath.current]
     125            if {$val != ""} {
     126                lappend retval $fullpath $val
     127            }
     128        }
     129        append retval [getInputs $fullpath]
     130    }
     131    return $retval
     132}
     133
    112134# ----------------------------------------------------------------------
    113135# USAGE: getMissing
     
    122144    }
    123145    return $_missing
     146}
     147
     148# ----------------------------------------------------------------------
     149# USAGE: getOutputs
     150#
     151# TODO
     152# ----------------------------------------------------------------------
     153itcl::body Rappture::Tester::Test::getOutputs {{path output}} {
     154    if {!$_ran} {
     155        error "Test has not yet been ran."
     156    }
     157    set retval [list]
     158    foreach child [$_runobj children $path] {
     159        set fullpath $path.$child
     160        if {$fullpath != "output.time" && $fullpath != "output.user" && $fullpath != "output.status"} {
     161            if {[lsearch $fullpath [getDiffs]] != -1} {
     162                set status diff
     163            } elseif {[lsearch $fullpath [getAdded]] != -1} {
     164                set status added
     165            #} elseif {[lsearch $fullpath [getMissing]] != -1} {
     166            #    set status missing
     167            } else {
     168                if {[$_runobj get $fullpath] != ""} {
     169                    set status ok
     170                } else {
     171                    set status ""
     172                }
     173            }
     174            lappend retval $fullpath $status
     175        }
     176        append retval " [getOutputs $fullpath]"
     177    }
     178    # We won't find missing elements by searching through runobj.  Instead,
     179    # tack on all missing items at the end (only do this once)
     180    if {$path == "output"} {
     181        foreach item $_missing {
     182            lappend retval $item missing
     183        }
     184    }
     185    return $retval
    124186}
    125187
     
    237299    if {$status == 0 && [Rappture::library isvalid $_runobj]} {
    238300        # HACK: Add a new input to differentiate between results
    239         $_runobj put input.run.current "Test result"
     301        $_runobj put input.TestRun.current "Test result"
    240302        set _diffs [diffs $_testobj $_runobj]
    241303        set _missing [missing $_testobj $_runobj]
     
    248310        }
    249311    } else {
     312        set _runobj ""
    250313        set _result Error
    251314    }
  • trunk/tester/tester.tcl

    r2050 r2053  
    112112    global lastsel
    113113    set test [.tree getTest]
    114     if {$test != "" || [lsearch $args "-refresh"] != -1} {
     114    if {$test != $lastsel || [lsearch $args "-refresh"] != -1} {
    115115        .right.view configure -test $test
    116116        if {$test != "" && [$test hasRan] && [$test getResult] != "Error"} {
  • trunk/tester/testtree.tcl

    r2050 r2053  
    6767    itk_component add treeview {
    6868        blt::treeview $itk_component(scrollbars).treeview -separator | \
    69             -autocreate true -selectmode single
     69            -autocreate true -selectmode multiple
    7070    } {
    7171        keep -foreground -font -cursor
     
    287287        runTest $id
    288288    }
    289     eval $itk_option(-selectcommand) -refresh
     289    # Try calling selectcommand with the -refresh option.  If selectcommand
     290    # does not accept this argument, then call it with no arguments.
     291    if {[catch {eval $itk_option(-selectcommand) -refresh}]} {
     292        eval $itk_option(-selectcommand)
     293    }
    290294}
    291295
  • trunk/tester/testview.tcl

    r2050 r2053  
    3838    protected method showStatus {text}
    3939    protected method updateResults {args}
    40     protected method updateInfo {args}
    4140    protected method updateInputs {args}
    42     private variable _lastTest ""
     41    protected method updateOutputs {args}
     42
    4343}
    4444
     
    5353    pack $itk_component(status) -expand no -fill none -side top -anchor w
    5454
    55     itk_component add scroller {
    56         Rappture::Scroller $itk_interior.scroller \
     55    itk_component add descScroller {
     56        Rappture::Scroller $itk_interior.descScroller \
    5757            -xscrollmode auto -yscrollmode auto
    5858    }
    5959
    6060    itk_component add description {
    61         text $itk_interior.scroller.description -height 0 -wrap word \
     61        text $itk_interior.descScroller.description -height 0 -wrap word \
    6262            -relief flat
    6363    }
    64     $itk_component(scroller) contents $itk_component(description)
    65     pack $itk_component(scroller) -expand no -fill x -side top
     64    $itk_component(descScroller) contents $itk_component(description)
     65    pack $itk_component(descScroller) -expand no -fill x -side top
    6666
    6767    itk_component add tabs {
     
    7272    }
    7373    $itk_component(tabs) insert end "Results" -ipady 25 -fill both
    74     $itk_component(tabs) insert end "Info" -ipady 25 -fill both -state disabled
    7574    $itk_component(tabs) insert end "Inputs" -ipady 25 -fill both \
    7675        -state disabled
     76    $itk_component(tabs) insert end "Outputs" -ipady 25 -fill both \
     77        -state disabled
    7778
    7879    itk_component add results {
     
    8283        -window $itk_component(tabs).results
    8384
    84     itk_component add info {
    85         text $itk_component(tabs).info
    86     }
    87     $itk_component(tabs) tab configure "Info" -window $itk_component(info)
    88     pack $itk_component(tabs) -expand yes -fill both -side top
     85    itk_component add inputScroller {
     86        Rappture::Scroller $itk_component(tabs).inputScroller \
     87            -xscrollmode auto -yscrollmode auto
     88    }
    8989
    9090    itk_component add inputs {
    91         blt::treeview $itk_component(tabs).inputs -separator . -autocreate true
     91        blt::treeview $itk_component(inputScroller).inputs -separator . \
     92            -autocreate true
    9293    } {
    9394        keep -foreground -font -cursor
    9495    }
    95     $itk_component(tabs) tab configure "Inputs" -window $itk_component(inputs)
     96    $itk_component(inputs) column insert end "Value"
     97    $itk_component(inputScroller) contents $itk_component(inputs)
     98    $itk_component(tabs) tab configure "Inputs" \
     99        -window $itk_component(inputScroller)
     100
     101    itk_component add outputScroller {
     102        Rappture::Scroller $itk_component(tabs).outputScroller \
     103            -xscrollmode auto -yscrollmode auto
     104    }
     105
     106    itk_component add outputs {
     107        blt::treeview $itk_component(outputScroller).outputs -separator . \
     108            -autocreate true
     109    } {
     110        keep -foreground -font -cursor
     111    }
     112    $itk_component(outputs) column insert end "Status"
     113    $itk_component(outputScroller) contents $itk_component(outputs)
     114    $itk_component(tabs) tab configure "Outputs" \
     115        -window $itk_component(outputScroller)
     116
     117    pack $itk_component(tabs) -expand yes -fill both -side top
    96118
    97119    eval itk_initialize $args
     
    106128itcl::configbody Rappture::Tester::TestView::test {
    107129    set test $itk_option(-test)
    108     if { $test == $_lastTest } {
    109         return
    110     }
    111130    # Data array is empty for branch nodes.
    112131    if {$test != ""} {
     
    124143        }
    125144        updateResults
    126         updateInfo
    127145        updateInputs
     146        updateOutputs
    128147        set descr [[$test getTestobj] get test.description]
    129148        if {$descr == ""} {
     
    131150        }
    132151        showDescription $descr
    133         set _lastTest $test
    134152    } else {
    135153       # Clear everything if branch node selected
    136         set _lastTest ""
    137154       reset
    138155    }
     
    150167itcl::body Rappture::Tester::TestView::reset {} {
    151168    updateResults
    152     updateInfo
    153169    updateInputs
     170    updateOutputs
    154171    showStatus ""
    155172    showDescription ""
     
    196213        set test $itk_option(-test)
    197214        $itk_component(results) load [$test getTestobj]
    198         if {[$test hasRan]} {
     215        if {[$test hasRan]  && [Rappture::library isvalid [$test getRunobj]]} {
    199216            $itk_component(results) load [$test getRunobj]
    200217        }
     
    202219}
    203220
    204 # ----------------------------------------------------------------------
    205 # USAGE: updateInfo
    206 # ----------------------------------------------------------------------
    207 itcl::body Rappture::Tester::TestView::updateInfo {} {
    208     set test $itk_option(-test)
    209     if {$test == "" || ![$test hasRan]} {
    210         $itk_component(info) delete 0.0 end
    211         set index [$itk_component(tabs) index -name "Results"]
    212         $itk_component(tabs) select $index
    213         $itk_component(tabs) focus $index
    214         $itk_component(tabs) tab configure "Info" -state disabled
    215     } else {
    216         set test $itk_option(-test)
    217         set testxml [$test getTestxml]
    218         set runfile [$test getRunfile]
    219         $itk_component(tabs) tab configure "Info" -state normal
    220         $itk_component(info) delete 0.0 end
    221         $itk_component(info) insert end "Test xml: $testxml\n"
    222         $itk_component(info) insert end "Runfile: $runfile\n"
    223         if {[$test getResult] == "Fail"} {
    224             set diffs [$test getDiffs]
    225             set missing [$test getMissing]
    226             set added [$test getAdded]
    227             $itk_component(info) insert end "Diffs: $diffs\n"
    228             $itk_component(info) insert end "Missing: $missing\n"
    229             $itk_component(info) insert end "Added: $added\n"
    230         }
    231     }
    232 }
    233 
    234 itcl::body Rappture::Tester::TestView::updateInputs {} {
    235     set test $itk_option(-test)
    236     if {$test == ""} {
    237         set index [$itk_component(tabs) index -name "Results"]
    238         $itk_component(tabs) select $index
    239         $itk_component(tabs) focus $index
    240         $itk_component(tabs) tab configure "Inputs" -state disabled
    241     } else {
    242         set test $itk_option(-test)
     221itcl::body Rappture::Tester::TestView::updateInputs {args} {
     222    $itk_component(inputs) delete 0
     223    set test $itk_option(-test)
     224    if {$test != ""} {
    243225        $itk_component(tabs) tab configure "Inputs" -state normal
    244     }
    245 }
    246 
     226        foreach {path val} [$test getInputs] {
     227            $itk_component(inputs) insert end $path -data [list Value $val]
     228        }
     229        $itk_component(inputs) open -recurse root
     230    }
     231}
     232
     233itcl::body Rappture::Tester::TestView::updateOutputs {args} {
     234    $itk_component(outputs) delete 0
     235    set test $itk_option(-test)
     236    if {$test != "" && [$test hasRan] && [$test getResult] != "Error"} {
     237        $itk_component(tabs) tab configure "Outputs" -state normal
     238        foreach {path status} [$test getOutputs] {
     239            $itk_component(outputs) insert end $path -data [list Status $status]
     240        }
     241        $itk_component(outputs) open -recurse root
     242    } else {
     243        $itk_component(tabs) tab configure "Outputs" -state disabled
     244        # Switch back to results tab if the outputs tab is open and the
     245        # selected test has not been ran.
     246        if {[$itk_component(tabs) index select] == \
     247            [$itk_component(tabs) index -name "Outputs"]} {
     248            set index [$itk_component(tabs) index -name "Results"]
     249            $itk_component(tabs) select $index
     250            $itk_component(tabs) focus $index
     251        }
     252    }
     253}
     254       
     255       
     256
Note: See TracChangeset for help on using the changeset viewer.