Megatest

Diff
Login

Differences From Artifact [da1307725b]:

To Artifact [1a94c53bbb]:


1215
1216
1217
1218
1219
1220
1221
1222

1223
1224
1225
1226
1227
1228
1229
1230
1231
1232

1233
1234
1235
1236
1237
1238
1239
;;
(define (db:get-count-test-items-running db run-id testname)
  (let ((res 0))
    (sqlite3:for-each-row
     (lambda (count)
       (set! res count))
     db
     "SELECT count(id) FROM tests WHERE state in ('RUNNING','NOT_STARTED','LAUNCHED','REMOTEHOSTSTART') AND run_id=? AND testname=? AND item_path !='';")

    res))

;; For an itemized test get the count of items matching status
(define (db:get-count-test-items-matching-status db run-id testname status)
  (let ((res 0))
    (sqlite3:for-each-row
     (lambda (count)
       (set! res count))
     db
     "SELECT count(id) FROM tests WHERE status=? AND run_id=? AND testname=? AND item_path !='';")

    res))

(define (db:get-running-stats db)
  (let ((res '()))
    (sqlite3:for-each-row
     (lambda (state count)
       (set! res (cons (list state count) res)))







|
>









|
>







1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
;;
(define (db:get-count-test-items-running db run-id testname)
  (let ((res 0))
    (sqlite3:for-each-row
     (lambda (count)
       (set! res count))
     db
     "SELECT count(id) FROM tests WHERE state in ('RUNNING','NOT_STARTED','LAUNCHED','REMOTEHOSTSTART') AND run_id=? AND testname=? AND item_path !='';"
     run-id testname)
    res))

;; For an itemized test get the count of items matching status
(define (db:get-count-test-items-matching-status db run-id testname status)
  (let ((res 0))
    (sqlite3:for-each-row
     (lambda (count)
       (set! res count))
     db
     "SELECT count(id) FROM tests WHERE status=? AND run_id=? AND testname=? AND item_path !='';"
     status run-id testname)
    res))

(define (db:get-running-stats db)
  (let ((res '()))
    (sqlite3:for-each-row
     (lambda (state count)
       (set! res (cons (list state count) res)))
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
(define (cdb:test-set-status-state serverdat test-id status state msg)
  (if (member state '("LAUNCHED" "REMOTEHOSTSTART"))
      (cdb:client-call serverdat 'set-test-start-time #t *default-numtries* test-id))
  (if msg
      (cdb:client-call serverdat 'state-status-msg #t *default-numtries* state status msg test-id)
      (cdb:client-call serverdat 'state-status #t *default-numtries* state status test-id))) ;; run-id test-name item-path minutes cpuload diskfree tmpfree) 

(define (cdb:test-set-state-status-by-name serverdat state status testname item-path)
  (cdb:client-call serverdat 'state-status-by-name state status testname item-path))

(define (cdb:test-rollup-test_data-pass-fail serverdat test-id)
  (cdb:client-call serverdat 'test_data-pf-rollup #t *default-numtries* test-id test-id test-id test-id))

(define (cdb:pass-fail-counts serverdat test-id fail-count pass-count)
  (cdb:client-call serverdat 'pass-fail-counts #t *default-numtries* fail-count pass-count test-id))








|
|







1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
(define (cdb:test-set-status-state serverdat test-id status state msg)
  (if (member state '("LAUNCHED" "REMOTEHOSTSTART"))
      (cdb:client-call serverdat 'set-test-start-time #t *default-numtries* test-id))
  (if msg
      (cdb:client-call serverdat 'state-status-msg #t *default-numtries* state status msg test-id)
      (cdb:client-call serverdat 'state-status #t *default-numtries* state status test-id))) ;; run-id test-name item-path minutes cpuload diskfree tmpfree) 

(define (cdb:test-set-state-status-by-name serverdat state status run-id testname item-path)
  (cdb:client-call serverdat 'state-status-by-name #t *default-numtries* state status run-id testname item-path))

(define (cdb:test-rollup-test_data-pass-fail serverdat test-id)
  (cdb:client-call serverdat 'test_data-pf-rollup #t *default-numtries* test-id test-id test-id test-id))

(define (cdb:pass-fail-counts serverdat test-id fail-count pass-count)
  (cdb:client-call serverdat 'pass-fail-counts #t *default-numtries* fail-count pass-count test-id))

1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724

(define db:queries 
  (list '(register-test          "INSERT OR IGNORE INTO tests (run_id,testname,event_time,item_path,state,status) VALUES (?,?,strftime('%s','now'),?,'NOT_STARTED','n/a');")
	;; Test state and status
	'(set-test-state         "UPDATE tests SET state=?   WHERE id=?;")
	'(set-test-status        "UPDATE tests SET state=?   WHERE id=?;")
	'(state-status           "UPDATE tests SET state=?,status=? WHERE id=?;")
	'(state-status-by-name   "UPDATE tests SET state=?,status=? WHERE testname=? AND item_path=?;")
	'(state-status-msg       "UPDATE tests SET state=?,status=?,comment=? WHERE id=?;")
	;; Test comment
	'(set-test-comment       "UPDATE tests SET comment=? WHERE id=?;")
	'(set-test-start-time    "UPDATE tests SET event_time=strftime('%s','now') WHERE id=?;")
	'(pass-fail-counts       "UPDATE tests SET fail_count=?,pass_count=? WHERE id=?;")

	;; test_data-pf-rollup is used to set a tests PASS/FAIL based on the pass/fail info from the steps







|







1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726

(define db:queries 
  (list '(register-test          "INSERT OR IGNORE INTO tests (run_id,testname,event_time,item_path,state,status) VALUES (?,?,strftime('%s','now'),?,'NOT_STARTED','n/a');")
	;; Test state and status
	'(set-test-state         "UPDATE tests SET state=?   WHERE id=?;")
	'(set-test-status        "UPDATE tests SET state=?   WHERE id=?;")
	'(state-status           "UPDATE tests SET state=?,status=? WHERE id=?;")
	'(state-status-by-name   "UPDATE tests SET state=?,status=? WHERE run_id=? AND testname=? AND item_path=?;")
	'(state-status-msg       "UPDATE tests SET state=?,status=?,comment=? WHERE id=?;")
	;; Test comment
	'(set-test-comment       "UPDATE tests SET comment=? WHERE id=?;")
	'(set-test-start-time    "UPDATE tests SET event_time=strftime('%s','now') WHERE id=?;")
	'(pass-fail-counts       "UPDATE tests SET fail_count=?,pass_count=? WHERE id=?;")

	;; test_data-pf-rollup is used to set a tests PASS/FAIL based on the pass/fail info from the steps
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166

(define (db:test-get-id-state-status-pass-fail-count db testname item-path)
  (let ((res #f))
    ;; First get the pass count
    (sqlite3:for-each-row
     (lambda (id state status pcount fcount)
       ;;          0   1      2      3     4      5
       (set! res (id vector state status pcount fcount)))
     db
     "SELECT id,state,status,pass_count,fail_count FROM tests WHERE testname=? AND item_path=?;" 
     testname item-path)
    res))

(define (db:test-get-testname-item_patt-state-status-pass-fail-count db test-id)
  (let ((res #f))
    ;; First get the pass count
    (sqlite3:for-each-row
     (lambda (testname item-path state status pcount fcount)
       (set! res (testname item-path vector state status pcount fcount)))
     db
     "SELECT testname,item_path,state,status,pass_count,fail_count FROM tests WHERE id=?;" 
     test-id)
    res))

;; This is NON-ACID compliant, does it matter?
;;







|










|







2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168

(define (db:test-get-id-state-status-pass-fail-count db testname item-path)
  (let ((res #f))
    ;; First get the pass count
    (sqlite3:for-each-row
     (lambda (id state status pcount fcount)
       ;;          0   1      2      3     4      5
       (set! res (vector id state status pcount fcount)))
     db
     "SELECT id,state,status,pass_count,fail_count FROM tests WHERE testname=? AND item_path=?;" 
     testname item-path)
    res))

(define (db:test-get-testname-item_patt-state-status-pass-fail-count db test-id)
  (let ((res #f))
    ;; First get the pass count
    (sqlite3:for-each-row
     (lambda (testname item-path state status pcount fcount)
       (set! res (vector testname item-path vector state status pcount fcount)))
     db
     "SELECT testname,item_path,state,status,pass_count,fail_count FROM tests WHERE id=?;" 
     test-id)
    res))

;; This is NON-ACID compliant, does it matter?
;;