Changeset 2164 for trunk/gui


Ignore:
Timestamp:
Mar 28, 2011, 9:34:33 PM (13 years ago)
Author:
mmc
Message:

Fixed the way the Tool object resets itself before a run. Each Tool takes
a snapshot of the original XML file, and copies that clean snapshot back
into the working XML whenever the tool is reset. This cleans out any junk
from previous runs. This was an issue in the regression tester, where one
test case might have an extra input and all test cases that ran after that
would keep that extra input junk around. Each test starts cleanly now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/tool.tcl

    r2141 r2164  
    2424    } { # defined below }
    2525
     26    destructor { # defined below }
     27
    2628    public method installdir {} { return $_installdir }
    2729
     
    3335    protected method _output {data}
    3436
     37    private variable _origxml ""     ;# copy of original XML (for reset)
    3538    private variable _installdir ""  ;# installation directory for this tool
    3639    private variable _outputcb ""    ;# callback for tool output
     
    6164        results_directory Rappture::Tool::setResultDir
    6265}
    63                                                                                
     66
    6467# ----------------------------------------------------------------------
    6568# CONSTRUCTOR
     
    7174    set _xmlobj $xmlobj
    7275
     76    # stash a copy of the original XML for later "reset" operations
     77    set _origxml [Rappture::LibraryObj ::#auto "<?xml version=\"1.0\"?><run/>"]
     78    $_origxml copy "" from $_xmlobj ""
     79
    7380    if {![file exists $installdir]} {
    7481        error "directory \"$installdir\" doesn't exist"
     
    7784
    7885    eval configure $args
     86}
     87
     88# ----------------------------------------------------------------------
     89# DESTRUCTOR
     90# ----------------------------------------------------------------------
     91itcl::body Rappture::Tool::destructor {} {
     92    itcl::delete object $_origxml
    7993}
    8094
     
    334348# ----------------------------------------------------------------------
    335349itcl::body Rappture::Tool::reset {} {
     350    $_xmlobj copy "" from $_origxml ""
    336351    foreach path [Rappture::entities -as path $_xmlobj input] {
    337352        if {[$_xmlobj element -as type $path.default] ne ""} {
Note: See TracChangeset for help on using the changeset viewer.