Index: dashboard.scm ================================================================== --- dashboard.scm +++ dashboard.scm @@ -181,11 +181,12 @@ (delta (map (lambda (a b)(abs (- a b))) c1 c2))) (null? (filter (lambda (x)(> x 3)) delta)))) ;; keypatts: ( (KEY1 "abc%def")(KEY2 "%") ) (define (update-rundat runnamepatt numruns testnamepatt itemnamepatt keypatts) - (let* ((allruns (db:get-runs *db* runnamepatt (+ numruns (/ numruns 2)) *start-run-offset* keypatts)) + (let* ((allruns (db:get-runs *db* runnamepatt numruns ;; (+ numruns 1) ;; (/ numruns 2)) + *start-run-offset* keypatts)) (header (db:get-header allruns)) (runs (db:get-rows allruns)) (result '()) (maxtests 0) (states (hash-table-keys *state-ignore-hash*)) @@ -503,11 +504,11 @@ (iup:toggle "KILLED" #:action (lambda (obj val) (if (eq? val 1) (hash-table-set! *state-ignore-hash* "KILLED" #t) (hash-table-delete! *state-ignore-hash* "KILLED"))))))) (iup:valuator #:valuechanged_cb (lambda (obj) - (let ((val (inexact->exact (round (+ 0.5 (string->number (iup:attribute obj "VALUE")))))) + (let ((val (inexact->exact (round (+ 0.0 (string->number (iup:attribute obj "VALUE")))))) (maxruns *tot-run-count*)) ;;; (+ *num-runs* (length *allruns*)))) (set! *start-run-offset* val) (debug:print 3 "maxruns: " maxruns ", val: " val) (iup:attribute-set! obj "MAX" maxruns))) #:expand "YES" Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -355,23 +355,23 @@ ;; T E S T S ;;====================================================================== ;; states and statuses are lists, turn them into ("PASS","FAIL"...) and use NOT IN ;; i.e. these lists define what to NOT show. +;; states and statuses are required to be lists, empty is ok (define (db-get-tests-for-run db run-id testpatt itempatt states statuses) (let ((res '()) - (states-str (if (and states (not (null? states))) - (conc " AND state NOT IN ('" (string-intersperse states "','") "')") "")) - (statuses-str (if (and statuses (not (null? statuses))) - (conc " AND status NOT IN ('" (string-intersperse statuses "','") "')") ""))) + (states-str (conc "('" (string-intersperse states "','") "')")) + (statuses-str (conc "('" (string-intersperse statuses "','") "')")) + ) (sqlite3:for-each-row (lambda (id run-id testname state status event-time host cpuload diskfree uname rundir item-path run-duration final-logf comment first-err first-warn) (set! res (cons (vector id run-id testname state status event-time host cpuload diskfree uname rundir item-path run-duration final-logf comment first-err first-warn) res))) db (conc "SELECT id,run_id,testname,state,status,event_time,host,cpuload,diskfree,uname,rundir,item_path,run_duration,final_logf,comment,first_err,first_warn " - " FROM tests WHERE run_id=? AND testname like ? AND item_path LIKE ? " - states-str statuses-str + " FROM tests WHERE run_id=? AND testname like ? AND item_path LIKE ? " + " AND NOT (state in " states-str " AND status IN " statuses-str ") " " ORDER BY id DESC;") run-id (if testpatt testpatt "%") (if itempatt itempatt "%")) res)) @@ -674,11 +674,11 @@ ;; Tests (and all items) in waiton list must be "COMPLETED" and "PASS" (define (db-get-prereqs-not-met db run-id waiton) (if (null? waiton) '() (let* ((unmet-pre-reqs '()) - (tests (db-get-tests-for-run db run-id #f #f)) + (tests (db-get-tests-for-run db run-id #f #f '() '())) (result '())) (for-each (lambda (waitontest-name) (let ((ever-seen #f)) (for-each (lambda (test) (if (equal? waitontest-name (db:test-get-testname test)) Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -8,11 +8,11 @@ ;; PURPOSE. ;; (include "common.scm") ;; (include "megatest-version.scm") -(use sqlite3 srfi-1 posix regex regex-case srfi-69 base64) +(use sqlite3 srfi-1 posix regex regex-case srfi-69 base64 format) (import (prefix sqlite3 sqlite3:)) (import (prefix base64 base64:)) (declare (uses common)) (declare (uses megatest-version)) @@ -253,11 +253,11 @@ (db:get-value-by-header run header x)) keynames) "/") "/" (db:get-value-by-header run header "runname")) (let ((run-id (db:get-value-by-header run header "id"))) - (let ((tests (db-get-tests-for-run db run-id testpatt itempatt #f #f))) + (let ((tests (db-get-tests-for-run db run-id testpatt itempatt '() '()))) ;; Each test (for-each (lambda (test) (format #t " Test: ~25a State: ~15a Status: ~15a Runtime: ~5@as Time: ~22a Host: ~10a\n" Index: runs.scm ================================================================== --- runs.scm +++ runs.scm @@ -128,11 +128,11 @@ ;; if found then return that matching test record (debug:print 4 "selstr: " selstr ", qrystr: " qrystr ", keyvals: " keyvals ", previous run ids found: " prev-run-ids) (if (null? prev-run-ids) #f (let loop ((hed (car prev-run-ids)) (tal (cdr prev-run-ids))) - (let ((results (db-get-tests-for-run db hed test-name item-path #f #f))) + (let ((results (db-get-tests-for-run db hed test-name item-path '() '()))) (debug:print 4 "Got tests for run-id " run-id ", test-name " test-name ", item-path " item-path ": " results) (if (and (null? results) (not (null? tal))) (loop (car tal)(cdr tal)) (if (null? results) #f @@ -166,11 +166,11 @@ (debug:print 4 "selstr: " selstr ", qrystr: " qrystr ", keyvals: " keyvals ", previous run ids found: " prev-run-ids) (if (null? prev-run-ids) '() ;; no previous runs? return null (let loop ((hed (car prev-run-ids)) (tal (cdr prev-run-ids))) - (let ((results (db-get-tests-for-run db hed test-name item-path #f #f))) + (let ((results (db-get-tests-for-run db hed test-name item-path '() '()))) (debug:print 4 "Got tests for run-id " run-id ", test-name " test-name ", item-path " item-path " results: " (intersperse results "\n")) ;; Keep only the youngest of any test/item combination (for-each (lambda (testdat) @@ -750,11 +750,11 @@ (lambda (run) (let ((runkey (string-intersperse (map (lambda (k) (db:get-value-by-header run header (vector-ref k 0))) keys) "/")) (dirs-to-remove (make-hash-table))) (let* ((run-id (db:get-value-by-header run header "id") ) - (tests (db-get-tests-for-run db (db:get-value-by-header run header "id") testpatt itempatt #f #f)) + (tests (db-get-tests-for-run db (db:get-value-by-header run header "id") testpatt itempatt '() '())) (lasttpath "/does/not/exist/I/hope")) (if (not (null? tests)) (begin (debug:print 1 "Removing tests for run: " runkey " " (db:get-value-by-header run header "runname")) @@ -801,11 +801,11 @@ (hash-table-delete! dirs-to-remove dir-to-remove)) (debug:print 2 "Skipping removal of " dir-to-remove " for now as it still has references in the database"))))) (sort (hash-table-keys dirs-to-remove) (lambda (a b)(> (string-length a)(string-length b))))) ;; remove the run if zero tests remain - (let ((remtests (db-get-tests-for-run db (db:get-value-by-header run header "id") #f #f #f #f))) + (let ((remtests (db-get-tests-for-run db (db:get-value-by-header run header "id") #f #f '() '()))) (if (null? remtests) ;; no more tests remaining (let* ((dparts (string-split lasttpath "/")) (runpath (conc "/" (string-intersperse (take dparts (- (length dparts) 1)) "/")))) @@ -887,11 +887,11 @@ ;; This could probably be refactored into one complex query ... (define (runs:rollup-run db keys) (let* ((new-run-id (register-run db keys)) (prev-tests (test:get-matching-previous-test-run-records db new-run-id "%" "%")) - (curr-tests (db-get-tests-for-run db new-run-id "%" "%" #f #f)) + (curr-tests (db-get-tests-for-run db new-run-id "%" "%" '() '())) (curr-tests-hash (make-hash-table))) ;; index the already saved tests by testname and itempath in curr-tests-hash (for-each (lambda (testdat) (let* ((testname (db:test-get-testname testdat)) @@ -914,11 +914,11 @@ (apply sqlite3:execute db (conc "INSERT OR REPLACE INTO tests (run_id,testname,state,status,event_time,host,cpuload,diskfree,uname,rundir,item_path,run_duration,final_logf,comment,first_err,first_warn) " "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);") new-run-id (cddr (vector->list testdat))) - (set! new-testdat (car (db-get-tests-for-run db new-run-id testname item-path #f #f))) + (set! new-testdat (car (db-get-tests-for-run db new-run-id testname item-path '() '()))) (hash-table-set! curr-tests-hash full-name new-testdat) ;; this could be confusing, which record should go into the lookup table? ;; Now duplicate the test steps (debug:print 4 "Copying records in test_steps from test_id=" (db:test-get-id testdat) " to " (db:test-get-id new-testdat)) (sqlite3:execute db