11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
-
+
|
;; #;; (rmt:get-test-info-by-id run-id test-id)
;; #;; (rmt:get-tests-for-run run-id testpatt states statuses offset limit not-in sort-by sort-order qryvals last-update mode)
;; megatest -repl << EOF
;; TODO:dashboard not on homehost message exit
(use matchable)
(define (tests-mindat->hash tests-mindat)
(let* ((res (make-hash-table)))
(for-each
(lambda (item)
(let* ((test-name+item-path (cons (list-ref item 0) (list-ref item 1)))
(value (list-ref item 2)))
(hash-table-set! res test-name+item-path value)))
|
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
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
200
201
202
|
-
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
+
-
-
-
+
+
-
-
+
-
-
-
+
+
-
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
-
-
+
-
+
+
+
+
|
)))
(list test-name item-path xor-new-item)))
all-keys)))
(if hide-clean
(filter
(lambda (item)
;;(print item)
(not
(equal?
"CLEAN"
(list-ref (list-ref item 2) 1))))
res)
res))))
(define (run-name->run-id runname)
(if (number? runname)
runname
(let* ((qry-res (rmt:get-runs runname 1 0 '())))
(if (eq? 2 (vector-length qry-res))
(vector-ref (car (vector-ref qry-res 1)) 1)
#f)))
(let* ((qry-res (rmt:get-runs runname 1 0 '())))
(if (eq? 2 (vector-length qry-res))
(vector-ref (car (vector-ref qry-res 1)) 1)
#f))))
(define (run-name->tests-mindat runname)
(let* ((run-id (run-name->run-id runname))
(testpatt "%/%")
;; (states '("COMPLETED" "INCOMPLETE"))
;; (statuses '("PASS" "FAIL" "ABORT" "SKIP"))
(states '())
(statuses '())
(offset #f)
(limit #f)
(not-in #t)
(sort-by #f)
(sort-order #f)
(qryvals "id,testname,item_path,state,status")
(qryvals "id,testname,item_path,state,status")
(last-update 0)
(mode #f)
)
(print run-id)
(map
;; (lambda (row)
;; (match row
;; ((#(id test-name item-path state status)
;; (list test-name item-path (list id state status))))
;; (else #f)))
(lambda (row)
(let* ((id (vector-ref row 0))
(test-name (vector-ref row 1))
(item-path (vector-ref row 2))
(state (vector-ref row 3))
(status (vector-ref row 4)))
;;(hash-table-set! ht (cons testname item_path) (list id state status))
(list test-name item-path (list id state status))
;;(print testname id))
(list test-name item-path (list id state status))))
))
(rmt:get-tests-for-run run-id
testpatt states statuses
offset limit
not-in sort-by sort-order
qryvals
last-update
mode))
mode))))
;(print (rmt:get-tests-for-run run-id testpatt states statuses offset limit not-in "%" "%" #f "id,testname,testpath,state,status" 0 'normal))
;(print run-id)
))
(define (diff-runs run1 run2)
(let* ((src-tests-mindat (run-name->tests-mindat run1))
(print (run-name->tests-mindat "all60"))
(dest-tests-mindat (run-name->tests-mindat run2)))
(xor-tests-mindat src-tests-mindat dest-tests-mindat)));; #!key (hide-c
(define (rundiff-find-by-state run-diff state)
(filter
(lambda (x)
(equal? (list-ref (caddr x) 1) state))
run-diff))
(let* ((src-tests-mindat (run-name->tests-mindat "all57"))
(dest-tests-mindat (run-name->tests-mindat "all60")))
(print (xor-tests-mindat src-tests-mindat dest-tests-mindat)));; #!key (hide-clean #f))
(define (summarize-run-diff run-diff)
(let* ((diff-states (list "CLEAN" "DIRTY-BETTER" "DIRTY-WORSE" "BOTH-BAD" "DIFF-MISSING" "DIFF-NEW" )))
(for-each
(lambda (state)
(print "state="state "; "
(length (rundiff-find-by-state run-diff state))))
diff-states)))
;;(exit)
;;EOF
(let* ((run-diff (diff-runs "all57" "all60"))
(diff-summary (summarize-run-diff run-diff)))
(pretty-print diff-summary))
;; (match de ( (test-name test-path ( test-id "BOTH-BAD" test-status)) test-path) (else #f))
|