Megatest

Check-in [48f16932ad]
Login
Overview
Comment:Added collapse/expand for itemized tests and completed alternative sort methods
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.55
Files: files | file ages | folders
SHA1: 48f16932ad0af60da9187e508dfa79b8ba3579eb
User & Date: mrwellan on 2013-08-19 15:42:22
Other Links: branch diff | manifest | tags
Context
2013-08-19
15:58
Added collapse/expand for itemized tests and completed alternative sort methods check-in: b50d150110 user: mrwellan tags: v1.55
15:42
Added collapse/expand for itemized tests and completed alternative sort methods check-in: 48f16932ad user: mrwellan tags: v1.55
14:20
Added REMOTEHOSTSTART and LAUNCHED to SKIP critera as analogs to RUNNING check-in: 70f2768e25 user: mrwellan tags: v1.55
Changes

Modified dashboard.scm from [1cd65f8047] to [ff304606c8].

126
127
128
129
130
131
132

133
134
135
136
137
138
139
(define *last-update*   (current-seconds))
(define *last-db-update-time* 0)
(define *please-update-buttons* #t)
(define *delayed-update* 0)
(define *update-is-running* #f)
(define *update-mutex* (make-mutex))


(define *num-tests*     15)
(define *start-run-offset*  0)
(define *start-test-offset* 0)
(define *examine-test-dat* (make-hash-table))
(define *exit-started* #f)
(define *status-ignore-hash* (make-hash-table))
(define *state-ignore-hash*  (make-hash-table))







>







126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
(define *last-update*   (current-seconds))
(define *last-db-update-time* 0)
(define *please-update-buttons* #t)
(define *delayed-update* 0)
(define *update-is-running* #f)
(define *update-mutex* (make-mutex))

(define *all-item-test-names* '())
(define *num-tests*     15)
(define *start-run-offset*  0)
(define *start-test-offset* 0)
(define *examine-test-dat* (make-hash-table))
(define *exit-started* #f)
(define *status-ignore-hash* (make-hash-table))
(define *state-ignore-hash*  (make-hash-table))
207
208
209
210
211
212
213
214


215
216
217
218
219
220
221
    ;; trim runs to only those that are changing often here
    ;; 
    (for-each (lambda (run)
		(let* ((run-id     (db:get-value-by-header run header "id"))
		       (sort-info  (vector-ref *tests-sort-options* *tests-sort-reverse*))
		       (sort-by    (vector-ref sort-info 1))
		       (sort-order (vector-ref sort-info 2))
		       (tests      (mt:get-tests-for-run run-id testnamepatt states statuses sort-by: sort-by sort-order: sort-order))


		       (key-vals   (cdb:remote-run db:get-key-vals #f run-id)))
		  ;; Not sure this is needed?
		  (set! referenced-run-ids (cons run-id referenced-run-ids))
		  (if (> (length tests) maxtests)
		      (set! maxtests (length tests)))
		  (if (or (not *hide-empty-runs*) ;; this reduces the data burden when set
			  (not (null? tests)))







|
>
>







208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
    ;; trim runs to only those that are changing often here
    ;; 
    (for-each (lambda (run)
		(let* ((run-id     (db:get-value-by-header run header "id"))
		       (sort-info  (vector-ref *tests-sort-options* *tests-sort-reverse*))
		       (sort-by    (vector-ref sort-info 1))
		       (sort-order (vector-ref sort-info 2))
		       (tmptests   (mt:get-tests-for-run run-id testnamepatt states statuses sort-by: sort-by sort-order: sort-order))
		       ;; NOTE: bubble-up also sets the global *all-item-test-names*
		       (tests      (bubble-up tmptests))
		       (key-vals   (cdb:remote-run db:get-key-vals #f run-id)))
		  ;; Not sure this is needed?
		  (set! referenced-run-ids (cons run-id referenced-run-ids))
		  (if (> (length tests) maxtests)
		      (set! maxtests (length tests)))
		  (if (or (not *hide-empty-runs*) ;; this reduces the data burden when set
			  (not (null? tests)))
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
			     ((string-match blank-line-rx x) #f)
			     ((equal? x basetname) #t)
			     ((hash-table-ref/default *collapsed* basetname #f) 
					;(print "Removing " basetname " from items")
			      #f)
			     (else #t))))
			inlst))
	 (vlst  (run-item-name->vectors newlst))
	 ;; sort by second field
	 (vlst-s1 (sort vlst (lambda (a b)
			       (let ((astr (vector-ref a 1))
				     (bstr (vector-ref b 1)))
				 (if (string=? astr "") #f #t)))))
			;; (>= (string-length (vector-ref a 1))(string-length (vector-ref b 1))))))
	 (vlst-s2 (sort vlst-s1
			(lambda (a b)
			  (string>= (vector-ref a 0)(vector-ref b 0)))))
	 (vlst-s3 (sort vlst
	 		(lambda (a b)
	 		  (let ((tname-a (vector-ref a 0))
	 			(tname-b (vector-ref b 0))
	 			(ipath-a (vector-ref a 1))
	 			(ipath-b (vector-ref b 1)))
	 		    (cond
			     ((and (equal? tname-a tname-b)
				   (equal? ipath-a ""))
			      #t)
			     ((and (not (equal? tname-a tname-b))
				   (equal? ipath-b "")
				   (not (equal? ipath-a "")))
	 			#t)
			     (else #f)))))))
	 ;; (parents-first (bubble-up vlst)))
    (map (lambda (x)
	   (if (equal? (vector-ref x 1) "")
	       (vector-ref x 0)
	       (conc (vector-ref x 0) "(" (vector-ref x 1) ")")))
	 vlst-s2
	 )))
    
(define (update-labels uidat)
  (let* ((rown    0)
	 (keycol  (dboard:uidat-get-keycol uidat))
	 (lftcol  (dboard:uidat-get-lftcol uidat))
	 (numcols (vector-length lftcol))
	 (maxn    (- numcols 1))







|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




<
|







274
275
276
277
278
279
280
281

























282
283
284
285

286
287
288
289
290
291
292
293
			     ((string-match blank-line-rx x) #f)
			     ((equal? x basetname) #t)
			     ((hash-table-ref/default *collapsed* basetname #f) 
					;(print "Removing " basetname " from items")
			      #f)
			     (else #t))))
			inlst))
	 (vlst  (run-item-name->vectors newlst)))

























    (map (lambda (x)
	   (if (equal? (vector-ref x 1) "")
	       (vector-ref x 0)
	       (conc (vector-ref x 0) "(" (vector-ref x 1) ")")))

	 vlst)))
    
(define (update-labels uidat)
  (let* ((rown    0)
	 (keycol  (dboard:uidat-get-keycol uidat))
	 (lftcol  (dboard:uidat-get-lftcol uidat))
	 (numcols (vector-length lftcol))
	 (maxn    (- numcols 1))
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
359
360
361
362
363
364
365
366
				(if (> (length parts) 1)(conc "  " (car (string-split (cadr parts) ")"))) newval))))
	      (vector-set! keycol i newval)
	      (iup:attribute-set! lbl "TITLE" munged-val)))
	(iup:attribute-set! lbl "FGCOLOR" (if (hash-table-ref/default *collapsed* newval #f) "0 112 112" "0 0 0"))
	(if (< i maxn)
	    (loop (+ i 1)))))))

;; ;; inlst is list of vectors < testname itempath >

;; ;;
;; (define (bubble-up inlst)



;;   (let ((tnames (delete-duplicates (map (lambda (x)(vector-ref x 0)) inlst))))




;;     (if (null? inlst)




;; 	inlst




;; 	(let loop ((hed (car inlst))
;; 		   (tal (cdr inlst))
;; 		   (res '())
;; 		   (cur (car tnames))
;; 		   (rem (cdr tnames)))
;; 	  (let ((tname (vector-ref hed 0))
;; 		(ipath (vector-ref hed 1)))
;; 	    (if (equal? tname cur)
;; 		(if (null? tal)
;; 		    (append res (list hed))
;; 		    (loop (car tal)
;; 			  (cdr tal)
;; 			  (append res (list hed))
;; 			  cur
;; 			  rem))
;; 		(if (null? tal)
;; 		    (

(define (update-buttons uidat numruns numtests)
  (let* ((runs        (if (> (length *allruns*) numruns)
			  (take-right *allruns* numruns)
			  (pad-list *allruns* numruns)))
	 (lftcol      (dboard:uidat-get-lftcol uidat))
	 (tableheader (dboard:uidat-get-header uidat))







|
>
|
|
>
>
>
|
>
>
>
>
|
>
>
>
>
|
>
>
>
>
|
|
|
<
<
|
<
<
|
|
|
<
<
<
<
<
<







307
308
309
310
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
346
347
348
349
				(if (> (length parts) 1)(conc "  " (car (string-split (cadr parts) ")"))) newval))))
	      (vector-set! keycol i newval)
	      (iup:attribute-set! lbl "TITLE" munged-val)))
	(iup:attribute-set! lbl "FGCOLOR" (if (hash-table-ref/default *collapsed* newval #f) "0 112 112" "0 0 0"))
	(if (< i maxn)
	    (loop (+ i 1)))))))

;; Bubble up the top tests to above the items, collect the items underneath
;; all while preserving the sort order from the SQL query as best as possible.
;;
(define (bubble-up test-dats)
  (let* ((tnames '())                ;; list of names used to reserve order
	 (tests  (make-hash-table))) ;; hash of lists, used to build as we go
    (for-each 
     (lambda (testdat)
       (let* ((tname (db:test-get-testname testdat))
	      (ipath (db:test-get-item-path testdat))
	      (seen  (hash-table-ref/default tests tname #f)))
	 (if (not seen)(set! tnames (append tnames (list tname))))
	 (if (equal? ipath "")
	      ;; This a top level, prepend it
	     (hash-table-set! tests tname (cons testdat (hash-table-ref/default tests tname '())))
	     ;; This is item, append it
	     (hash-table-set! tests tname (append (hash-table-ref/default tests tname '())(list testdat))))))
     test-dats)
    ;; Set all tests with items 
    (set! *all-item-test-names* (filter (lambda (tname)
				     (> (length (hash-table-ref tests tname)) 1))
				   tnames))
    (let loop ((hed (car tnames))
	       (tal (cdr tnames))
	       (res '()))


      (let ((newres (append res (hash-table-ref tests hed))))


	(if (null? tal)
	    newres
	    (loop (car tal)(cdr tal) newres))))))







(define (update-buttons uidat numruns numtests)
  (let* ((runs        (if (> (length *allruns*) numruns)
			  (take-right *allruns* numruns)
			  (pad-list *allruns* numruns)))
	 (lftcol      (dboard:uidat-get-lftcol uidat))
	 (tableheader (dboard:uidat-get-header uidat))
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163


1164




1165
1166
1167




1168
1169
1170
1171
1172
1173
1174
	      (iup:button "HideEmpty" #:action (lambda (obj)
						 (set! *hide-empty-runs* (not *hide-empty-runs*))
						 (iup:attribute-set! obj "TITLE" (if *hide-empty-runs* "+Hide" "-Hide"))
						 (mark-for-update))))
	     (iup:hbox
	      (iup:button "Quit"      #:action (lambda (obj)(if *db* (sqlite3:finalize! *db*))(exit)))
	      (iup:button "Refresh"   #:action (lambda (obj)
						 (mark-for-update))))
	     ;; (iup:button "Monitor" #:action (lambda (obj)(system (conc (car (argv))" -guimonitor &")))))
	     ))


	   ;; (iup:button "<-  Left" #:action (lambda (obj)(set! *start-run-offset*  (+ *start-run-offset* 1))))




	   ;; (iup:button "Up     ^" #:action (lambda (obj)(set! *start-test-offset* (if (> *start-test-offset* 0)(- *start-test-offset* 1) 0))))
	   ;; (iup:button "Down   v" #:action (lambda (obj)(set! *start-test-offset* (if (>= *start-test-offset* (length *alltestnamelst*))(length *alltestnamelst*)(+ *start-test-offset* 1)))))
	   ;; (iup:button "Right ->" #:action (lambda (obj)(set! *start-run-offset*  (if (> *start-run-offset* 0)(- *start-run-offset* 1) 0))))




	   (iup:frame 
	    #:title "hide"
	    (iup:vbox
	     (apply 
	      iup:hbox
	      (map (lambda (status)
		     (iup:toggle status  #:action   (lambda (obj val)







|
|
|
>
>
|
>
>
>
>
|
<
<
>
>
>
>







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
	      (iup:button "HideEmpty" #:action (lambda (obj)
						 (set! *hide-empty-runs* (not *hide-empty-runs*))
						 (iup:attribute-set! obj "TITLE" (if *hide-empty-runs* "+Hide" "-Hide"))
						 (mark-for-update))))
	     (iup:hbox
	      (iup:button "Quit"      #:action (lambda (obj)(if *db* (sqlite3:finalize! *db*))(exit)))
	      (iup:button "Refresh"   #:action (lambda (obj)
						 (mark-for-update)))
	      (iup:button "Collapse"  #:action (lambda (obj)
						 (let ((myname (iup:attribute obj "TITLE")))
						   (if (equal? myname "Collapse")
						       (begin
							 (for-each (lambda (tname)
								     (hash-table-set! *collapsed* tname #t))
								   *all-item-test-names*)
							 (iup:attribute-set! obj "TITLE" "Expand"))
						       (begin
							 (for-each (lambda (tname)


								     (hash-table-delete! *collapsed* tname))
								   (hash-table-keys *collapsed*))
							 (iup:attribute-set! obj "TITLE" "Collapse"))))
						 (mark-for-update))))))
	   (iup:frame 
	    #:title "hide"
	    (iup:vbox
	     (apply 
	      iup:hbox
	      (map (lambda (status)
		     (iup:toggle status  #:action   (lambda (obj val)