Overview
Comment: | Added ability to collapse itemized tests |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | debug-printing |
Files: | files | file ages | folders |
SHA1: |
501196c2365865fd749ced47e6b7923a |
User & Date: | mrwellan on 2011-06-30 16:10:35 |
Other Links: | branch diff | manifest | tags |
Context
2011-06-30
| ||
22:27 | Cleaned up label and test button filling code, collapsing works better now check-in: 084d0426f2 user: mrwellan tags: debug-printing | |
16:10 | Added ability to collapse itemized tests check-in: 501196c236 user: mrwellan tags: debug-printing | |
2011-06-29
| ||
20:56 | Cleaned up remove runs check-in: 1b6a0ceec8 user: mrwellan tags: debug-printing | |
Changes
Modified dashboard.scm from [30a26490d6] to [78325e2e00].
︙ | ︙ | |||
93 94 95 96 97 98 99 100 101 102 103 104 105 106 | (define *verbosity* (cond ((args:get-arg "-debug")(string->number (args:get-arg "-debug"))) ((args:get-arg "-v") 2) ((args:get-arg "-q") 0) (else 1))) (define (message-window msg) (iup:show (iup:dialog (iup:vbox (iup:label msg #:margin "40x40"))))) (define (iuplistbox-fill-list lb items . default) | > > > | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | (define *verbosity* (cond ((args:get-arg "-debug")(string->number (args:get-arg "-debug"))) ((args:get-arg "-v") 2) ((args:get-arg "-q") 0) (else 1))) (define uidat #f) ;; (megatest-dashboard) (define (message-window msg) (iup:show (iup:dialog (iup:vbox (iup:label msg #:margin "40x40"))))) (define (iuplistbox-fill-list lb items . default) |
︙ | ︙ | |||
139 140 141 142 143 144 145 | (set! result (cons (vector run tests key-vals) result)))) runs) (set! *header* header) (set! *allruns* result) maxtests)) (define *collapsed* (make-hash-table)) | > > | > > > > > | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | (set! result (cons (vector run tests key-vals) result)))) runs) (set! *header* header) (set! *allruns* result) maxtests)) (define *collapsed* (make-hash-table)) ; (define *row-lookup* (make-hash-table)) ;; testname => (rownum lableobj) (define (toggle-hide lnum) ; fulltestname) (let* ((btn (vector-ref (vector-ref uidat 0) lnum)) (fulltestname (iup:attribute btn "TITLE")) (parts (string-split fulltestname "/")) (basetestname (if (null? parts) "" (car parts)))) ;(print "Toggling " basetestname " currently " (hash-table-ref/default *collapsed* basetestname #f)) (if (hash-table-ref/default *collapsed* basetestname #f) (hash-table-delete! *collapsed* basetestname) (hash-table-set! *collapsed* basetestname #t)))) (define blank-line-rx (regexp "^\\s*$")) (define (collapse-rows inlst) (let ((newlst (filter (lambda (x) (let* ((tparts (string-split x "(")) (basetname (if (null? tparts) x (car tparts)))) ;(print "x " x " tparts: " tparts " basetname: " basetname) (cond ((string-match blank-line-rx x) #f) ((equal? x basetname) #t) ((hash-table-ref/default *collapsed* basetname #f) ;(print "Removing " basetname " from items") #f) (else #t)))) inlst))) ;; special sort to push the test(item) to after test (sort newlst (lambda (a b) (let* ((partsa (string-split a "(")) (partsb (string-split b "(")) (lena (length partsa)) (lenb (length partsb))) (if (or (and (eq? lena 1)(> lenb 1)) (and (eq? lenb 1)(> lena 1))) (if (equal? (car partsa)(car partsb)) ;; same test (> lenb lena) #t) #t)))))) (define (update-labels uidat) (let* ((rown 0) (lftcol (vector-ref uidat 0)) (numcols (vector-length lftcol)) (maxn (- numcols 1)) (allvals (make-vector numcols ""))) (for-each (lambda (name) (if (<= rown maxn) (let ((labl (vector-ref lftcol rown))) (vector-set! allvals rown name))) (set! rown (+ 1 rown))) (if (> (length *alltestnamelst*) *start-test-offset*) (drop *alltestnamelst* *start-test-offset*) '())) (let loop ((i 0)) (let* ((lbl (vector-ref lftcol i)) (oldval (iup:attribute lbl "TITLE")) (newval (vector-ref allvals i))) (set! *alltestnames* (make-hash-table)) (if (not (equal? oldval newval)) (begin (hash-table-set! *alltestnames* newval (list i lbl)) (iup:attribute-set! lbl "TITLE" newval))) (if (< i maxn) (loop (+ i 1))))))) (define (get-color-for-state-status state status) (case (string->symbol state) ((COMPLETED) (if (equal? status "PASS") |
︙ | ︙ | |||
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | ((NOT_STARTED) "240 240 240") (else "192 192 192"))) (define (update-buttons uidat numruns numtests) (let* ((runs (if (> (length *allruns*) numruns) (take-right *allruns* numruns) (pad-list *allruns* numruns))) (lftcol (vector-ref uidat 0)) (tableheader (vector-ref uidat 1)) (table (vector-ref uidat 2)) (coln 0)) (update-labels uidat) (set! *alltestnamelst* '()) (for-each (lambda (rundat) (if (not rundat) ;; handle padded runs ;; ;; id run-id testname state status event-time host cpuload diskfree uname rundir item-path run-duration (set! rundat (vector (make-vector 20 #f) '() (map (lambda (x) "") *keys*))));; 3))) (let* ((run (vector-ref rundat 0)) (testsdat (vector-ref rundat 1)) (key-val-dat (vector-ref rundat 2)) (run-id (db:get-value-by-header run *header* "id")) | > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < | < | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | ((NOT_STARTED) "240 240 240") (else "192 192 192"))) (define (update-buttons uidat numruns numtests) (let* ((runs (if (> (length *allruns*) numruns) (take-right *allruns* numruns) (pad-list *allruns* numruns))) (testnames '()) (lftcol (vector-ref uidat 0)) (tableheader (vector-ref uidat 1)) (table (vector-ref uidat 2)) (coln 0)) (update-labels uidat) (set! *alltestnamelst* '()) (set! *alltestnames* (make-hash-table)) ;; create a concise list of test names (for-each (lambda (rundat) (if (vector? rundat) (let* ((testdat (vector-ref rundat 1)) (testnames (map test:test-get-fullname testdat))) (for-each (lambda (testname) (if (not (hash-table-ref/default *alltestnames* testname #f)) (begin (set! *alltestnamelst* (append *alltestnamelst* (list testname))) (hash-table-set! *alltestnames* testname #t)))) testnames)))) runs) (set! testnames (collapse-rows *alltestnamelst*)) ;;; argh. please clean up this sillyness (set! testnames (let ((xl (if (> (length testnames) *start-test-offset*) (drop testnames *start-test-offset*) '()))) (append xl (make-list (- *num-tests* (length xl)) "")))) ;; redo the hash table. BUG: FIXME (set! *alltestnames* (make-hash-table)) (for-each (lambda (x) (hash-table-set! *alltestnames* x #t)) testnames) (set! *alltestnamelst* testnames) (for-each (lambda (rundat) (if (not rundat) ;; handle padded runs ;; ;; id run-id testname state status event-time host cpuload diskfree uname rundir item-path run-duration (set! rundat (vector (make-vector 20 #f) '() (map (lambda (x) "") *keys*))));; 3))) (let* ((run (vector-ref rundat 0)) (testsdat (vector-ref rundat 1)) (key-val-dat (vector-ref rundat 2)) (run-id (db:get-value-by-header run *header* "id")) (key-vals (append key-val-dat (list (let ((x (db:get-value-by-header run *header* "runname"))) (if x x ""))))) (run-key (string-intersperse key-vals "\n"))) ;; fill in the run header key values (let ((rown 0) (headercol (vector-ref tableheader coln))) (for-each (lambda (kval) (let* ((labl (vector-ref headercol rown))) (if (not (equal? kval (iup:attribute labl "TITLE"))) (iup:attribute-set! (vector-ref headercol rown) "TITLE" kval)) (set! rown (+ rown 1)))) |
︙ | ︙ | |||
235 236 237 238 239 240 241 | (if buttondat (let* ((test (let ((matching (filter (lambda (x)(equal? (test:test-get-fullname x) testname)) testsdat))) (if (null? matching) (vector -1 -1 "" "" "" 0 "" "" 0 "" "" "" 0 "" "") (car matching)))) | < < < < | < < < < < < < | < | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | (if buttondat (let* ((test (let ((matching (filter (lambda (x)(equal? (test:test-get-fullname x) testname)) testsdat))) (if (null? matching) (vector -1 -1 "" "" "" 0 "" "" 0 "" "" "" 0 "" "") (car matching)))) (testname (db:test-get-testname test)) (itempath (db:test-get-item-path test)) (testfullname (test:test-get-fullname test)) (teststatus (db:test-get-status test)) (teststate (db:test-get-state test)) (teststart (db:test-get-event_time test)) (runtime (db:test-get-run_duration test)) (buttontxt (if (equal? teststate "COMPLETED") teststatus teststate)) (button (vector-ref columndat rown)) (color (get-color-for-state-status teststate teststatus)) (curr-color (vector-ref buttondat 1)) ;; (iup:attribute button "BGCOLOR")) (curr-title (vector-ref buttondat 2))) ;; (iup:attribute button "TITLE"))) (if (not (equal? curr-color color)) (iup:attribute-set! button "BGCOLOR" color)) (if (not (equal? curr-title buttontxt)) (iup:attribute-set! button "TITLE" buttontxt)) (vector-set! buttondat 0 run-id) (vector-set! buttondat 1 color) (vector-set! buttondat 2 buttontxt) (vector-set! buttondat 3 test) (vector-set! buttondat 4 run-key))) (set! rown (+ rown 1)))) *alltestnamelst*)) (set! coln (+ coln 1)))) runs))) (define (mkstr . x) (string-intersperse (map conc x) ",")) (define (update-search x val) |
︙ | ︙ | |||
328 329 330 331 332 333 334 | (let loop ((testnum 0) (res '())) (cond ((>= testnum ntests) ;; now lftlst will be an hbox with the test keys and the test name labels (set! lftlst (append lftlst (list (apply iup:vbox (reverse res)))))) (else | | > > > | | | < | 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | (let loop ((testnum 0) (res '())) (cond ((>= testnum ntests) ;; now lftlst will be an hbox with the test keys and the test name labels (set! lftlst (append lftlst (list (apply iup:vbox (reverse res)))))) (else (let ((labl (iup:button "" #:flat "YES" #:size "100x15" #:fontsize "10" #:action (lambda (obj) (toggle-hide testnum))))) ;; (iup:attribute obj "TITLE")))) (vector-set! lftcol testnum labl) (loop (+ testnum 1)(cons labl res)))))) ;; (let loop ((runnum 0) (keynum 0) (keyvec (make-vector nkeys)) (res '())) (cond ;; nb// no else for this approach. ((>= runnum nruns) #f) ((>= keynum nkeys) (vector-set! header runnum keyvec) (set! hdrlst (cons (apply iup:vbox (reverse res)) hdrlst)) (loop (+ runnum 1) 0 (make-vector nkeys) '())) (else (let ((labl (iup:label "" #:size "60x15" #:fontsize "10"))) ;; #:expand "HORIZONTAL" (vector-set! keyvec keynum labl) (loop runnum (+ keynum 1) keyvec (cons labl res)))))) ;; By here the hdrlst contains a list of vboxes containing nkeys labels (let loop ((runnum 0) (testnum 0) (testvec (make-vector ntests)) (res '())) |
︙ | ︙ | |||
371 372 373 374 375 376 377 | ;; #:expand "HORIZONTAL" #:fontsize "10" #:action (lambda (x) (let* ((toolpath (car (argv))) (buttndat (hash-table-ref *buttondat* button-key)) (test-id (db:test-get-id (vector-ref buttndat 3))) (cmd (conc toolpath " -test " test-id "&"))) | | | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | ;; #:expand "HORIZONTAL" #:fontsize "10" #:action (lambda (x) (let* ((toolpath (car (argv))) (buttndat (hash-table-ref *buttondat* button-key)) (test-id (db:test-get-id (vector-ref buttndat 3))) (cmd (conc toolpath " -test " test-id "&"))) ;(print "Launching " cmd) (system cmd)))))) (hash-table-set! *buttondat* button-key (vector 0 "100 100 100" button-key #f #f)) (vector-set! testvec testnum butn) (loop runnum (+ testnum 1) testvec (cons butn res)))))) ;; now assemble the hdrlst and bdylst and kick off the dialog (iup:show (iup:dialog |
︙ | ︙ | |||
399 400 401 402 403 404 405 | (get-environment-variable "DASHBOARDROWS" )) (begin (set! *num-tests* (string->number (or (args:get-arg "-rows") (get-environment-variable "DASHBOARDROWS")))) (update-rundat "%" *num-runs* "%" "%")) (set! *num-tests* (min (max (update-rundat "%" *num-runs* "%" "%") 8) 20))) | < < < | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | (get-environment-variable "DASHBOARDROWS" )) (begin (set! *num-tests* (string->number (or (args:get-arg "-rows") (get-environment-variable "DASHBOARDROWS")))) (update-rundat "%" *num-runs* "%" "%")) (set! *num-tests* (min (max (update-rundat "%" *num-runs* "%" "%") 8) 20))) (define (run-update mtx1) (let loop ((i 0)) (thread-sleep! 0.05) (mutex-lock! mtx1) (update-buttons uidat *num-runs* *num-tests*) (mutex-unlock! mtx1) (iup:main-loop-flush) |
︙ | ︙ |
Modified megatest.scm from [cbc2bba983] to [dddaf7ea57].
1 2 3 4 5 6 7 8 9 10 | ;; Copyright 2006-2011, Matthew Welland. ;; ;; This program is made available under the GNU GPL version 2.0 or ;; greater. See the accompanying file COPYING for details. ;; ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. (include "common.scm") | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ;; Copyright 2006-2011, Matthew Welland. ;; ;; This program is made available under the GNU GPL version 2.0 or ;; greater. See the accompanying file COPYING for details. ;; ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. (include "common.scm") (define megatest-version 1.17) (define help (conc " Megatest, documentation at http://www.kiatoa.com/fossils/megatest version " megatest-version " license GPL, Copyright Matt Welland 2006-2011 Usage: megatest [options] |
︙ | ︙ |