Megatest

Check-in [8f0c8da91f]
Login
Overview
Comment:Fixed timestamp on run registration.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 8f0c8da91f58d275c6ec08cb5cddf5d3d5e9c6b6
User & Date: mrwellan on 2013-07-03 11:57:58
Other Links: branch diff | manifest | tags
Context
2013-07-03
17:22
Dashboard tabs only update if active to save cycles check-in: f84e5af141 user: mrwellan tags: dev
11:57
Fixed timestamp on run registration. check-in: 8f0c8da91f user: mrwellan tags: dev
2013-07-02
16:28
Improved info page layout check-in: 0d67b603e1 user: mrwellan tags: dev
Changes

Modified db.scm from [e987813ffc] to [5073c25150].

594
595
596
597
598
599
600
601

602
603
604
605
606
607
608
594
595
596
597
598
599
600

601
602
603
604
605
606
607
608







-
+







	   (lambda (id)
	     (set! res id))
	   db
	   (let ((qry (conc "SELECT id FROM runs WHERE (runname=? " andstr key=?str ");")))
	     ;(debug:print 4 "qry: " qry) 
	     qry)
	   qryvals)
	  (sqlite3:execute db "UPDATE runs SET state=?,status=? WHERE id=?;" state status res)
	  (sqlite3:execute db "UPDATE runs SET state=?,status=?,event_time=strftime('%s','now') WHERE id=?;" state status res)
	  res) 
	(begin
	  (debug:print 0 "ERROR: Called without all necessary keys")
	  #f))))


;; replace header and keystr with a call to runs:get-std-run-fields
684
685
686
687
688
689
690
691

692
693
694
695
696


697
698
699
700
701
702
703
684
685
686
687
688
689
690

691
692
693
694
695

696
697
698
699
700
701
702
703
704







-
+




-
+
+







;; ( (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 "/"))
       (let* ((stateparts (string-split state "|"))
	      (newstate   (conc (car stateparts) "\n" (cadr stateparts))))
	 (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;" )
    "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 ORDER BY r.event_time DESC;" )
    (set! res (reverse res))
    (for-each (lambda (state)
		(set! res (cons (list "Totals" state (hash-table-ref totals state)) res)))
	      (hash-table-keys totals))
    res))

;; db:get-runs-by-patt
;; get runs by list of criteria
722
723
724
725
726
727
728
729

730
731
732
733
734
735
736
723
724
725
726
727
728
729

730
731
732
733
734
735
736
737







-
+







		       (wildtype (if (substring-index "%" patt) "like" "glob")))
		  (if patt
		      (set! key-patt (conc key-patt " AND " key " " wildtype " '" patt "'"))
		      (begin
			(debug:print 0 "ERROR: searching for runs with no pattern set for " fulkey)
			(exit 6)))))
	      keyvals)
    (set! qry-str (conc "SELECT " keystr " FROM runs WHERE runname " runwildtype " ? " key-patt ";"))
    (set! qry-str (conc "SELECT " keystr " FROM runs WHERE runname " runwildtype " ? " key-patt " ORDER BY event_time;"))
    (debug:print-info 4 "runs:get-runs-by-patt qry=" qry-str " " runnamepatt)
    (sqlite3:for-each-row 
     (lambda (a . r)
       (set! res (cons (list->vector (cons a r)) res)))
     db 
     qry-str
     runnamepatt)