Megatest

Diff
Login

Differences From Artifact [572d71d91a]:

To Artifact [e987813ffc]:


684
685
686
687
688
689
690


691
692


693
694
695
696
697
698
699
684
685
686
687
688
689
690
691
692


693
694
695
696
697
698
699
700
701







+
+
-
-
+
+







;; ( (runname (( state  count ) ... ))
;;   (   ...  
(define (db:get-run-stats db)
  (let ((totals       (make-hash-table))
	(res          '()))
    (sqlite3:for-each-row
     (lambda (runname state count)
       (let* ((stateparts (string-split state "/"))
	      (newstate   (conc (car stateparts) "\n" (cadr stateparts))))
       (hash-table-set! totals state (+ (hash-table-ref/default totals state 0) count))
       (set! res (cons (list runname state count) res)))
	 (hash-table-set! totals newstate (+ (hash-table-ref/default totals newstate 0) count))
	 (set! res (cons (list runname newstate count) res))))
     db
    "SELECT runname,t.state||'/'||t.status AS s,count(t.id) FROM runs AS r INNER JOIN tests AS t ON r.id=t.run_id GROUP BY s,runname;" )
    (for-each (lambda (state)
		(set! res (cons (list "Totals" state (hash-table-ref totals state)) res)))
	      (hash-table-keys totals))
    res))