Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -3998,11 +3998,11 @@ ;; (("WARN" "DEAD") (define (db:set-state-status-and-roll-up-items dbstruct run-id test-name item-path state status comment) ;; establish info on incoming test followed by info on top level test ;; BBnote - for mode itemwait, linkage between upstream test & matching item status is propagated to run queue in db:prereqs-not-met - ;; (mutex-lock! *db-transaction-mutex*) ;; why do we need a mutex? + (mutex-lock! *db-transaction-mutex*) ;; why do we need a mutex? (let* ((testdat (if (number? test-name) (db:get-test-info-by-id dbstruct run-id test-name) ;; test-name is actually a test-id (db:get-test-info dbstruct run-id test-name item-path))) (test-id (db:test-get-id testdat)) (test-name (if (number? test-name) @@ -4046,20 +4046,20 @@ no-sync-db (lambda () (db:no-sync-set no-sync-db rollup-lock-key (current-seconds)) (db:no-sync-del! no-sync-db waiting-lock-key)))))) ;; now the rollup - ;; (mutex-unlock! *db-transaction-mutex*) ;; why do we need a mutex? + (mutex-unlock! *db-transaction-mutex*) ;; why do we need a mutex? (if rollup-flag ;; put this into a thread (begin ;; (thread-start! (make-thread ;; (lambda () (db:roll-up-test-state-status dbstruct run-id test-name state status) (db:no-sync-del! no-sync-db rollup-lock-key)) ;; (conc "thread for run-id: " run-id " test-name: " test-name)))))))) )) - ;; (mutex-unlock! *db-transaction-mutex*) ;; why do we need a mutex? + (mutex-unlock! *db-transaction-mutex*) ;; why do we need a mutex? ))) ;; I'd like to remove the need for item-path - it is logically not needed here ;; for now we pass in state and status - NOTE: There is a possible race if a test ;; is rapidly re-run while an earlier run is waiting to rollup. @@ -4275,10 +4275,25 @@ (unrelated-rec-list (filter nonmatch-countrec-lambda other-items-count-recs))) (cons updated-count-rec unrelated-rec-list))) + +;; full count not including toplevel +;; +(define (db:get-all-state-status-counts-for-testname dbstruct run-id test-name) + (let* ((test-count-recs (db:with-db + dbstruct #f #f + (lambda (db) + (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 != '' GROUP BY state,status;" + run-id test-name))))) + test-count-recs)) + ;; full count not including toplevel ;; (define (db:get-all-state-status-counts-for-testname dbstruct run-id test-name) (let* ((test-count-recs (db:with-db