Megatest

Diff
Login

Differences From Artifact [015515b8a1]:

To Artifact [35c75741ff]:


108
109
110
111
112
113
114
115

116
117
118
119

120
121
122
123
124
125
126
108
109
110
111
112
113
114

115
116
117
118

119
120
121
122
123
124
125
126







-
+



-
+







			   ;; this test is younger, store it in the hash
			   (hash-table-set! tests-hash full-testname testdat))))
		   results)
		  (if (null? tal)
		      (map cdr (hash-table->alist tests-hash)) ;; return a list of the most recent tests
		      (loop (car tal)(cdr tal))))))))))

;; 
;; Do not rpc this one, do the underlying calls!!!
(define (tests:test-set-status! db test-id state status comment dat)
  (let* ((real-status status)
	 (otherdat    (if dat dat (make-hash-table)))
	 (testdat     (db:get-test-info-by-id db test-id))
	 (testdat     (open-run-close db:get-test-info-by-id db test-id))
	 (run-id      (db:test-get-run_id testdat))
	 (test-name   (db:test-get-testname   testdat))
	 (item-path   (db:test-get-item-path testdat))
	 ;; before proceeding we must find out if the previous test (where all keys matched except runname)
	 ;; was WAIVED if this test is FAIL
	 (waived   (if (equal? status "FAIL")
		       (let ((prev-test (test:get-previous-test-run-record db run-id test-name item-path)))
136
137
138
139
140
141
142

143
144


145
146
147
148

149
150
151
152
153
154
155
136
137
138
139
140
141
142
143


144
145
146
147
148

149
150
151
152
153
154
155
156







+
-
-
+
+



-
+







			     #f))
		       #f)))
    (if waived (set! real-status "WAIVED"))
    (debug:print 4 "real-status " real-status ", waived " waived ", status " status)

    ;; update the primary record IF state AND status are defined
    (if (and state status)
	;; (rdb:open-run-close 'cdb:test-set-state-status #f test-id real-status state)) ;; this one works
	(db:test-set-state-status-by-run-id-testname db run-id test-name item-path real-status state))

	(cdb:test-set-state-status test-id real-status state))
    
    ;; if status is "AUTO" then call rollup (note, this one modifies data in test
    ;; run area, do not rpc it (yet)
    (if (and test-id state status (equal? status "AUTO")) 
	(db:test-data-rollup db test-id status))
	(open-run-close db:test-data-rollup db test-id status))

    ;; add metadata (need to do this way to avoid SQL injection issues)

    ;; :first_err
    ;; (let ((val (hash-table-ref/default otherdat ":first_err" #f)))
    ;;   (if val
    ;;       (sqlite3:execute db "UPDATE tests SET first_err=? WHERE run_id=? AND testname=? AND item_path=?;" val run-id test-name item-path)))
175
176
177
178
179
180
181
182

183
184
185
186

187
188
189
190
191
192

193
194
195
196
197
198
199
176
177
178
179
180
181
182

183
184
185
186

187
188
189
190
191
192

193
194
195
196
197
198
199
200







-
+



-
+





-
+







			   variable ","
			   value    ","
			   expected ","
			   tol      ","
			   units    ","
			   dcomment ",," ;; extra comma for status
			   type     )))
	    (db:csv->test-data db test-id
	    (open-run-close db:csv->test-data db test-id
				dat))))
      
    ;; need to update the top test record if PASS or FAIL and this is a subtest
    (db:roll-up-pass-fail-counts db run-id test-name item-path status)
    (open-run-close db:roll-up-pass-fail-counts db run-id test-name item-path status)

    (if (or (and (string? comment)
		 (string-match (regexp "\\S+") comment))
	    waived)
	(let ((cmt  (if waived waived comment)))
	  (db:test-set-comment db test-id cmt)))
	  (open-run-close db:test-set-comment db test-id cmt)))
    ))

(define (tests:test-set-toplog! db run-id test-name logf) 
  (sqlite3:execute db "UPDATE tests SET final_logf=? WHERE run_id=? AND testname=? AND item_path='';" 
		   logf run-id test-name))

(define (tests:summarize-items db run-id test-name force)