Overview
Comment: | Added toggles to hide tests based on PASS, FAIL etc. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
e2c3e19524457a92f3c942cb4a1b4bf1 |
User & Date: | matt on 2011-10-09 23:54:30 |
Other Links: | manifest | tags |
Context
2011-10-10
| ||
11:00 | Couple tweaks to toggles for hiding based on state and status; added more states/statuses check-in: 92f8a89d60 user: mrwellan tags: trunk | |
2011-10-09
| ||
23:54 | Added toggles to hide tests based on PASS, FAIL etc. check-in: e2c3e19524 user: matt tags: trunk | |
12:40 | Fixed mishandling of failed step in ezstep and added a test for failed case check-in: 93749b40da user: matt tags: trunk | |
Changes
Modified dashboard.scm from [d8bbd167b3] to [0dc69fbd79].
︙ | ︙ | |||
90 91 92 93 94 95 96 97 98 99 100 101 102 103 | (define *tot-run-count* (db:get-num-runs *db* "%")) (define *last-update* (current-seconds)) (define *num-tests* 15) (define *start-run-offset* 0) (define *start-test-offset* 0) (define *examine-test-dat* (make-hash-table)) (define *exit-started* #f) (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))) | > > | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | (define *tot-run-count* (db:get-num-runs *db* "%")) (define *last-update* (current-seconds)) (define *num-tests* 15) (define *start-run-offset* 0) (define *start-test-offset* 0) (define *examine-test-dat* (make-hash-table)) (define *exit-started* #f) (define *status-ignore-hash* (make-hash-table)) (define *state-ignore-hash* (make-hash-table)) (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))) |
︙ | ︙ | |||
181 182 183 184 185 186 187 | ;; keypatts: ( (KEY1 "abc%def")(KEY2 "%") ) (define (update-rundat runnamepatt numruns testnamepatt itemnamepatt keypatts) (let* ((allruns (db:get-runs *db* runnamepatt numruns *start-run-offset* keypatts)) (header (db:get-header allruns)) (runs (db:get-rows allruns)) (result '()) | | > > | | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | ;; keypatts: ( (KEY1 "abc%def")(KEY2 "%") ) (define (update-rundat runnamepatt numruns testnamepatt itemnamepatt keypatts) (let* ((allruns (db:get-runs *db* runnamepatt numruns *start-run-offset* keypatts)) (header (db:get-header allruns)) (runs (db:get-rows allruns)) (result '()) (maxtests 0) (states (hash-table-keys *state-ignore-hash*)) (statuses (hash-table-keys *status-ignore-hash*))) (if (> (+ *last-update* 300) (current-seconds)) ;; every five minutes (begin (set! *last-update* (current-seconds)) (set! *tot-run-count* (db:get-num-runs *db* runnamepatt)))) (for-each (lambda (run) (let* ((run-id (db:get-value-by-header run header "id")) (tests (db-get-tests-for-run *db* run-id testnamepatt itemnamepatt states statuses)) (key-vals (get-key-vals *db* run-id))) (if (> (length tests) maxtests) (set! maxtests (length tests))) (set! result (cons (vector run tests key-vals) result)))) runs) (set! *header* header) (set! *allruns* result) |
︙ | ︙ | |||
422 423 424 425 426 427 428 | (hdrlst '()) (bdylst '()) (result '()) (i 0)) ;; controls (along bottom) (set! controls (iup:hbox | > > > | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 | (hdrlst '()) (bdylst '()) (result '()) (i 0)) ;; controls (along bottom) (set! controls (iup:hbox (iup:frame #:title "filter test and items" (iup:hbox (iup:textbox #:size "60x15" #:fontsize "10" #:value "%" #:action (lambda (obj unk val) (update-search "test-name" val))) (iup:textbox #:size "60x15" #:fontsize "10" #:value "%" #:action (lambda (obj unk val) (update-search "item-name" val))))) (iup:button "Quit" #:action (lambda (obj)(sqlite3:finalize! *db*)(exit))) ;; (iup:button "<- Left" #:action (lambda (obj)(set! *start-run-offset* (+ *start-run-offset* 1)))) ;; (iup:button "Up ^" #:action (lambda (obj)(set! *start-test-offset* (if (> *start-test-offset* 0)(- *start-test-offset* 1) 0)))) ;; (iup:button "Down v" #:action (lambda (obj)(set! *start-test-offset* (if (>= *start-test-offset* (length *alltestnamelst*))(length *alltestnamelst*)(+ *start-test-offset* 1))))) ;; (iup:button "Right ->" #:action (lambda (obj)(set! *start-run-offset* (if (> *start-run-offset* 0)(- *start-run-offset* 1) 0)))) (iup:frame #:title "hide" (iup:vbox (iup:hbox (iup:toggle "PASS" #:action (lambda (obj val) (if (eq? val 1) (hash-table-set! *status-ignore-hash* "PASS" #t) (hash-table-delete! *status-ignore-hash* "PASS")))) (iup:toggle "FAIL" #:action (lambda (obj val) (if (eq? val 1) (hash-table-set! *status-ignore-hash* "FAIL" #t) (hash-table-delete! *status-ignore-hash* "FAIL")))) (iup:toggle "WARN" #:action (lambda (obj val) (if (eq? val 1) (hash-table-set! *status-ignore-hash* "WARN" #t) (hash-table-delete! *status-ignore-hash* "WARN")))) (iup:toggle "WAIVED" #:action (lambda (obj val) (if (eq? val 1) (hash-table-set! *status-ignore-hash* "WAIVED" #t) (hash-table-delete! *status-ignore-hash* "WAIVED"))))) (iup:hbox (iup:toggle "RUNNING" #:action (lambda (obj val) (if (eq? val 1) (hash-table-set! *state-ignore-hash* "RUNNING" #t) (hash-table-delete! *state-ignore-hash* "RUNNING")))) (iup:toggle "COMPLETED" #:action (lambda (obj val) (if (eq? val 1) (hash-table-set! *state-ignore-hash* "COMPLETED" #t) (hash-table-delete! *state-ignore-hash* "COMPLETED")))) (iup:toggle "KILLED" #:action (lambda (obj val) (if (eq? val 1) (hash-table-set! *state-ignore-hash* "KILLED" #t) (hash-table-delete! *state-ignore-hash* "KILLED"))))))) (iup:valuator #:valuechanged_cb (lambda (obj) (let ((val (inexact->exact (round (string->number (iup:attribute obj "VALUE"))))) (maxruns *tot-run-count*)) ;;; (+ *num-runs* (length *allruns*)))) (set! *start-run-offset* val) (debug:print 3 "maxruns: " maxruns ", val: " val) (iup:attribute-set! obj "MAX" maxruns))) #:expand "YES" |
︙ | ︙ |
Modified db.scm from [dd48063f4b] to [bb72d6bc7f].
︙ | ︙ | |||
131 132 133 134 135 136 137 138 139 140 141 142 143 144 | variable TEXT, value REAL, expected REAL, tol REAL, units TEXT, comment TEXT DEFAULT '', status TEXT DEFAULT 'n/a', CONSTRAINT test_data UNIQUE (test_id,category,variable));") ;; Must do this *after* running patch db !! No more. (db:set-var db "MEGATEST_VERSION" megatest-version) )) db)) ;;====================================================================== | > | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | variable TEXT, value REAL, expected REAL, tol REAL, units TEXT, comment TEXT DEFAULT '', status TEXT DEFAULT 'n/a', type TEXT DEFAULT '', CONSTRAINT test_data UNIQUE (test_id,category,variable));") ;; Must do this *after* running patch db !! No more. (db:set-var db "MEGATEST_VERSION" megatest-version) )) db)) ;;====================================================================== |
︙ | ︙ | |||
204 205 206 207 208 209 210 | expected REAL, tol REAL, units TEXT, comment TEXT DEFAULT '', status TEXT DEFAULT 'n/a', CONSTRAINT test_data UNIQUE (test_id,category,variable));") (patch-db)) | > > > > | | | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | expected REAL, tol REAL, units TEXT, comment TEXT DEFAULT '', status TEXT DEFAULT 'n/a', CONSTRAINT test_data UNIQUE (test_id,category,variable));") (patch-db)) ((< mver 1.27) (db:set-var db "MEGATEST_VERSION" 1.27) (sqlite3:execute db "ALTER TABLE test_data ADD COLUMN type TEXT DEFAULT '';") (patch-db)) ((< mver megatest-version) (db:set-var db "MEGATEST_VERSION" megatest-version)))))) ;;====================================================================== ;; meta get and set vars ;;====================================================================== ;; returns number if string->number is successful, string otherwise (define (db:get-var db var) |
︙ | ︙ | |||
345 346 347 348 349 350 351 | (define (db:delete-run db run-id) (sqlite3:execute db "DELETE FROM runs WHERE id=?;" run-id)) ;;====================================================================== ;; T E S T S ;;====================================================================== | > > | | > > > > | > > > | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | (define (db:delete-run db run-id) (sqlite3:execute db "DELETE FROM runs WHERE id=?;" run-id)) ;;====================================================================== ;; T E S T S ;;====================================================================== ;; states and statuses are lists, turn them into ("PASS","FAIL"...) and use NOT IN ;; i.e. these lists define what to NOT show. (define (db-get-tests-for-run db run-id testpatt itempatt states statuses) (let ((res '()) (states-str (if (and states (not (null? states))) (conc " AND state NOT IN ('" (string-intersperse states "','") "')") "")) (statuses-str (if (and statuses (not (null? statuses))) (conc " AND status NOT IN ('" (string-intersperse statuses "','") "')") ""))) (sqlite3:for-each-row (lambda (id run-id testname state status event-time host cpuload diskfree uname rundir item-path run-duration final-logf comment first-err first-warn) (set! res (cons (vector id run-id testname state status event-time host cpuload diskfree uname rundir item-path run-duration final-logf comment first-err first-warn) res))) db (conc "SELECT id,run_id,testname,state,status,event_time,host,cpuload,diskfree,uname,rundir,item_path,run_duration,final_logf,comment,first_err,first_warn " " FROM tests WHERE run_id=? AND testname like ? AND item_path LIKE ? " states-str statuses-str " ORDER BY id DESC;") run-id (if testpatt testpatt "%") (if itempatt itempatt "%")) res)) ;; this one is a bit broken BUG FIXME (define (db:delete-test-step-records db run-id test-name itemdat) |
︙ | ︙ |
Modified megatest-version.scm from [4c11cf7b25] to [13d5db31c5].
1 2 3 4 5 | ;; Always use two digit decimal ;; 1.01, 1.02...1.10,1.11 ... 1.99,2.00.. (declare (unit megatest-version)) | | | 1 2 3 4 5 6 | ;; Always use two digit decimal ;; 1.01, 1.02...1.10,1.11 ... 1.99,2.00.. (declare (unit megatest-version)) (define megatest-version 1.27) |
Modified megatest.scm from [005f4002b8] to [8519508a08].
︙ | ︙ | |||
251 252 253 254 255 256 257 | (debug:print 2 "Run: " (string-intersperse (map (lambda (x) (db:get-value-by-header run header x)) keynames) "/") "/" (db:get-value-by-header run header "runname")) (let ((run-id (db:get-value-by-header run header "id"))) | | | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | (debug:print 2 "Run: " (string-intersperse (map (lambda (x) (db:get-value-by-header run header x)) keynames) "/") "/" (db:get-value-by-header run header "runname")) (let ((run-id (db:get-value-by-header run header "id"))) (let ((tests (db-get-tests-for-run db run-id testpatt itempatt #f #f))) ;; Each test (for-each (lambda (test) (format #t " Test: ~25a State: ~15a Status: ~15a Runtime: ~5@as Time: ~22a Host: ~10a\n" (conc (db:test-get-testname test) (if (equal? (db:test-get-item-path test) "") |
︙ | ︙ |
Modified runs.scm from [3af94e9359] to [e4c70b394e].
︙ | ︙ | |||
126 127 128 129 130 131 132 | (conc "SELECT id FROM runs WHERE " qrystr " AND id != ?;") (append keyvals (list run-id))) ;; for each run starting with the most recent look to see if there is a matching test ;; if found then return that matching test record (debug:print 4 "selstr: " selstr ", qrystr: " qrystr ", keyvals: " keyvals ", previous run ids found: " prev-run-ids) (if (null? prev-run-ids) #f (let loop ((hed (car prev-run-ids)) (tal (cdr prev-run-ids))) | | | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | (conc "SELECT id FROM runs WHERE " qrystr " AND id != ?;") (append keyvals (list run-id))) ;; for each run starting with the most recent look to see if there is a matching test ;; if found then return that matching test record (debug:print 4 "selstr: " selstr ", qrystr: " qrystr ", keyvals: " keyvals ", previous run ids found: " prev-run-ids) (if (null? prev-run-ids) #f (let loop ((hed (car prev-run-ids)) (tal (cdr prev-run-ids))) (let ((results (db-get-tests-for-run db hed test-name item-path #f #f))) (debug:print 4 "Got tests for run-id " run-id ", test-name " test-name ", item-path " item-path ": " results) (if (and (null? results) (not (null? tal))) (loop (car tal)(cdr tal)) (if (null? results) #f (car results)))))))))) |
︙ | ︙ | |||
164 165 166 167 168 169 170 | ;; collect all matching tests for the runs then ;; extract the most recent test and return that. (debug:print 4 "selstr: " selstr ", qrystr: " qrystr ", keyvals: " keyvals ", previous run ids found: " prev-run-ids) (if (null? prev-run-ids) '() ;; no previous runs? return null (let loop ((hed (car prev-run-ids)) (tal (cdr prev-run-ids))) | | | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | ;; collect all matching tests for the runs then ;; extract the most recent test and return that. (debug:print 4 "selstr: " selstr ", qrystr: " qrystr ", keyvals: " keyvals ", previous run ids found: " prev-run-ids) (if (null? prev-run-ids) '() ;; no previous runs? return null (let loop ((hed (car prev-run-ids)) (tal (cdr prev-run-ids))) (let ((results (db-get-tests-for-run db hed test-name item-path #f #f))) (debug:print 4 "Got tests for run-id " run-id ", test-name " test-name ", item-path " item-path " results: " (intersperse results "\n")) ;; Keep only the youngest of any test/item combination (for-each (lambda (testdat) (let* ((full-testname (conc (db:test-get-testname testdat) "/" (db:test-get-item-path testdat))) (stored-test (hash-table-ref/default tests-hash full-testname #f))) |
︙ | ︙ | |||
748 749 750 751 752 753 754 | (debug:print 1 "Header: " header) (for-each (lambda (run) (let ((runkey (string-intersperse (map (lambda (k) (db:get-value-by-header run header (vector-ref k 0))) keys) "/")) (dirs-to-remove (make-hash-table))) (let* ((run-id (db:get-value-by-header run header "id") ) | | | 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 | (debug:print 1 "Header: " header) (for-each (lambda (run) (let ((runkey (string-intersperse (map (lambda (k) (db:get-value-by-header run header (vector-ref k 0))) keys) "/")) (dirs-to-remove (make-hash-table))) (let* ((run-id (db:get-value-by-header run header "id") ) (tests (db-get-tests-for-run db (db:get-value-by-header run header "id") testpatt itempatt #f #f)) (lasttpath "/does/not/exist/I/hope")) (if (not (null? tests)) (begin (debug:print 1 "Removing tests for run: " runkey " " (db:get-value-by-header run header "runname")) (for-each (lambda (test) |
︙ | ︙ | |||
799 800 801 802 803 804 805 | (debug:print 2 "Removing directory with zero db references: " dir-to-remove) (system (conc "rm -rf " dir-to-remove)) (hash-table-delete! dirs-to-remove dir-to-remove)) (debug:print 2 "Skipping removal of " dir-to-remove " for now as it still has references in the database"))))) (sort (hash-table-keys dirs-to-remove) (lambda (a b)(> (string-length a)(string-length b))))) ;; remove the run if zero tests remain | | | 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 | (debug:print 2 "Removing directory with zero db references: " dir-to-remove) (system (conc "rm -rf " dir-to-remove)) (hash-table-delete! dirs-to-remove dir-to-remove)) (debug:print 2 "Skipping removal of " dir-to-remove " for now as it still has references in the database"))))) (sort (hash-table-keys dirs-to-remove) (lambda (a b)(> (string-length a)(string-length b))))) ;; remove the run if zero tests remain (let ((remtests (db-get-tests-for-run db (db:get-value-by-header run header "id") #f #f #f #f))) (if (null? remtests) ;; no more tests remaining (let* ((dparts (string-split lasttpath "/")) (runpath (conc "/" (string-intersperse (take dparts (- (length dparts) 1)) "/")))) (debug:print 1 "Removing run: " runkey " " (db:get-value-by-header run header "runname")) (db:delete-run db run-id) |
︙ | ︙ | |||
885 886 887 888 889 890 891 | (runs:update-test_meta db test-name test-conf))) test-names))) ;; This could probably be refactored into one complex query ... (define (runs:rollup-run db keys) (let* ((new-run-id (register-run db keys)) (prev-tests (test:get-matching-previous-test-run-records db new-run-id "%" "%")) | | | 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 | (runs:update-test_meta db test-name test-conf))) test-names))) ;; This could probably be refactored into one complex query ... (define (runs:rollup-run db keys) (let* ((new-run-id (register-run db keys)) (prev-tests (test:get-matching-previous-test-run-records db new-run-id "%" "%")) (curr-tests (db-get-tests-for-run db new-run-id "%" "%" #f #f)) (curr-tests-hash (make-hash-table))) ;; index the already saved tests by testname and itempath in curr-tests-hash (for-each (lambda (testdat) (let* ((testname (db:test-get-testname testdat)) (item-path (db:test-get-item-path testdat)) (full-name (conc testname "/" item-path))) |
︙ | ︙ | |||
912 913 914 915 916 917 918 | (new-test-record #f)) ;; replace these with insert ... select (apply sqlite3:execute db (conc "INSERT OR REPLACE INTO tests (run_id,testname,state,status,event_time,host,cpuload,diskfree,uname,rundir,item_path,run_duration,final_logf,comment,first_err,first_warn) " "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);") new-run-id (cddr (vector->list testdat))) | | | 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 | (new-test-record #f)) ;; replace these with insert ... select (apply sqlite3:execute db (conc "INSERT OR REPLACE INTO tests (run_id,testname,state,status,event_time,host,cpuload,diskfree,uname,rundir,item_path,run_duration,final_logf,comment,first_err,first_warn) " "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);") new-run-id (cddr (vector->list testdat))) (set! new-testdat (car (db-get-tests-for-run db new-run-id testname item-path #f #f))) (hash-table-set! curr-tests-hash full-name new-testdat) ;; this could be confusing, which record should go into the lookup table? ;; Now duplicate the test steps (debug:print 4 "Copying records in test_steps from test_id=" (db:test-get-id testdat) " to " (db:test-get-id new-testdat)) (sqlite3:execute db (conc "INSERT OR REPLACE INTO test_steps (test_id,stepname,state,status,event_time,comment) " "SELECT " (db:test-get-id new-testdat) ",stepname,state,status,event_time,comment FROM test_steps WHERE test_id=?;") |
︙ | ︙ |