Changeset 1964 for trunk/tester
- Timestamp:
- Nov 25, 2010, 5:54:57 PM (14 years ago)
- Location:
- trunk/tester
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tester/mainwin.tcl
r1963 r1964 3 3 # 4 4 # This widget acts as the main window for the Rappture regression 5 # tester. Constructor accepts the location of the new version to be 6 # tested, and the location of a directory containg test xml files. 5 # tester. Constructor accepts the location of the tool.xml of the new 6 # version to be tested, and the location of a directory containg test 7 # xml files. 7 8 # ====================================================================== 8 9 # AUTHOR: Ben Rafferty, Purdue University … … 21 22 inherit itk::Toplevel 22 23 23 constructor {tool dir testdir} { #defined later }24 constructor {toolxml testdir args} { #defined later } 24 25 public method runAll {} 25 26 public method runSelected {} … … 28 29 29 30 private variable _testdir 30 private variable _tooldir31 31 private variable _toolxml 32 32 … … 42 42 } 43 43 44 itcl::body Rappture::Regression::MainWin::constructor {tool dir testdir} {44 itcl::body Rappture::Regression::MainWin::constructor {toolxml testdir args} { 45 45 puts "Constructing MainWin." 46 46 47 # TODO: Replace explicit constructor arguments with "args" 48 # If tooldir is not given, use current directory. 49 # If testdir is not given, look for it inside of tooldir. 50 if {[file isdirectory $tooldir]} { 51 set _tooldir $tooldir 47 if {[file exists $toolxml]} { 48 set _toolxml $toolxml 52 49 } else { 53 # TODO: Properly format error messages 54 error "Given tooldir is not a directory." 50 error "File \"$toolxml\" does not exist." 55 51 } 52 56 53 if {[file isdirectory $testdir]} { 57 54 set _testdir $testdir 58 55 } else { 59 error " Given testdir is not a directory"56 error "Directory \"$testdir\" does not exist." 60 57 } 61 58 62 # TODO: Check other locations for tool.xml and throw error if not found 63 set _toolxml [file join $tooldir tool.xml] 59 itk_component add pw { 60 panedwindow $itk_interior.pw 61 } 62 pack $itk_component(pw) -expand yes -fill both 64 63 65 itk_component add topBar { 66 frame $itk_interior.topBar 64 itk_component add tree { 65 Rappture::Regression::TestTree $itk_component(pw).tree \ 66 -command "$this runSelected" -testdir $_testdir 67 67 } 68 itk_component add cmdLabel { 69 label $itk_component(topBar).cmdLabel -text "Tool command:" 68 $itk_component(pw) add $itk_component(tree) -sticky nsew 69 70 itk_component add view { 71 Rappture::Regression::TestView $itk_component(pw).view 70 72 } 71 itk_component add cmdEntry { 72 entry $itk_component(topBar).cmdEntry 73 } 74 itk_component add bRunAll { 75 button $itk_component(topBar).bRunAll -text "Run all" \ 76 -command [itcl::code $itk_interior runAll] 77 } 78 itk_component add bRunSelected { 79 button $itk_component(topBar).bRunSelected -text "Run selected" \ 80 -command [itcl::code $itk_interior runSelected] 81 } 82 pack $itk_component(cmdLabel) -side left 83 pack $itk_component(cmdEntry) -side left -expand yes -fill x 84 pack $itk_component(bRunAll) -side right 85 pack $itk_component(bRunSelected) -side right 86 pack $itk_component(topBar) -side top -fill x 73 $itk_component(pw) add $itk_component(view) -sticky nsew 87 74 88 itk_component add pane {89 panedwindow $itk_interior.pane90 }91 itk_component add tree {92 Rappture::Regression::TestTree $itk_component(pane).tree $testdir93 }94 itk_component add view {95 Rappture::Regression::TestView $itk_component(pane).view96 }97 $itk_component(pane) add $itk_component(pane).tree -sticky nesw98 $itk_component(pane) add $itk_component(pane).view -sticky nesw99 75 # TODO: make panes scale proportionally when window grows 100 pack $itk_component(pane) -side left -expand yes -fill both 76 77 eval itk_initialize $args 101 78 } 102 79 … … 151 128 set driver [makeDriver $testxml] 152 129 153 set tool [Rappture::Tool ::#auto $driver $_tooldir]130 set tool [Rappture::Tool ::#auto $driver [file dirname $_toolxml]] 154 131 set result "" 155 132 foreach {status result} [eval $tool run] break -
trunk/tester/tester.tcl
r1963 r1964 10 10 # hierarchically by using dots to separate components of the test label 11 11 # (example: roomtemp.1eV). A description may optionally be located at 12 # the path test.description. 12 # the path test.description. Input arguments are the path to the 13 # tool.xml of the version being tested, and the path the the directory 14 # containing a set of test xml files. If the arguments are missing, 15 # the program will attempt to locate them automatically. 16 # 17 # USAGE: tester.tcl ?-tool tool.xml? ?-testdir tests? 13 18 # ====================================================================== 14 19 # AUTHOR: Ben Rafferty, Purdue University … … 23 28 # wish executes everything from here on... 24 29 25 # TODO: Use tclIndex to manage classes correctly 26 source mainwin.tcl 27 source testtree.tcl 28 source testview.tcl 29 source compare.tcl 30 # TODO: Won't need this once tied in with the rest of the package 31 lappend auto_path [file dirname $argv0] 32 33 package require Tk 34 package require Rappture 35 package require RapptureGUI 30 36 31 37 wm withdraw . 32 38 33 set testdir "example/tests" 34 set tooldir "example" 39 Rappture::getopts argv params { 40 value -tool "" 41 value -testdir "" 42 } 35 43 36 ::Rappture::Regression::MainWin .main $tooldir $testdir 44 # If tool.xml and test directory locations are not given, try to find them. 45 if {$params(-tool) == ""} { 46 if {[file exists tool.xml]} { 47 set params(-tool) tool.xml 48 } elseif {[file exists [file join rappture tool.xml]]} { 49 set params(-tool) [file join rappture tool.xml] 50 } else { 51 error "Cannot find tool.xml" 52 } 53 } 54 55 if {$params(-testdir) == ""} { 56 set tooldir [file dirname $params(-tool)] 57 if {[file isdirectory [file join $tooldir tests]]} { 58 set params(-testdir) [file join $tooldir tests] 59 } elseif {[file isdirectory [file join [file dirname $tooldir] tests]]} { 60 set params(-testdir) [file join [file dirname $tooldir] tests] 61 } else { 62 error "Cannot find test directory." 63 } 64 } 65 66 ::Rappture::Regression::MainWin .main $params(-tool) $params(-testdir) 37 67 bind .main <Destroy> {exit} 38 68 -
trunk/tester/testtree.tcl
r1963 r1964 3 3 # 4 4 # Used to display a collapsible view of all tests found in the test 5 # directory. Essentially an Itk Widget wrapper for blt::treeview.6 # Provides methods to get all tests or all currently selected tests.7 # Also helps handle data stored in treeview columns. In each test xml,8 # a label must be located at the path test.label. Test labels may be9 # be organized hierarchically by using dots to separate components of10 # the test label. (example: roomtemp.1eV)5 # directory. The -command configuration option will be called when 6 # the run button is clicked. Provides methods to get all tests or all 7 # currently selected tests. Also helps handle data stored in treeview 8 # columns. In each test xml, a label must be located at the path 9 # test.label. Test labels may be organized hierarchically by using 10 # dots to separate components of the test label. 11 11 # ====================================================================== 12 12 # AUTHOR: Ben Rafferty, Purdue University … … 23 23 24 24 itcl::class Rappture::Regression::TestTree { 25 inherit itk::Widget 26 27 constructor {testdir} { #defined later } 28 public method populate {testdir} 25 inherit itk::Widget 26 27 public variable command 28 public variable testdir 29 30 constructor {testdir args} { #defined later } 29 31 public method getTests {{id 0}} 30 32 public method getSelected {} 31 33 public method getData {id} 32 34 public method setData {id data} 35 public method updateLabel {} 36 37 private method populate {} 33 38 } 34 39 … … 41 46 } 42 47 43 itcl::body Rappture::Regression::TestTree::constructor { testdir} {48 itcl::body Rappture::Regression::TestTree::constructor {args} { 44 49 # TODO: Use separate tree data structure and insert into treeview 45 puts "Constructing TestTree." 50 puts "Constructinig TestTree." 51 46 52 itk_component add treeview { 47 53 blt::treeview $itk_interior.treeview -separator . -autocreate true \ 48 -selectmode multiple 49 } 50 $itk_component(treeview) column insert end xmlfile ran result diffs 54 -selectmode multiple 55 } 56 $itk_component(treeview) column insert 0 result 57 $itk_component(treeview) column insert end xmlfile ran diffs 51 58 $itk_component(treeview) column configure xmlfile ran diffs -hide yes 52 59 pack $itk_component(treeview) -expand yes -fill both 53 populate $testdir 54 # TODO: Fix default column spacing. Column name for the main/first column? 60 61 itk_component add bottomBar { 62 frame $itk_interior.bottomBar 63 } 64 pack $itk_component(bottomBar) -fill x 65 66 itk_component add bSelectAll { 67 button $itk_component(bottomBar).bSelectAll -text "Select all" \ 68 -command "$itk_component(treeview) selection set 0 end" 69 } 70 pack $itk_component(bSelectAll) -side left 71 72 itk_component add bSelectNone { 73 button $itk_component(bottomBar).bSelectNone -text "Select none" \ 74 -command "$itk_component(treeview) selection clearall" 75 } 76 pack $itk_component(bSelectNone) -side left 77 78 itk_component add lSelected { 79 label $itk_component(bottomBar).lSelected -text "0 tests selected" 80 } 81 pack $itk_component(lSelected) -side left -expand yes -fill x 82 $itk_component(treeview) configure -selectcommand "$this updateLabel" 83 84 itk_component add bRun { 85 button $itk_component(bottomBar).bRun -text "Run" -command runHandler \ 86 -state disabled 87 } 88 pack $itk_component(bRun) -side left 89 55 90 # TODO: Fix black empty space when columns are shrunk 56 } 57 91 # TODO: Scrollbar(s) 92 93 eval itk_initialize $args 94 } 95 96 # Repopulate tree if test directory changed 97 itcl::configbody Rappture::Regression::TestTree::testdir { 98 populate 99 } 100 101 itcl::configbody Rappture::Regression::TestTree::command { 102 $itk_component(bRun) configure -command $command 103 } 58 104 59 105 # ---------------------------------------------------------------------- … … 66 112 # any nodes previously contained by the treeview. 67 113 # ---------------------------------------------------------------------- 68 itcl::body Rappture::Regression::TestTree::populate { testdir} {114 itcl::body Rappture::Regression::TestTree::populate {} { 69 115 puts "Populating TestTree." 70 116 $itk_component(treeview) delete 0 71 # TODO: Make file icon background transparent.72 set icon [ image create photo -file images/file.gif]117 # TODO: add an appropriate icon 118 set icon [Rappture::icon download] 73 119 # TODO: Descend through subdirectories inside testdir? 74 120 foreach testxml [glob -nocomplain -directory $testdir *.xml] { … … 150 196 } 151 197 152 198 # ---------------------------------------------------------------------- 199 # USAGE: updateLabel 200 # 201 # Used internally to update the label which indicates how many tests 202 # are currently selected. Also disables the run button if no tests are 203 # selected. 204 # ---------------------------------------------------------------------- 205 itcl::body Rappture::Regression::TestTree::updateLabel {} { 206 set n [llength [getSelected]] 207 $itk_component(lSelected) configure -text "$n tests selcted" 208 if {$n > 0} { 209 $itk_component(bRun) configure -state normal 210 } else { 211 $itk_component(bRun) configure -state disabled 212 } 213 } 214 -
trunk/tester/testview.tcl
r1963 r1964 17 17 inherit itk::Widget 18 18 19 constructor { } { #defined later }19 constructor {args} { #defined later } 20 20 } 21 21 22 itcl::body Rappture::Regression::TestView::constructor { } {22 itcl::body Rappture::Regression::TestView::constructor {args} { 23 23 puts "Constructing TestView." 24 24 itk_component add txt { … … 28 28 $itk_component(txt) insert end "TestView text area..." 29 29 $itk_component(txt) configure -state disabled 30 31 eval itk_initialize $args 30 32 } 31 33
Note: See TracChangeset
for help on using the changeset viewer.