Overview
Comment: | Simplified and streamlined the rollup code |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.62-no-rpc |
Files: | files | file ages | folders |
SHA1: |
47f0625f23eb3793b98714928a152a90 |
User & Date: | matt on 2016-11-28 22:06:05 |
Other Links: | branch diff | manifest | tags |
Context
2016-11-30
| ||
22:52 | Basic server code added back check-in: ce0b324459 user: matt tags: v1.62-no-rpc | |
2016-11-29
| ||
16:42 | started integration of rpc check-in: 816b840a5c user: bb tags: v1.62-rpc | |
2016-11-28
| ||
22:06 | Simplified and streamlined the rollup code check-in: 47f0625f23 user: matt tags: v1.62-no-rpc | |
2016-11-27
| ||
19:16 | misnamed table in query, steps => test_steps check-in: 2edc3f05a8 user: matt tags: v1.62-no-rpc | |
Changes
Modified common.scm from [ba4cec2667] to [e7c38eab03].
︙ | ︙ | |||
401 402 403 404 405 406 407 | (4 "SKIP") (5 "WARN") (6 "WAIVED") (7 "STUCK/DEAD") (8 "FAIL") (9 "ABORT"))) | | | > > > > > > > > > < < < < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 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 487 488 489 490 | (4 "SKIP") (5 "WARN") (6 "WAIVED") (7 "STUCK/DEAD") (8 "FAIL") (9 "ABORT"))) (define *common:ended-states* ;; states which indicate the test is stopped and will not proceed '("COMPLETED" "ARCHIVED" "KILLED" "KILLREQ" "STUCK" "INCOMPLETE")) (define *common:badly-ended-states* ;; these roll up as CHECK, i.e. results need to be checked '("KILLED" "KILLREQ" "STUCK" "INCOMPLETE" "DEAD")) (define *common:running-states* ;; test is either running or can be run '("RUNNING" "REMOTEHOSTSTART" "LAUNCHED")) (define *common:cant-run-states* ;; These are stopping conditions that prevent a test from being run '("COMPLETED" "KILLED" "UNKNOWN" "INCOMPLETE" "ARCHIVED")) (define *common:not-started-ok-statuses* ;; if not one of these statuses when in not_started state treat as dead '("n/a" "na" "PASS" "FAIL" "WARN" "CHECK" "WAIVED" "DEAD" "SKIP")) (define (common:special-sort items order comp) (let ((items-order (map reverse order)) (acomp (or comp >))) (sort items (lambda (a b) (let ((a-num (cadr (or (assoc a items-order) '(0 0)))) (b-num (cadr (or (assoc b items-order) '(0 0))))) (acomp a-num b-num)))))) ;; ;; given a toplevel with currstate, currstatus apply state and status ;; ;; => (newstate . newstatus) ;; (define (common:apply-state-status currstate currstatus state status) ;; (let* ((cstate (string->symbol (string-downcase currstate))) ;; (cstatus (string->symbol (string-downcase currstatus))) ;; (sstate (string->symbol (string-downcase state))) ;; (sstatus (string->symbol (string-downcase status))) ;; (nstate #f) ;; (nstatus #f)) ;; (set! nstate ;; (case cstate ;; ((completed not_started killed killreq stuck archived) ;; (case sstate ;; completed -> sstate ;; ((completed killed killreq stuck archived) completed) ;; ((running remotehoststart launched) running) ;; (else unknown-error-1))) ;; ((running remotehoststart launched) ;; (case sstate ;; ((completed killed killreq stuck archived) #f) ;; need to look at all items ;; ((running remotehoststart launched) running) ;; (else unknown-error-2))) ;; (else unknown-error-3))) ;; (set! nstatus ;; (case sstatus ;; ((pass) ;; (case nstate ;; ((pass n/a deleted) pass) ;; ((warn) warn) ;; ((fail) fail) ;; ((check) check) ;; ((waived) waived) ;; ((skip) skip) ;; ((stuck/dead) stuck) ;; ((abort) abort) ;; (else unknown-error-4))) ;; ((warn) ;; (case nstate ;; ((pass warn n/a skip deleted) warn) ;; ((fail) fail) ;; ((check) check) ;; ((waived) waived) ;; ((stuck/dead) stuck) ;; (else unknown-error-5))) ;; ((fail) ;; (case nstate ;; ((pass warn fail check n/a waived skip deleted stuck/dead stuck) fail) ;; ((abort) abort) ;; (else unknown-error-6))) ;; (else unknown-error-7))) ;; (cons ;; (if nstate (symbol->string nstate) nstate) ;; (if nstatus (symbol->string nstatus) nstatus)))) ;;====================================================================== ;; D E B U G G I N G S T U F F ;;====================================================================== (define *verbosity* 1) (define *logging* #f) |
︙ | ︙ |
Modified db.scm from [a2c9fda77a] to [77088c1205].
︙ | ︙ | |||
41 42 43 44 45 46 47 48 49 50 51 52 53 54 | ;;====================================================================== ;; each db entry is a pair ( db . dbfilepath ) (defstruct dbr:dbstruct (tmpdb #f) (mtdb #f) (refndb #f)) ;;====================================================================== ;; SQLITE3 HELPERS ;;====================================================================== (define (db:general-sqlite-error-dump exn stmt . params) (let ((err-status ((condition-property-accessor 'sqlite3 'status #f) exn))) ;; RADT ... how does this work? | > > > > > > > > | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | ;;====================================================================== ;; each db entry is a pair ( db . dbfilepath ) (defstruct dbr:dbstruct (tmpdb #f) (mtdb #f) (refndb #f)) ;; record for keeping state,status and count for doing roll-ups in ;; iterated tests ;; (defstruct dbr:counts (state #f) (status #f) (count 0)) ;;====================================================================== ;; SQLITE3 HELPERS ;;====================================================================== (define (db:general-sqlite-error-dump exn stmt . params) (let ((err-status ((condition-property-accessor 'sqlite3 'status #f) exn))) ;; RADT ... how does this work? |
︙ | ︙ | |||
3138 3139 3140 3141 3142 3143 3144 | (tl-testdat (db:get-test-info dbstruct run-id test-name "")) (tl-test-id (db:test-get-id tl-testdat))) (sqlite3:with-transaction db (lambda () (db:test-set-state-status-by-id dbstruct run-id test-id state status comment) (if (not (equal? item-path "")) ;; only roll up IF incoming test is an item | > > > > > > > > > | | < | | | | < < < < | < < | > > > > | > > | 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 | (tl-testdat (db:get-test-info dbstruct run-id test-name "")) (tl-test-id (db:test-get-id tl-testdat))) (sqlite3:with-transaction db (lambda () (db:test-set-state-status-by-id dbstruct run-id test-id state status comment) (if (not (equal? item-path "")) ;; only roll up IF incoming test is an item (let* ((state-status-counts (db:get-all-state-status-counts-for-test db run-id test-name item-path)) ;; item-path is used to exclude current state/status of THIS test (running (length (filter (lambda (x) (member (dbr:counts-state x) *common:running-states*)) state-status-counts))) (bad-not-started (length (filter (lambda (x) (and (equal? (dbr:counts-state x) "NOT_STARTED") (not (member (dbr:counts-status x) *common:not-started-ok-statuses*)))) state-status-counts))) (all-curr-states (common:special-sort ;; worst -> best (sort of) (delete-duplicates (cons state (map dbr:counts-state state-status-counts))) *common:std-states* >)) (all-curr-statuses (common:special-sort ;; worst -> best (delete-duplicates (cons status (map dbr:counts-status state-status-counts))) *common:std-statuses* >)) (newstate (if (> running 0) "RUNNING" (if (> bad-not-started 0) "COMPLETED" (car all-curr-states)))) (newstatus (if (> bad-not-started 0) "CHECK" (car all-curr-statuses)))) ;; (print "Setting toplevel to: " newstate "/" newstatus) (db:test-set-state-status-by-id dbstruct run-id tl-test-id newstate newstatus #f))))))) (define db:roll-up-pass-fail-counts db:set-state-status-and-roll-up-items) ;; call with state = #f to roll up with out accounting for state/status of this item ;; |
︙ | ︙ | |||
3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 | ;; ;; ;; NOTE: No else clause needed for this case ;; ;; (case (string->symbol status) ;; ;; ((RUNNING) (db:general-call dbdat 'top-test-set-running (list test-name))) ;; ;; ((LAUNCHED) (db:general-call dbdat 'top-test-set (list "LAUNCHED" test-name))) ;; ;; ((ABORT INCOMPLETE) (db:general-call dbdat 'top-test-set (list status test-name)))) ;; ;; #f) ;; ;; ))) (define (db:get-all-item-states db run-id test-name) (sqlite3:map-row (lambda (a) a) db "SELECT DISTINCT state FROM tests WHERE item_path != '' AND state != 'DELETED' AND run_id=? AND testname=?" run-id test-name)) | > > > > > > > > > | 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 | ;; ;; ;; NOTE: No else clause needed for this case ;; ;; (case (string->symbol status) ;; ;; ((RUNNING) (db:general-call dbdat 'top-test-set-running (list test-name))) ;; ;; ((LAUNCHED) (db:general-call dbdat 'top-test-set (list "LAUNCHED" test-name))) ;; ;; ((ABORT INCOMPLETE) (db:general-call dbdat 'top-test-set (list status test-name)))) ;; ;; #f) ;; ;; ))) (define (db:get-all-state-status-counts-for-test db run-id test-name item-path) (sqlite3:map-row (lambda (state status count) (make-dbr:counts state: state status: status count: count)) db "SELECT state,status,count(id) FROM tests WHERE run_id=? AND testname=? AND item_path != '' AND item_path !=? GROUP BY state,status;" run-id test-name item-path)) (define (db:get-all-item-states db run-id test-name) (sqlite3:map-row (lambda (a) a) db "SELECT DISTINCT state FROM tests WHERE item_path != '' AND state != 'DELETED' AND run_id=? AND testname=?" run-id test-name)) |
︙ | ︙ |