653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
|
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
|
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
|
(define (db:write-cached-data db)
(let ((meta-stmt (sqlite3:prepare db "UPDATE tests SET cpuload=?,diskfree=?,run_duration=?,state='RUNNING' WHERE run_id=? AND testname=? AND item_path=? AND state NOT IN ('COMPLETED','KILLREQ','KILLED');"))
(step-stmt (sqlite3:prepare db "INSERT OR REPLACE into test_steps (test_id,stepname,state,status,event_time,comment,logfile) VALUES(?,?,?,?,?,?,?);")) ;; strftime('%s','now')#f)
(data (sort *incoming-data* (lambda (a b)(< (vector-ref a 1)(vector-ref b 1))))))
(if (> (length data) 0)
(debug:print 4 "Writing cached data " data))
(mutex-lock! *incoming-mutex*)
(sqlite3:with-transaction
db
(lambda ()
(for-each (lambda (entry)
(case (vector-ref entry 0)
((meta-info)
(apply sqlite3:execute meta-stmt (vector-ref entry 2)))
((step-status)
(apply sqlite3:execute step-stmt (vector-ref entry 2)))
(else
(debug:print 0 "ERROR: Queued entry not recognised " entry))))
data)
(for-each (lambda (entry)
(case (vector-ref entry 0)
((meta-info)
(apply sqlite3:execute meta-stmt (vector-ref entry 2)))
((step-status)
(apply sqlite3:execute step-stmt (vector-ref entry 2)))
(else
(debug:print 0 "ERROR: Queued entry not recognised " entry))))
data)))
(set! *incoming-data* '())
(mutex-unlock! *incoming-mutex*)
(sqlite3:finalize! meta-stmt)
(sqlite3:finalize! step-stmt)))
(define (db:roll-up-pass-fail-counts db run-id test-name item-path status)
(if (and (not (equal? item-path ""))
|