1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
;;======================================================================
;; Copyright 2006-2013, Matthew Welland.
;;
;; This program is made available under the GNU GPL version 2.0 or
;; greater. See the accompanying file COPYING for details.
;;
;; This program is distributed WITHOUT ANY WARRANTY; without even the
;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;; PURPOSE.
;;======================================================================
(use format)
(require-library iup)
(import (prefix iup iup:))
(use canvas-draw)
(import canvas-draw-iup)
(use regex typed-records matchable)
(declare (unit dcommon))
(declare (uses megatest-version))
(declare (uses gutils))
(declare (uses db))
(declare (uses synchash))
(include "common_records.scm")
(include "db_records.scm")
(include "key_records.scm")
(include "run_records.scm")
;; yes, this is non-ideal
|
|
|
>
>
>
>
>
|
|
>
|
>
>
>
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
;;======================================================================
;; Copyright 2006-2013, Matthew Welland.
;;
;; This file is part of Megatest.
;;
;; Megatest is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; Megatest is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with Megatest. If not, see <http://www.gnu.org/licenses/>.
;;
;;======================================================================
(use format)
(require-library iup)
(import (prefix iup iup:))
(use canvas-draw)
(import canvas-draw-iup)
(use regex typed-records matchable)
(declare (unit dcommon))
(declare (uses megatest-version))
(declare (uses gutils))
(declare (uses db))
;; (declare (uses synchash))
(include "common_records.scm")
(include "db_records.scm")
(include "key_records.scm")
(include "run_records.scm")
;; yes, this is non-ideal
|
︙ | | | ︙ | |
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
|
;; 1. Make "data" hash-table hierarchial store of all displayed data
;; 2. Update synchash to understand "get-runs", "get-tests" etc.
;; 3. Add extraction of filters to synchash calls
;;
;; NOTE: Used in newdashboard
;;
;; Mode is 'full or 'incremental for full refresh or incremental refresh
(define (dcommon:run-update keys data runname keypatts testpatt states statuses mode window-id)
(let* (;; count and offset => #f so not used
;; the synchash calls modify the "data" hash
(changed #f)
(get-runs-sig (conc (client:get-signature) " get-runs"))
(get-tests-sig (conc (client:get-signature) " get-tests"))
(get-details-sig (conc (client:get-signature) " get-test-details"))
;; test-ids to get and display are indexed on window-id in curr-test-ids hash
(test-ids (hash-table-values (dboard:tabdat-curr-test-ids data)))
;; run-id is #f in next line to send the query to server 0
(run-changes (synchash:client-get 'db:get-runs get-runs-sig (length keypatts) data #f runname #f #f keypatts))
(tests-detail-changes (if (not (null? test-ids))
(synchash:client-get 'db:get-test-info-by-ids get-details-sig 0 data #f test-ids)
'()))
;; Now can calculate the run-ids
(run-hash (hash-table-ref/default data get-runs-sig #f))
(run-ids (if run-hash (filter number? (hash-table-keys run-hash)) '()))
(all-test-changes (let ((res (make-hash-table)))
(for-each (lambda (run-id)
(if (> run-id 0)
(hash-table-set! res run-id (synchash:client-get 'db:get-tests-for-run-mindata get-tests-sig 0 data run-id 1 testpatt states statuses #f))))
run-ids)
res))
(runs-hash (hash-table-ref/default data get-runs-sig #f))
(header (hash-table-ref/default runs-hash "header" #f))
(run-ids (sort (filter number? (hash-table-keys runs-hash))
(lambda (a b)
(let* ((record-a (hash-table-ref runs-hash a))
(record-b (hash-table-ref runs-hash b))
(time-a (db:get-value-by-header record-a header "event_time"))
(time-b (db:get-value-by-header record-b header "event_time")))
(> time-a time-b)))
))
(runid-to-col (hash-table-ref *cachedata* "runid-to-col"))
(testname-to-row (hash-table-ref *cachedata* "testname-to-row"))
(colnum 1)
(rownum 0)
(cellname (conc rownum ":" colnum))) ;; rownum = 0 is the header
;; (debug:print 0 *default-log-port* "test-ids " test-ids ", tests-detail-changes " tests-detail-changes)
;; tests related stuff
;; (all-testnames (delete-duplicates (map db:test-get-testname test-changes))))
;; Given a run-id and testname/item_path calculate a cell R:C
;; NOTE: Also build the test tree browser and look up table
;;
;; Each run is unique on its keys and runname or run-id, store in hash on colnum
(for-each (lambda (run-id)
(let* ((run-record (hash-table-ref/default runs-hash run-id #f))
(key-vals (map (lambda (key)(db:get-value-by-header run-record header key))
keys))
(run-name (db:get-value-by-header run-record header "runname"))
(col-name (conc (string-intersperse key-vals "\n") "\n" run-name))
(run-path (append key-vals (list run-name))))
(hash-table-set! (dboard:tabdat-run-keys data) run-id run-path)
;; modify cell - but only if changed
(set! changed (dcommon:modifiy-if-different (dboard:tabdat-runs-matrix data) cellname col-name changed))
(hash-table-set! runid-to-col run-id (list colnum run-record))
;; Here we update the tests treebox and tree keys
(tree:add-node (dboard:tabdat-tests-tree data) "Runs" (append key-vals (list run-name))
userdata: (conc "run-id: " run-id))
(set! colnum (+ colnum 1))))
run-ids)
;; Scan all tests to be displayed and organise all the test names, respecting what is in the hash table
;; Do this analysis in the order of the run-ids, the most recent run wins
(for-each (lambda (run-id)
(let* ((run-path (hash-table-ref (dboard:tabdat-run-keys data) run-id))
(test-changes (hash-table-ref all-test-changes run-id))
(new-test-dat (car test-changes))
(removed-tests (cadr test-changes))
(tests (sort (map cadr (filter (lambda (testrec)
(eq? run-id (db:mintest-get-run_id (cadr testrec))))
new-test-dat))
(lambda (a b)
(let ((time-a (db:mintest-get-event_time a))
(time-b (db:mintest-get-event_time b)))
(> time-a time-b)))))
;; test-changes is a list of (( id record ) ... )
;; Get list of test names sorted by time, remove tests
(test-names (delete-duplicates (map (lambda (t)
(let ((i (db:mintest-get-item_path t))
(n (db:mintest-get-testname t)))
(if (string=? i "")
(conc " " i)
n)))
tests)))
(colnum (car (hash-table-ref runid-to-col run-id))))
;; for each test name get the slot if it exists and fill in the cell
;; or take the next slot and fill in the cell, deal with items in the
;; run view panel? The run view panel can have a tree selector for
;; browsing the tests/items
;; SWITCH THIS TO USING CHANGED TESTS ONLY
(for-each (lambda (test)
(let* ((test-id (db:mintest-get-id test))
(state (db:mintest-get-state test))
(status (db:mintest-get-status test))
(testname (db:mintest-get-testname test))
(itempath (db:mintest-get-item_path test))
(fullname (conc testname "/" itempath))
(dispname (if (string=? itempath "") testname (conc " " itempath)))
(rownum (hash-table-ref/default testname-to-row fullname #f))
(test-path (append run-path (if (equal? itempath "")
(list testname)
(list testname itempath))))
(tb (dboard:tabdat-tests-tree data)))
(print "INFONOTE: run-path: " run-path)
(tree:add-node (dboard:tabdat-tests-tree data) "Runs"
test-path
userdata: (conc "test-id: " test-id))
(let ((node-num (tree:find-node tb (cons "Runs" test-path)))
(color (car (gutils:get-color-for-state-status state status))))
(debug:print 0 *default-log-port* "node-num: " node-num ", color: " color)
(set! changed (dcommon:modifiy-if-different
tb
(conc "COLOR" node-num)
color changed))
;; (iup:attribute-set! tb (conc "COLOR" node-num) color)
)
(hash-table-set! (dboard:tabdat-path-test-ids data) test-path test-id)
(if (not rownum)
(let ((rownums (hash-table-values testname-to-row)))
(set! rownum (if (null? rownums)
1
(+ 1 (common:max rownums))))
(hash-table-set! testname-to-row fullname rownum)
;; create the label
(set! changed (dcommon:modifiy-if-different
(dboard:tabdat-runs-matrix data)
(conc rownum ":" 0)
dispname
changed))
;; (iup:attribute-set! (dboard:tabdat-runs-matrix data)
;; (conc rownum ":" 0) dispname)
))
;; set the cell text and color
;; (debug:print 2 *default-log-port* "rownum:colnum=" rownum ":" colnum ", state=" status)
(set! changed (dcommon:modifiy-if-different
(dboard:tabdat-runs-matrix data)
(conc rownum ":" colnum)
(if (member state '("ARCHIVED" "COMPLETED"))
status
state)
changed))
;; (iup:attribute-set! (dboard:tabdat-runs-matrix data)
;; (conc rownum ":" colnum)
;; (if (member state '("ARCHIVED" "COMPLETED"))
;; status
;; state))
(set! changed (dcommon:modifiy-if-different
(dboard:tabdat-runs-matrix data)
(conc "BGCOLOR" rownum ":" colnum)
(car (gutils:get-color-for-state-status state status))
changed))
;; (iup:attribute-set! (dboard:tabdat-runs-matrix data)
;; (conc "BGCOLOR" rownum ":" colnum)
;; (car (gutils:get-color-for-state-status state status)))
))
tests)))
run-ids)
(let ((updater (hash-table-ref/default (dboard:commondat-updaters commondat) window-id #f)))
(if updater (updater (hash-table-ref/default data get-details-sig #f))))
(if changed (iup:attribute-set! (dboard:tabdat-runs-matrix data) "REDRAW" "ALL"))
;; (debug:print 2 *default-log-port* "run-changes: " run-changes)
;; (debug:print 2 *default-log-port* "test-changes: " test-changes)
(list run-changes all-test-changes)))
(define (dcommon:runsdat-get-col-num dat target runname force-set)
(let* ((runs-index (dboard:runsdat-runs-index dat))
(col-name (conc target "/" runname))
(res (hash-table-ref/default runs-index col-name #f)))
(if res
res
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
>
|
|
|
|
<
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
|
;; 1. Make "data" hash-table hierarchial store of all displayed data
;; 2. Update synchash to understand "get-runs", "get-tests" etc.
;; 3. Add extraction of filters to synchash calls
;;
;; NOTE: Used in newdashboard
;;
;; Mode is 'full or 'incremental for full refresh or incremental refresh
;; (define (dcommon:run-update keys data runname keypatts testpatt states statuses mode window-id)
;; (let* (;; count and offset => #f so not used
;; ;; the synchash calls modify the "data" hash
;; (changed #f)
;; (get-runs-sig (conc (client:get-signature) " get-runs"))
;; (get-tests-sig (conc (client:get-signature) " get-tests"))
;; (get-details-sig (conc (client:get-signature) " get-test-details"))
;;
;; ;; test-ids to get and display are indexed on window-id in curr-test-ids hash
;; (test-ids (hash-table-values (dboard:tabdat-curr-test-ids data)))
;; ;; run-id is #f in next line to send the query to server 0
;; (run-changes (synchash:client-get 'db:get-runs get-runs-sig (length keypatts) data #f runname #f #f keypatts))
;; (tests-detail-changes (if (not (null? test-ids))
;; (synchash:client-get 'db:get-test-info-by-ids get-details-sig 0 data #f test-ids)
;; '()))
;;
;; ;; Now can calculate the run-ids
;; (run-hash (hash-table-ref/default data get-runs-sig #f))
;; (run-ids (if run-hash (filter number? (hash-table-keys run-hash)) '()))
;;
;; (all-test-changes (let ((res (make-hash-table)))
;; (for-each (lambda (run-id)
;; (if (> run-id 0)
;; (hash-table-set! res run-id (synchash:client-get 'db:get-tests-for-run-mindata get-tests-sig 0 data run-id 1 testpatt states statuses #f))))
;; run-ids)
;; res))
;; (runs-hash (hash-table-ref/default data get-runs-sig #f))
;; (header (hash-table-ref/default runs-hash "header" #f))
;; (run-ids (sort (filter number? (hash-table-keys runs-hash))
;; (lambda (a b)
;; (let* ((record-a (hash-table-ref runs-hash a))
;; (record-b (hash-table-ref runs-hash b))
;; (time-a (db:get-value-by-header record-a header "event_time"))
;; (time-b (db:get-value-by-header record-b header "event_time")))
;; (> time-a time-b)))
;; ))
;; (runid-to-col (hash-table-ref *cachedata* "runid-to-col"))
;; (testname-to-row (hash-table-ref *cachedata* "testname-to-row"))
;; (colnum 1)
;; (rownum 0)
;; (cellname (conc rownum ":" colnum))) ;; rownum = 0 is the header
;; ;; (debug:print 0 *default-log-port* "test-ids " test-ids ", tests-detail-changes " tests-detail-changes)
;;
;; ;; tests related stuff
;; ;; (all-testnames (delete-duplicates (map db:test-get-testname test-changes))))
;;
;; ;; Given a run-id and testname/item_path calculate a cell R:C
;;
;; ;; NOTE: Also build the test tree browser and look up table
;; ;;
;; ;; Each run is unique on its keys and runname or run-id, store in hash on colnum
;; (for-each (lambda (run-id)
;; (let* ((run-record (hash-table-ref/default runs-hash run-id #f))
;; (key-vals (map (lambda (key)(db:get-value-by-header run-record header key))
;; keys))
;; (run-name (db:get-value-by-header run-record header "runname"))
;; (col-name (conc (string-intersperse key-vals "\n") "\n" run-name))
;; (run-path (append key-vals (list run-name))))
;; (hash-table-set! (dboard:tabdat-run-keys data) run-id run-path)
;; ;; modify cell - but only if changed
;; (set! changed (dcommon:modifiy-if-different (dboard:tabdat-runs-matrix data) cellname col-name changed))
;; (hash-table-set! runid-to-col run-id (list colnum run-record))
;; ;; Here we update the tests treebox and tree keys
;; (tree:add-node (dboard:tabdat-tests-tree data) "Runs" (append key-vals (list run-name))
;; userdata: (conc "run-id: " run-id))
;; (set! colnum (+ colnum 1))))
;; run-ids)
;;
;; ;; Scan all tests to be displayed and organise all the test names, respecting what is in the hash table
;; ;; Do this analysis in the order of the run-ids, the most recent run wins
;; (for-each (lambda (run-id)
;; (let* ((run-path (hash-table-ref (dboard:tabdat-run-keys data) run-id))
;; (test-changes (hash-table-ref all-test-changes run-id))
;; (new-test-dat (car test-changes))
;; (removed-tests (cadr test-changes))
;; (tests (sort (map cadr (filter (lambda (testrec)
;; (eq? run-id (db:mintest-get-run_id (cadr testrec))))
;; new-test-dat))
;; (lambda (a b)
;; (let ((time-a (db:mintest-get-event_time a))
;; (time-b (db:mintest-get-event_time b)))
;; (> time-a time-b)))))
;; ;; test-changes is a list of (( id record ) ... )
;; ;; Get list of test names sorted by time, remove tests
;; (test-names (delete-duplicates (map (lambda (t)
;; (let ((i (db:mintest-get-item_path t))
;; (n (db:mintest-get-testname t)))
;; (if (string=? i "")
;; (conc " " i)
;; n)))
;; tests)))
;; (colnum (car (hash-table-ref runid-to-col run-id))))
;; ;; for each test name get the slot if it exists and fill in the cell
;; ;; or take the next slot and fill in the cell, deal with items in the
;; ;; run view panel? The run view panel can have a tree selector for
;; ;; browsing the tests/items
;;
;; ;; SWITCH THIS TO USING CHANGED TESTS ONLY
;; (for-each (lambda (test)
;; (let* ((test-id (db:mintest-get-id test))
;; (state (db:mintest-get-state test))
;; (status (db:mintest-get-status test))
;; (testname (db:mintest-get-testname test))
;; (itempath (db:mintest-get-item_path test))
;; (fullname (conc testname "/" itempath))
;; (dispname (if (string=? itempath "") testname (conc " " itempath)))
;; (rownum (hash-table-ref/default testname-to-row fullname #f))
;; (test-path (append run-path (if (equal? itempath "")
;; (list testname)
;; (list testname itempath))))
;; (tb (dboard:tabdat-tests-tree data)))
;; (print "INFONOTE: run-path: " run-path)
;; (tree:add-node (dboard:tabdat-tests-tree data) "Runs"
;; test-path
;; userdata: (conc "test-id: " test-id))
;; (let ((node-num (tree:find-node tb (cons "Runs" test-path)))
;; (color (car (gutils:get-color-for-state-status state status))))
;; (debug:print 0 *default-log-port* "node-num: " node-num ", color: " color)
;;
;; (set! changed (dcommon:modifiy-if-different
;; tb
;; (conc "COLOR" node-num)
;; color changed))
;;
;; ;; (iup:attribute-set! tb (conc "COLOR" node-num) color)
;; )
;; (hash-table-set! (dboard:tabdat-path-test-ids data) test-path test-id)
;; (if (not rownum)
;; (let ((rownums (hash-table-values testname-to-row)))
;; (set! rownum (if (null? rownums)
;; 1
;; (+ 1 (common:max rownums))))
;; (hash-table-set! testname-to-row fullname rownum)
;; ;; create the label
;; (set! changed (dcommon:modifiy-if-different
;; (dboard:tabdat-runs-matrix data)
;; (conc rownum ":" 0)
;; dispname
;; changed))
;; ;; (iup:attribute-set! (dboard:tabdat-runs-matrix data)
;; ;; (conc rownum ":" 0) dispname)
;; ))
;; ;; set the cell text and color
;; ;; (debug:print 2 *default-log-port* "rownum:colnum=" rownum ":" colnum ", state=" status)
;; (set! changed (dcommon:modifiy-if-different
;; (dboard:tabdat-runs-matrix data)
;; (conc rownum ":" colnum)
;; (if (member state '("ARCHIVED" "COMPLETED"))
;; status
;; state)
;; changed))
;; ;; (iup:attribute-set! (dboard:tabdat-runs-matrix data)
;; ;; (conc rownum ":" colnum)
;; ;; (if (member state '("ARCHIVED" "COMPLETED"))
;; ;; status
;; ;; state))
;; (set! changed (dcommon:modifiy-if-different
;; (dboard:tabdat-runs-matrix data)
;; (conc "BGCOLOR" rownum ":" colnum)
;; (car (gutils:get-color-for-state-status state status))
;; changed))
;; ;; (iup:attribute-set! (dboard:tabdat-runs-matrix data)
;; ;; (conc "BGCOLOR" rownum ":" colnum)
;; ;; (car (gutils:get-color-for-state-status state status)))
;; ))
;; tests)))
;; run-ids)
;;
;; (let ((updater (hash-table-ref/default (dboard:commondat-updaters commondat) window-id #f)))
;; (if updater (updater (hash-table-ref/default data get-details-sig #f))))
;;
;; (if changed (iup:attribute-set! (dboard:tabdat-runs-matrix data) "REDRAW" "ALL"))
;; ;; (debug:print 2 *default-log-port* "run-changes: " run-changes)
;; ;; (debug:print 2 *default-log-port* "test-changes: " test-changes)
;; (list run-changes all-test-changes)))
(define (dcommon:runsdat-get-col-num dat target runname force-set)
(let* ((runs-index (dboard:runsdat-runs-index dat))
(col-name (conc target "/" runname))
(res (hash-table-ref/default runs-index col-name #f)))
(if res
res
|
︙ | | | ︙ | |
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
|
(tal (cdr tests-dat))
(res '()))
(let* ((test-id (db:test-get-id hed)) ;; look at the tests-dat spec for locations
(test-name (db:test-get-testname hed))
(item-path (db:test-get-item-path hed))
(state (db:test-get-state hed))
(status (db:test-get-status hed))
(newitem (list test-name item-path (list test-id state status))))
(if (null? tal)
(reverse (cons newitem res))
(loop (car tal)(cdr tal)(cons newitem res)))))))
(define (dcommon: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)))
tests-mindat)
res))
;; return 1 if status1 is better
;; return 0 if status1 and 2 are equally good
;; return -1 if status2 is better
(define (dcommon:status-compare3 status1 status2)
(let*
((status-goodness-ranking (list "PASS" "WARN" "WAIVED" "SKIP" "FAIL" "ABORT" #f))
(mem1 (member status1 status-goodness-ranking))
(mem2 (member status2 status-goodness-ranking))
)
(cond
((and (not mem1) (not mem2)) 0)
((not mem1) -1)
((not mem2) 1)
|
>
|
|
>
>
>
|
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
|
(tal (cdr tests-dat))
(res '()))
(let* ((test-id (db:test-get-id hed)) ;; look at the tests-dat spec for locations
(test-name (db:test-get-testname hed))
(item-path (db:test-get-item-path hed))
(state (db:test-get-state hed))
(status (db:test-get-status hed))
(event-time (db:test-get-event_time hed))
(newitem (list test-name item-path (list test-id state status event-time))))
(if (null? tal)
(reverse (cons newitem res))
(loop (car tal)(cdr tal)(cons newitem res)))))))
(define (dcommon: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)))
tests-mindat)
res))
;; return 1 if status1 is better
;; return 0 if status1 and 2 are equally good
;; return -1 if status2 is better
(define (dcommon:status-compare3 status1 status2)
(let*
((status-goodness-ranking (cdr ;; cdr to drop first item -- "n/a"
(append (map cadr *common:std-statuses*)
'(#f)) ;; algorithm requres last item to be #f
) )
(mem1 (member status1 status-goodness-ranking))
(mem2 (member status2 status-goodness-ranking))
)
(cond
((and (not mem1) (not mem2)) 0)
((not mem1) -1)
((not mem2) 1)
|
︙ | | | ︙ | |
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
|
;; Section to table
(define (dcommon:section-matrix rawconfig sectionname varcolname valcolname #!key (title #f))
(let* ((curr-row-num 1)
(key-vals (configf:section-vars rawconfig sectionname))
(section-matrix (iup:matrix
#:alignment1 "ALEFT"
#:expand "YES" ;; "HORIZONTAL"
#:numcol 1
#:numlin (length key-vals)
#:numcol-visible 1
#:numlin-visible (min 10 (length key-vals))
#:scrollbar "YES")))
(iup:attribute-set! section-matrix "0:0" varcolname)
(iup:attribute-set! section-matrix "0:1" valcolname)
|
|
|
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
|
;; Section to table
(define (dcommon:section-matrix rawconfig sectionname varcolname valcolname #!key (title #f))
(let* ((curr-row-num 1)
(key-vals (configf:section-vars rawconfig sectionname))
(section-matrix (iup:matrix
#:alignment1 "ALEFT"
;; #:expand "YES" ;; "HORIZONTAL"
#:numcol 1
#:numlin (length key-vals)
#:numcol-visible 1
#:numlin-visible (min 10 (length key-vals))
#:scrollbar "YES")))
(iup:attribute-set! section-matrix "0:0" varcolname)
(iup:attribute-set! section-matrix "0:1" valcolname)
|
︙ | | | ︙ | |
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
|
(let ((il (cddddr inlst)))
(take il (- (length il) 2))))
(lambda (x y)
(list (+ x 0) ;; xtorig)
(+ y 0))) ;; ytorig)))
#f #f)) ;; process polyline
edges))))
(llx (if no-dot
curr-x
(string->number (list-ref nodedat 2))))
(lly (if no-dot
curr-y
(string->number (list-ref nodedat 3))))
(boxw (if no-dot
boxw
(string->number (list-ref nodedat 4))))
(boxh (if no-dot
boxh
(string->number (list-ref nodedat 5))))
(urx (+ llx boxw))
(ury (+ lly boxh)))
;; if we are in no-dot mode then increment curr-x and curr-y as needed
(if no-dot
(begin
(cond
((< curr-x (- scaled-sizex boxw boxw margin))
(set! curr-x (+ curr-x boxw margin)))
|
|
|
>
>
|
|
>
>
|
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
|
(let ((il (cddddr inlst)))
(take il (- (length il) 2))))
(lambda (x y)
(list (+ x 0) ;; xtorig)
(+ y 0))) ;; ytorig)))
#f #f)) ;; process polyline
edges))))
(cx (if no-dot ;; this is the centerpoint!
curr-x
(string->number (list-ref nodedat 2))))
(cy (if no-dot
curr-y
(string->number (list-ref nodedat 3))))
(boxw (if no-dot
boxw
(string->number (list-ref nodedat 4))))
(boxh (if no-dot
boxh
(string->number (list-ref nodedat 5))))
(boxw/2 (/ boxw 2))
(boxh/2 (/ boxh 2))
(urx (+ cx boxw/2))
(ury (+ cy boxh/2))
(llx (- cx boxw/2))
(lly (- cy boxh/2)))
;; if we are in no-dot mode then increment curr-x and curr-y as needed
(if no-dot
(begin
(cond
((< curr-x (- scaled-sizex boxw boxw margin))
(set! curr-x (+ curr-x boxw margin)))
|
︙ | | | ︙ | |
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
|
;; #:title "Target"
;; ;; Target selectors
;; (apply iup:hbox
;; (let* ((dat (dashboard:update-target-selector tabdat action-proc: update-keyvals))
;; (key-lb (car dat))
;; (combos (cadr dat)))
;; combos)))
(iup:hbox
;; Text box for STATES
(iup:frame
#:title "States"
(dashboard:text-list-toggle-box
;; Move these definitions to common and find the other useages and replace!
(map cadr *common:std-states*) ;; '("COMPLETED" "RUNNING" "STUCK" "INCOMPLETE" "LAUNCHED" "REMOTEHOSTSTART" "KILLED")
(lambda (all)
(dboard:tabdat-states-set! tabdat all)
(dashboard:update-run-command tabdat))))
;; Text box for STATES
(iup:frame
#:title "Statuses"
(dashboard:text-list-toggle-box
(map cadr *common:std-statuses*) ;; '("PASS" "FAIL" "n/a" "CHECK" "WAIVED" "SKIP" "DELETED" "STUCK/DEAD")
(lambda (all)
(dboard:tabdat-statuses-set! tabdat all)
(dashboard:update-run-command tabdat)))))))
(define (dcommon:command-tests-tasks-canvas tabdat test-records sorted-testnames tests-draw-state)
(iup:frame
#:title "Tests and Tasks"
(let* ((updater #f)
(last-xadj 0)
(last-yadj 0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
|
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
|
;; #:title "Target"
;; ;; Target selectors
;; (apply iup:hbox
;; (let* ((dat (dashboard:update-target-selector tabdat action-proc: update-keyvals))
;; (key-lb (car dat))
;; (combos (cadr dat)))
;; combos)))
;; (iup:hbox
;; ;; Text box for STATES
;; (iup:frame
;; #:title "States"
;; (dashboard:text-list-toggle-box
;; ;; Move these definitions to common and find the other useages and replace!
;; (map cadr *common:std-states*) ;; '("COMPLETED" "RUNNING" "STUCK" "INCOMPLETE" "LAUNCHED" "REMOTEHOSTSTART" "KILLED")
;; (lambda (all)
;; (dboard:tabdat-states-set! tabdat all)
;; (dashboard:update-run-command tabdat))))
;; ;; Text box for STATES
;; (iup:frame
;; #:title "Statuses"
;; (dashboard:text-list-toggle-box
;; (map cadr *common:std-statuses*) ;; '("PASS" "FAIL" "n/a" "CHECK" "WAIVED" "SKIP" "DELETED" "STUCK/DEAD")
;; (lambda (all)
;; (dboard:tabdat-statuses-set! tabdat all)
;; (dashboard:update-run-command tabdat)))))
))
(define (dcommon:command-tests-tasks-canvas tabdat test-records sorted-testnames tests-draw-state)
(iup:frame
#:title "Tests and Tasks"
(let* ((updater #f)
(last-xadj 0)
(last-yadj 0)
|
︙ | | | ︙ | |
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
|
(hash-table-set! tests-draw-state 'scalef (+ scalef
(if (> step 0)
(* scalef 0.01)
(* scalef -0.01))))
(if the-cnv
(dashboard:draw-tests the-cnv last-xadj last-yadj tests-draw-state sorted-testnames test-records))
))
;; #:size "50x50"
#:expand "YES"
#:scrollbar "YES"
#:posx "0.5"
#:posy "0.5"
#:button-cb (lambda (obj btn pressed x y status)
;; (print "obj: " obj ", pressed " pressed ", status " status)
; (print "canvas-origin: " (canvas-origin the-cnv))
|
|
|
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
|
(hash-table-set! tests-draw-state 'scalef (+ scalef
(if (> step 0)
(* scalef 0.01)
(* scalef -0.01))))
(if the-cnv
(dashboard:draw-tests the-cnv last-xadj last-yadj tests-draw-state sorted-testnames test-records))
))
;; #:size "250x250"
#:expand "YES"
#:scrollbar "YES"
#:posx "0.5"
#:posy "0.5"
#:button-cb (lambda (obj btn pressed x y status)
;; (print "obj: " obj ", pressed " pressed ", status " status)
; (print "canvas-origin: " (canvas-origin the-cnv))
|
︙ | | | ︙ | |
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
|
canvas-obj)))
;;======================================================================
;; S T E P S
;;======================================================================
(define (dcommon:populate-steps teststeps steps-matrix)
(let ((max-row 0)
(max-col 7))
(if (null? teststeps)
(iup:attribute-set! steps-matrix "CLEARVALUE" "CONTENTS")
(let loop ((hed (car teststeps))
(tal (cdr teststeps))
(rownum 1)
(colnum 1))
(if (> rownum max-row)(set! max-row rownum))
(let ((val (vector-ref hed (- colnum 1)))
(mtrx-rc (conc rownum ":" colnum)))
(iup:attribute-set! steps-matrix mtrx-rc (if val (conc val) ""))
(if (< colnum max-col)
(loop hed tal rownum (+ colnum 1))
(if (not (null? tal))
(loop (car tal)(cdr tal)(+ rownum 1) 1))))))
(if (> max-row 0)
(begin
;; we are going to speculatively clear rows until we find a row that is already cleared
(let loop ((rownum (+ max-row 1))
(colnum 0)
(deleted #f))
;; (debug:print-info 0 *default-log-port* "cleaning " rownum ":" colnum)
|
|
|
>
>
>
>
|
>
>
>
>
>
>
|
>
>
>
|
|
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
|
canvas-obj)))
;;======================================================================
;; S T E P S
;;======================================================================
(define (dcommon:populate-steps teststeps steps-matrix)
(let ((max-row 0)
(max-col 9)
(white "255 255 255")
(running-color (car (gutils:get-color-for-state-status "RUNNING" "STARTED")))
(failcolor (car (gutils:get-color-for-state-status "COMPLETED" "FAIL"))))
(if (null? teststeps)
(iup:attribute-set! steps-matrix "CLEARVALUE" "CONTENTS")
(let loop ((hed (car teststeps))
(tal (cdr teststeps))
(rownum 1)
(colnum 1))
(if (> rownum max-row)(set! max-row rownum))
(let* ((status (vector-ref hed 3))
(val (vector-ref hed (- colnum 1)))
(bgcolor (cond
((member (conc status) '("" "-" "#<unspecified>"))
running-color)
((member (conc status) '("0" 0))
white)
(else failcolor)))
(mtrx-rc (conc rownum ":" colnum)))
;;(print "BB> status=>"status"< bgcolor="bgcolor)
(iup:attribute-set! steps-matrix mtrx-rc (if val (conc val) ""))
(if (< colnum 5)
(iup:attribute-set! steps-matrix (conc "BGCOLOR" mtrx-rc) bgcolor))
(if (< colnum max-col)
(loop hed tal rownum (+ colnum 1))
(if (not (null? tal))
(loop (car tal) (cdr tal) (+ rownum 1) 1))))))
(if (> max-row 0)
(begin
;; we are going to speculatively clear rows until we find a row that is already cleared
(let loop ((rownum (+ max-row 1))
(colnum 0)
(deleted #f))
;; (debug:print-info 0 *default-log-port* "cleaning " rownum ":" colnum)
|
︙ | | | ︙ | |