Megatest

Changes On Branch 95351f9ba65b6a93
Login

Changes In Branch xor-two-runs Through [95351f9ba6] Excluding Merge-Ins

This is equivalent to a diff from 279a373046 to 95351f9ba6

2016-09-06
16:14
fixed slider; tweaked some diff state colors check-in: 81a014242f user: bjbarcla tags: xor-two-runs
12:58
xor looking good; still need to fixup slider lock issue check-in: 95351f9ba6 user: bjbarcla tags: xor-two-runs
2016-09-02
18:10
wip check-in: 26c23ee62d user: bjbarcla tags: xor-two-runs
2016-08-26
17:51
Create new branch named "xor-two-runs" check-in: c16967fa8b user: bjbarcla tags: xor-two-runs
10:59
Merged recent changes to v1.62 check-in: 972c78f746 user: mrwellan tags: v1.62
2016-08-18
09:01
Start work on v1.62 check-in: 279a373046 user: mrwellan tags: v1.62
08:59
Bumped version check-in: 3e88884f89 user: mrwellan tags: v1.61, v1.6103

Modified dashboard.scm from [8d6f49c706] to [36f4a3ef63].

201
202
203
204
205
206
207
208
209
210





211
212
213
214
215
216
217
  ((command          "")                 : string)      ;; for run control this is the command being built up
  (command-tb        #f)			         
  (key-listboxes     #f)			         
  (key-lbs           #f)			         
  run-name                                              ;; from run name setting widget
  states                                                ;; states for -state s1,s2 ...
  statuses                                              ;; statuses for -status s1,s2 ...
						         
  ;; Selector variables				         
  curr-run-id                                           ;; current row to display in Run summary view





  curr-test-ids                                         ;; used only in dcommon:run-update which is used in newdashboard
  ((filters-changed  #f)                  : boolean)    ;; to to indicate that the user changed filters for this tab
  ((last-filter-str  "")                  : string)      ;; conc the target runname and testpatt for a signature of changed filters
  ((hide-empty-runs  #f)                  : boolean)     
  ((hide-not-hide    #t)                  : boolean)     ;; toggle for hide/not hide empty runs
  (hide-not-hide-button #f)
  ((searchpatts        (make-hash-table)) : hash-table)  ;;







<


>
>
>
>
>







201
202
203
204
205
206
207

208
209
210
211
212
213
214
215
216
217
218
219
220
221
  ((command          "")                 : string)      ;; for run control this is the command being built up
  (command-tb        #f)			         
  (key-listboxes     #f)			         
  (key-lbs           #f)			         
  run-name                                              ;; from run name setting widget
  states                                                ;; states for -state s1,s2 ...
  statuses                                              ;; statuses for -status s1,s2 ...

  ;; Selector variables				         
  curr-run-id                                           ;; current row to display in Run summary view
  prev-run-id                                           ;; previous runid selected before current runid was selected
  (xor-src-runid-label #f)
  (xor-dest-runid-label #f)
  (mode-flag (make-parameter 'view-one-run))
  
  curr-test-ids                                         ;; used only in dcommon:run-update which is used in newdashboard
  ((filters-changed  #f)                  : boolean)    ;; to to indicate that the user changed filters for this tab
  ((last-filter-str  "")                  : string)      ;; conc the target runname and testpatt for a signature of changed filters
  ((hide-empty-runs  #f)                  : boolean)     
  ((hide-not-hide    #t)                  : boolean)     ;; toggle for hide/not hide empty runs
  (hide-not-hide-button #f)
  ((searchpatts        (make-hash-table)) : hash-table)  ;;
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
		   (car (dashboard:update-target-selector tabdat))))
	(curr-runname (dboard:tabdat-run-name tabdat)))
    (dboard:tabdat-target-set! tabdat targ)
    ;; (if (dboard:tabdat-updater-for-runs tabdat)
    ;; 	 ((dboard:tabdat-updater-for-runs tabdat)))
    (if (or (not (equal? curr-runname (dboard:tabdat-run-name tabdat)))
	    (equal? (dboard:tabdat-run-name tabdat) ""))
	(dboard:tabdat-run-name-set! tabdat curr-runname))
    (dashboard:update-run-command tabdat)))

(define (dashboard:run-controls commondat tabdat #!key (tab-num #f))
  (let* ((targets       (make-hash-table))
	 (test-records  (make-hash-table))
	 (all-tests-registry (tests:get-all)) ;; (tests:get-valid-tests *toppath* '()))
	 (test-names    (hash-table-keys all-tests-registry))







|







1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
		   (car (dashboard:update-target-selector tabdat))))
	(curr-runname (dboard:tabdat-run-name tabdat)))
    (dboard:tabdat-target-set! tabdat targ)
    ;; (if (dboard:tabdat-updater-for-runs tabdat)
    ;; 	 ((dboard:tabdat-updater-for-runs tabdat)))
    (if (or (not (equal? curr-runname (dboard:tabdat-run-name tabdat)))
	    (equal? (dboard:tabdat-run-name tabdat) ""))
        (dboard:tabdat-run-name-set! tabdat curr-runname))
    (dashboard:update-run-command tabdat)))

(define (dashboard:run-controls commondat tabdat #!key (tab-num #f))
  (let* ((targets       (make-hash-table))
	 (test-records  (make-hash-table))
	 (all-tests-registry (tests:get-all)) ;; (tests:get-valid-tests *toppath* '()))
	 (test-names    (hash-table-keys all-tests-registry))
1127
1128
1129
1130
1131
1132
1133
1134
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
1167




1168
1169
1170
1171




1172






1173
1174
1175
1176
1177
1178
1179
    
    ;; refer to (dboard:tabdat-keys tabdat), (dboard:tabdat-dbkeys tabdat) for keys
    (iup:vbox
     (dcommon:command-execution-control tabdat)
     (iup:split
      #:orientation "VERTICAL" ;; "HORIZONTAL"
      #:value 200
;; 
;;       (iup:split
;;        #:value 300

       ;; Target, testpatt, state and status input boxes
       ;;
       (iup:vbox
	;; Command to run, placed over the top of the canvas
	(dcommon:command-action-selector commondat tabdat tab-num: tab-num)
	(dcommon:command-runname-selector commondat tabdat tab-num: tab-num)
	(dcommon:command-testname-selector commondat tabdat update-keyvals)) ;;  key-listboxes))
       
       (dcommon:command-tests-tasks-canvas tabdat test-records sorted-testnames tests-draw-state))
       
 ;;(iup:frame
 ;; #:title "Logs" ;; To be replaced with tabs
 ;; (let ((logs-tb (iup:textbox #:expand "YES"
 ;;				   #:multiline "YES")))
 ;;	 (dboard:tabdat-logs-textbox-set! tabdat logs-tb)
 ;;	 logs-tb))





























      )))

(define (dboard:runs-tree-browser commondat tabdat)
  (let* ((tb      (iup:treebox
		   #:value 0
		   #:name "Runs"
		   #:expand "YES"
		   #:addexpanded "NO"
		   #:selection-cb
		   (lambda (obj id state)
		     (debug:catch-and-dump
		      (lambda ()
			(let* ((run-path (tree:node->path obj id))
			       (run-id    (tree-path->run-id tabdat (cdr run-path))))




			  (dboard:tabdat-target-set! tabdat (cdr run-path)) ;; (print "run-path: " run-path)			    
			  (dboard:tabdat-layout-update-ok-set! tabdat #f)
			  (if (number? run-id)
			      (begin




				(dboard:tabdat-curr-run-id-set! tabdat run-id)






				(dboard:tabdat-view-changed-set! tabdat #t))
			      (debug:print-error 5 *default-log-port* "tree-path->run-id returned non-number " run-id))))
		      "treebox"))
		   ;; (print "path: " (tree:node->path obj id) " run-id: " run-id)
		   )))
    (dboard:tabdat-runs-tree-set! tabdat tb)
    tb))







|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>













|
>
>
>
>
|



>
>
>
>

>
>
>
>
>
>







1131
1132
1133
1134
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
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
    
    ;; refer to (dboard:tabdat-keys tabdat), (dboard:tabdat-dbkeys tabdat) for keys
    (iup:vbox
     (dcommon:command-execution-control tabdat)
     (iup:split
      #:orientation "VERTICAL" ;; "HORIZONTAL"
      #:value 200
      ;; 
      ;;       (iup:split
      ;;        #:value 300

      ;; Target, testpatt, state and status input boxes
      ;;
      (iup:vbox
       ;; Command to run, placed over the top of the canvas
       (dcommon:command-action-selector commondat tabdat tab-num: tab-num)
       (dcommon:command-runname-selector commondat tabdat tab-num: tab-num)
       (dcommon:command-testname-selector commondat tabdat update-keyvals)) ;;  key-listboxes))
      
      (dcommon:command-tests-tasks-canvas tabdat test-records sorted-testnames tests-draw-state))
     
     ;;(iup:frame
     ;; #:title "Logs" ;; To be replaced with tabs
     ;; (let ((logs-tb (iup:textbox #:expand "YES"
     ;;				   #:multiline "YES")))
     ;;	 (dboard:tabdat-logs-textbox-set! tabdat logs-tb)
     ;;	 logs-tb))
     )))

(define (dboard:xor-ui-update tabdat)
  (let* ((mode-flag (dboard:tabdat-mode-flag tabdat))
         (current-mode (mode-flag))
         (xor-src-runid-label  (dboard:tabdat-xor-src-runid-label tabdat))
         (xor-dest-runid-label (dboard:tabdat-xor-dest-runid-label tabdat))
         (curr-run-id          (dboard:tabdat-curr-run-id tabdat))
         (prev-run-id          (dboard:tabdat-prev-run-id tabdat))
         (curr-runname (if curr-run-id
                           (rmt:get-run-name-from-id curr-run-id)
                           "None"))
         (prev-runname (if prev-run-id
                           (rmt:get-run-name-from-id prev-run-id)
                           "None"))
         )
    
    (print "BB> xor-ui-update HELLO" )
    (print "BB> curr-runname="curr-runname)
    (print "BB> prev-runname="prev-runname)
    (print "BB> current-mode="current-mode)
    (case current-mode
      ((view-one-run)
       (iup:attribute-set! xor-src-runid-label "TITLE" "")
       (iup:attribute-set! xor-dest-runid-label "TITLE" ""))
      ((xor-two-runs)
       (iup:attribute-set! xor-src-runid-label "TITLE" (conc " SRC: "curr-runname"  "))
       (iup:attribute-set! xor-dest-runid-label "TITLE" (conc "DEST: "prev-runname"  ")))
      (else (print "BB> WHA?"))
      )))

(define (dboard:runs-tree-browser commondat tabdat)
  (let* ((tb      (iup:treebox
		   #:value 0
		   #:name "Runs"
		   #:expand "YES"
		   #:addexpanded "NO"
		   #:selection-cb
		   (lambda (obj id state)
		     (debug:catch-and-dump
		      (lambda ()
			(let* ((run-path (tree:node->path obj id))
			       (run-id    (tree-path->run-id tabdat (cdr run-path)))
                               (curr-runname (dboard:tabdat-run-name tabdat)))


                          
                          (dboard:tabdat-target-set! tabdat (cdr run-path)) ;; (print "run-path: " run-path)			    
			  (dboard:tabdat-layout-update-ok-set! tabdat #f)
			  (if (number? run-id)
			      (begin
                                ;; capture last two in tabdat.
                                (dboard:tabdat-prev-run-id-set!
                                 tabdat
                                 (dboard:tabdat-curr-run-id tabdat))
				(dboard:tabdat-curr-run-id-set! tabdat run-id)

                                (dboard:tabdat-run-name-set! tabdat curr-runname)

                                (print "BB> before xor-ui-update")
                                (dboard:xor-ui-update tabdat)
                                (print "BB> after xor-ui-update")
				(dboard:tabdat-view-changed-set! tabdat #t))
			      (debug:print-error 5 *default-log-port* "tree-path->run-id returned non-number " run-id))))
		      "treebox"))
		   ;; (print "path: " (tree:node->path obj id) " run-id: " run-id)
		   )))
    (dboard:tabdat-runs-tree-set! tabdat tb)
    tb))
1286
1287
1288
1289
1290
1291
1292





1293
1294
1295
1296
1297
1298
1299
;;
;; display and manage a single run at a time

(define (tree-path->run-id tabdat path)
  (if (not (null? path))
      (hash-table-ref/default (dboard:tabdat-path-run-ids tabdat) path #f)
      #f))






(define (dboard:get-tests-dat tabdat run-id last-update)
  (let ((tdat (if run-id (rmt:get-tests-for-run run-id 
					     (hash-table-ref/default (dboard:tabdat-searchpatts tabdat) "test-name" "%/%")
					     (hash-table-keys (dboard:tabdat-state-ignore-hash tabdat))  ;; '()
					     (hash-table-keys (dboard:tabdat-status-ignore-hash tabdat)) ;; '()
					     #f #f                                                       ;; offset limit







>
>
>
>
>







1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
;;
;; display and manage a single run at a time

(define (tree-path->run-id tabdat path)
  (if (not (null? path))
      (hash-table-ref/default (dboard:tabdat-path-run-ids tabdat) path #f)
      #f))

(define (tree-path->run-name tabdat path)
  (if (not (null? path))
      (hash-table-ref/default (dboard:tabdat-path-run-ids tabdat) path #f)
      #f))

(define (dboard:get-tests-dat tabdat run-id last-update)
  (let ((tdat (if run-id (rmt:get-tests-for-run run-id 
					     (hash-table-ref/default (dboard:tabdat-searchpatts tabdat) "test-name" "%/%")
					     (hash-table-keys (dboard:tabdat-state-ignore-hash tabdat))  ;; '()
					     (hash-table-keys (dboard:tabdat-status-ignore-hash tabdat)) ;; '()
					     #f #f                                                       ;; offset limit
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363







































































































1364
1365
1366
1367
1368
1369
1370
			;; Here we update the tests treebox and tree keys
			(tree:add-node tb "Runs" run-path ;; (append key-vals (list run-name))
				       userdata: (conc "run-id: " run-id))
			(hash-table-set! (dboard:tabdat-path-run-ids tabdat) run-path run-id)
			;; (set! colnum (+ colnum 1))
			))))
	      run-ids)))
  
(define (dashboard:one-run-updater commondat tabdat tb cell-lookup run-matrix)
  (let* ((runs-dat     (rmt:get-runs-by-patt (dboard:tabdat-keys tabdat) "%" #f #f #f #f))
	 (runs-header  (vector-ref runs-dat 0)) ;; 0 is header, 1 is list of records
	 (run-id       (dboard:tabdat-curr-run-id tabdat))
	 (last-update  0) ;; fix me - have to create and store a rundat record for this
	 (tests-dat    (dboard:get-tests-dat tabdat run-id last-update))
	 (tests-mindat (dcommon:minimize-test-data tests-dat))







































































































	 (indices      (common:sparse-list-generate-index tests-mindat)) ;;  proc: set-cell))
	 (row-indices  (cadr indices))
	 (col-indices  (car indices))
	 (max-row      (if (null? row-indices) 1 (common:max (map cadr row-indices))))
	 (max-col      (if (null? col-indices) 1 (common:max (map cadr col-indices))))
	 (max-visible  (max (- (dboard:tabdat-num-tests tabdat) 15) 3)) ;; (dboard:tabdat-num-tests tabdat) is proportional to the size of the window
	 (numrows      1)







|
|




|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
			;; Here we update the tests treebox and tree keys
			(tree:add-node tb "Runs" run-path ;; (append key-vals (list run-name))
				       userdata: (conc "run-id: " run-id))
			(hash-table-set! (dboard:tabdat-path-run-ids tabdat) run-path run-id)
			;; (set! colnum (+ colnum 1))
			))))
	      run-ids)))

(define (dashboard:one-run-updater commondat tabdat tb cell-lookup run-matrix )
  (let* ((runs-dat     (rmt:get-runs-by-patt (dboard:tabdat-keys tabdat) "%" #f #f #f #f))
	 (runs-header  (vector-ref runs-dat 0)) ;; 0 is header, 1 is list of records
	 (run-id       (dboard:tabdat-curr-run-id tabdat))
	 (last-update  0) ;; fix me - have to create and store a rundat record for this
	 (tests-dat    (dboard:get-tests-dat tabdat run-id last-update)) ;; does query to get run info
	 (tests-mindat (dcommon:minimize-test-data tests-dat))  ;; reduces data for display
	 (indices      (common:sparse-list-generate-index tests-mindat)) ;;  proc: set-cell))
	 (row-indices  (cadr indices))
	 (col-indices  (car indices))
	 (max-row      (if (null? row-indices) 1 (common:max (map cadr row-indices))))
	 (max-col      (if (null? col-indices) 1 (common:max (map cadr col-indices))))
	 (max-visible  (max (- (dboard:tabdat-num-tests tabdat) 15) 3)) ;; (dboard:tabdat-num-tests tabdat) is proportional to the size of the window
	 (numrows      1)
	 (numcols      1)
	 (changed      #f)
	 (runs-hash    (let ((ht (make-hash-table)))
			 (for-each (lambda (run)
				     (hash-table-set! ht (db:get-value-by-header run runs-header "id") run))
				   (vector-ref runs-dat 1))
			 ht)))
    (dboard:tabdat-filters-changed-set! tabdat #f)
    (let loop ((pass-num 0)
	       (changed  #f))
      ;; Update the runs tree
      (dboard:update-tree tabdat runs-hash runs-header tb)

(if (eq? pass-num 1)
	  (begin ;; big reset
    (iup:attribute-set! run-matrix "CLEARVALUE" "ALL") ;; NOTE: Was CONTENTS
    (iup:attribute-set! run-matrix "CLEARATTRIB" "CONTENTS")
    (iup:attribute-set! run-matrix "RESIZEMATRIX" "YES")
    (iup:attribute-set! run-matrix "NUMCOL" max-col )
    (iup:attribute-set! run-matrix "NUMLIN" (if (< max-row max-visible) max-visible max-row)))) ;; min of 20

    ;; Row labels
    (for-each (lambda (ind)
		(let* ((name (car ind))
		       (num  (cadr ind))
		       (key  (conc num ":0")))
		  (if (not (equal? (iup:attribute run-matrix key) name))
		      (begin
			(set! changed #t)
			(iup:attribute-set! run-matrix key name)))))
	      row-indices)
    
;;(print "row-indices: " row-indices " col-indices: " col-indices)
      (if (and (eq? pass-num 0) changed)
	  (loop 1 #t)) ;; force second pass

    ;; Cell contents
    (for-each (lambda (entry)
		;; (print "entry: " entry)
		(let* ((row-name  (cadr entry))
		       (col-name  (car entry))
		       (valuedat  (caddr entry))
		       (test-id   (list-ref valuedat 0))
		       (test-name row-name) ;; (list-ref valuedat 1))
		       (item-path col-name) ;; (list-ref valuedat 2))
		       (state     (list-ref valuedat 1))
		       (status    (list-ref valuedat 2))
		       (value     (gutils:get-color-for-state-status state status))
		       (row-num   (cadr (assoc row-name row-indices)))
		       (col-num   (cadr (assoc col-name col-indices)))
		       (key       (conc row-num ":" col-num)))
		  (hash-table-set! cell-lookup key test-id)
		  (if (not (equal? (iup:attribute run-matrix key) (cadr value)))
		      (begin
			(set! changed #t)
			(iup:attribute-set! run-matrix key (cadr value))
			(iup:attribute-set! run-matrix (conc "BGCOLOR" key) (car value))))))
	      tests-mindat)
    
    ;; Col labels - do after setting Cell contents so they are accounted for in the size calc.

    (for-each (lambda (ind)
		(let* ((name (car ind))
		       (num  (cadr ind))
		       (key  (conc "0:" num)))
		  (if (not (equal? (iup:attribute run-matrix key) name))
		      (begin
			(set! changed #t)
			(iup:attribute-set! run-matrix key name)
			(iup:attribute-set! run-matrix "FITTOTEXT" (conc "C" num))))))
	      col-indices)

      (if (and (eq? pass-num 0) changed)
	  (loop 1 #t)) ;; force second pass due to column labels changing

      ;; (debug:print 0 *default-debug-port* "one-run-updater, changed: " changed " pass-num: " pass-num)
      ;; (print "one-run-updater, changed: " changed " pass-num: " pass-num)
      (if changed (iup:attribute-set! run-matrix "REDRAW" "ALL")))))




(define (dashboard:xor-two-runs-updater commondat tabdat tb cell-lookup run-matrix )
  (let* ((runs-dat     (rmt:get-runs-by-patt (dboard:tabdat-keys tabdat) "%" #f #f #f #f))
	 (runs-header  (vector-ref runs-dat 0)) ;; 0 is header, 1 is list of records
         (prev-run-id       (dboard:tabdat-prev-run-id tabdat))
	 (curr-run-id       (dboard:tabdat-curr-run-id tabdat))
	 (last-update  0) ;; fix me - have to create and store a rundat record for this
	 (dest-tests-dat    (dboard:get-tests-dat tabdat curr-run-id last-update)) ;; does query to get run info
         (src-tests-dat    (dboard:get-tests-dat tabdat prev-run-id last-update)) ;; does query to get run info

         ;;; STOPPED HERE
         (dest-tests-mindat (dcommon:minimize-test-data dest-tests-dat))  ;; reduces data for display
         (src-tests-mindat (dcommon:minimize-test-data src-tests-dat))  ;; reduces data for display
         ;;(tests-mindat dest-tests-mindat)
         (tests-mindat (dcommon:xor-tests-mindat src-tests-mindat dest-tests-mindat)) ;; TODO: flags for common, modified, new -- like meld
	 (indices      (common:sparse-list-generate-index tests-mindat)) ;;  proc: set-cell))
	 (row-indices  (cadr indices))
	 (col-indices  (car indices))
	 (max-row      (if (null? row-indices) 1 (common:max (map cadr row-indices))))
	 (max-col      (if (null? col-indices) 1 (common:max (map cadr col-indices))))
	 (max-visible  (max (- (dboard:tabdat-num-tests tabdat) 15) 3)) ;; (dboard:tabdat-num-tests tabdat) is proportional to the size of the window
	 (numrows      1)
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
		       (key  (conc num ":0")))
		  (if (not (equal? (iup:attribute run-matrix key) name))
		      (begin
			(set! changed #t)
			(iup:attribute-set! run-matrix key name)))))
	      row-indices)
    
     (print "row-indices: " row-indices " col-indices: " col-indices)
      (if (and (eq? pass-num 0) changed)
	  (loop 1 #t)) ;; force second pass

    ;; Cell contents
    (for-each (lambda (entry)
		;; (print "entry: " entry)
		(let* ((row-name  (cadr entry))







|







1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
		       (key  (conc num ":0")))
		  (if (not (equal? (iup:attribute run-matrix key) name))
		      (begin
			(set! changed #t)
			(iup:attribute-set! run-matrix key name)))))
	      row-indices)
    
;;(print "row-indices: " row-indices " col-indices: " col-indices)
      (if (and (eq? pass-num 0) changed)
	  (loop 1 #t)) ;; force second pass

    ;; Cell contents
    (for-each (lambda (entry)
		;; (print "entry: " entry)
		(let* ((row-name  (cadr entry))
1440
1441
1442
1443
1444
1445
1446
1447
1448

1449
1450
1451
1452
1453
1454
1455
			(iup:attribute-set! run-matrix "FITTOTEXT" (conc "C" num))))))
	      col-indices)

      (if (and (eq? pass-num 0) changed)
	  (loop 1 #t)) ;; force second pass due to column labels changing

      ;; (debug:print 0 *default-debug-port* "one-run-updater, changed: " changed " pass-num: " pass-num)
      (print "one-run-updater, changed: " changed " pass-num: " pass-num)
      (if changed (iup:attribute-set! run-matrix "REDRAW" "ALL")))))


;;======================================================================
;; S U M M A R Y 
;;======================================================================
;;
;; General info about the run(s) and megatest area
(define (dashboard:summary commondat tabdat #!key (tab-num #f))







|

>







1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
			(iup:attribute-set! run-matrix "FITTOTEXT" (conc "C" num))))))
	      col-indices)

      (if (and (eq? pass-num 0) changed)
	  (loop 1 #t)) ;; force second pass due to column labels changing

      ;; (debug:print 0 *default-debug-port* "one-run-updater, changed: " changed " pass-num: " pass-num)
      ;; (print "one-run-updater, changed: " changed " pass-num: " pass-num)
      (if changed (iup:attribute-set! run-matrix "REDRAW" "ALL")))))


;;======================================================================
;; S U M M A R Y 
;;======================================================================
;;
;; General info about the run(s) and megatest area
(define (dashboard:summary commondat tabdat #!key (tab-num #f))
1492
1493
1494
1495
1496
1497
1498
1499











1500
1501
1502








1503



1504
1505
1506


1507


1508




1509
1510

1511




1512
1513

1514
1515
1516


1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529


1530






1531
1532


1533


1534
1535




1536
1537
1538
1539
1540
1541
1542

;; (define dashboard:update-run-summary-tab #f)
;; (define dashboard:update-new-view-tab #f)

;; This is the Run Summary tab
;; 
(define (dashboard:one-run commondat tabdat #!key (tab-num #f))
  (let* ((tb      (iup:treebox











		   #:value 0
		   #:name "Runs"
		   #:expand "YES"








		   #:addexpanded "NO"



		   #:selection-cb
		   (lambda (obj id state)
		     ;; (print "obj: " obj ", id: " id ", state: " state)


		     (let* ((run-path (tree:node->path obj id))


			    (run-id   (tree-path->run-id tabdat (cdr run-path))))




		       (if (number? run-id)
			   (begin

			     (dboard:tabdat-curr-run-id-set! tabdat run-id)




			     (dboard:tabdat-layout-update-ok-set! tabdat #f)
			     ;; (dashboard:update-run-summary-tab)

			     )
			   (debug:print-error 0 *default-log-port* "tree-path->run-id returned non-number " run-id)))
		     ;; (print "path: " (tree:node->path obj id) " run-id: " run-id)


		     )))
	 (cell-lookup (make-hash-table))
	 (run-matrix (iup:matrix
		      #:expand "YES"
		      #:click-cb
		      (lambda (obj lin col status)
			(let* ((toolpath (car (argv)))
			       (key      (conc lin ":" col))
			       (test-id  (hash-table-ref/default cell-lookup key -1))
			       (cmd      (conc toolpath " -test " (dboard:tabdat-curr-run-id tabdat) "," test-id "&")))
			  (system cmd)))))
	 (one-run-updater  (lambda ()
			     (if  (dashboard:database-changed? commondat tabdat)


				  (dashboard:one-run-updater commondat tabdat tb cell-lookup run-matrix)))))






    (dboard:commondat-add-updater commondat one-run-updater tab-num: tab-num)
    (dboard:tabdat-runs-tree-set! tabdat tb)


    (iup:split


     tb
     run-matrix)))




;;     (iup:vbox
;;      (let* ((cnv-obj (iup:canvas 
;; 		     ;; #:size "500x400"
;; 		     #:expand "YES"
;; 		     #:scrollbar "YES"
;; 		     #:posx "0.5"
;; 		     #:posy "0.5"







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










>
>
|
>
>
>
>
>
>
|

>
>
|
>
>
|
|
>
>
>
>







1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683

1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702

1703
1704
1705
1706
1707
1708
1709

1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749

;; (define dashboard:update-run-summary-tab #f)
;; (define dashboard:update-new-view-tab #f)

;; This is the Run Summary tab
;; 
(define (dashboard:one-run commondat tabdat #!key (tab-num #f))
  (let* ((view-one-run-button #f)
         (xor-two-runs-button #f)
         (sel-color    "180 100 100")
         (nonsel-color "170 170 170")
         (mode-flag (dboard:tabdat-mode-flag tabdat))
         (tb (dboard:runs-tree-browser commondat tabdat))
         (cell-lookup (make-hash-table))
         (mode-selector
          (iup:hbox
           (let ((temp-button
                  (iup:button "View One Run"
                              #:bgcolor sel-color
                              #:action
                              (lambda (obj)
                                (debug:catch-and-dump
                                 (lambda ()
                                   (mode-flag 'view-one-run)
                                   (iup:attribute-set! obj "BGCOLOR" sel-color)
                                   (iup:attribute-set! xor-two-runs-button "BGCOLOR" nonsel-color)
                                   (dboard:xor-ui-update tabdat))
                                 "temp-button-1"))
                              )))
             (set! view-one-run-button temp-button)
             
             temp-button)
           (let ((temp-button
                  (iup:button "XOR Two Runs"
                              #:action
                              (lambda (obj)

                                (debug:catch-and-dump
                                 (lambda ()
                                   (mode-flag 'xor-two-runs)
                                   (iup:attribute-set! obj "BGCOLOR" sel-color)
                                   (iup:attribute-set! view-one-run-button "BGCOLOR" nonsel-color)
                                   (dboard:xor-ui-update tabdat))
                                 "temp-button-2"))
                              )))
             (set! xor-two-runs-button temp-button)
             temp-button)

           (let ((temp-label
                  (iup:label "" #:size "125x15" #:fontsize "10" )))
             (dboard:tabdat-xor-src-runid-label-set! tabdat temp-label)
             temp-label
             )
           (let ((temp-label
                  (iup:label "" #:size "125x15" #:fontsize "10")))
             (dboard:tabdat-xor-dest-runid-label-set! tabdat temp-label)

             temp-label
             )

           
           )
          )


         (run-matrix (iup:matrix
		      #:expand "YES"
		      #:click-cb
		      (lambda (obj lin col status)
			(let* ((toolpath (car (argv)))
			       (key      (conc lin ":" col))
			       (test-id  (hash-table-ref/default cell-lookup key -1))
			       (cmd      (conc toolpath " -test " (dboard:tabdat-curr-run-id tabdat) "," test-id "&")))
			  (system cmd)))))
	 (one-run-updater  (lambda ()
			     (if  (dashboard:database-changed? commondat tabdat)
                                  (case (mode-flag) 
                                    ((view-one-run)
                                     (dashboard:one-run-updater commondat tabdat tb cell-lookup run-matrix))
                                    ((xor-two-runs)
                                     (dashboard:xor-two-runs-updater commondat tabdat tb cell-lookup run-matrix))
                                    )
                                  (dboard:xor-ui-update)
                                  ))))
    
    (dboard:commondat-add-updater commondat one-run-updater tab-num: tab-num) ;; register updater
    (dboard:tabdat-runs-tree-set! tabdat tb)

    (iup:vbox
     (iup:split
      #:value 150
      (iup:vbox
       tb)
      run-matrix)
     mode-selector)
    ))


;;     (iup:vbox
;;      (let* ((cnv-obj (iup:canvas 
;; 		     ;; #:size "500x400"
;; 		     #:expand "YES"
;; 		     #:scrollbar "YES"
;; 		     #:posx "0.5"
;; 		     #:posy "0.5"

Modified dcommon.scm from [29b42dc17c] to [88138cb2b1].

273
274
275
276
277
278
279
280
281
282
283
284
285
286

































































































287
288
289
290
291
292
293
      '()
      (let loop ((hed (car tests-dat))
		 (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-status 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:examine-xterm run-id test-id)
  (let* ((testdat (rmt:get-test-info-by-id run-id test-id)))
    (if (not testdat)
	(begin
	  (debug:print 2 "ERROR: No test data found for test " test-id ", exiting")
	  (exit 1))
        (let*







|






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
      '()
      (let loop ((hed (car tests-dat))
		 (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)
     ((= (length mem1) (length mem2)) 0)
     ((> (length mem1) (length mem2)) 1)
     (else -1))))
     
(define (dcommon:xor-tests-mindat src-tests-mindat dest-tests-mindat)
  (let* ((src-hash (dcommon:tests-mindat->hash src-tests-mindat))
         (dest-hash (dcommon:tests-mindat->hash dest-tests-mindat))
         (all-keys
          (reverse (sort 
           (delete-duplicates
            (append (hash-table-keys src-hash) (hash-table-keys dest-hash)))

           (lambda (a b) 
             (cond
              ((< 0 (string-compare3 (car a) (car b))) #t)
              ((> 0 (string-compare3 (car a) (car b))) #f)
              ((< 0 (string-compare3 (cdr a) (cdr b))) #t)
              (else #f)))

           ))))
    (map ;; TODO: rename xor to delta globally in dcommon and dashboard
     (lambda (key)
       (let* ((test-name (car key))
              (item-path (cdr key))

              (dest-value (hash-table-ref/default dest-hash key #f)) ;; (list test-id state status)
              (dest-test-id  (if dest-value (list-ref dest-value 0) #f))
              (dest-state    (if dest-value (list-ref dest-value 1) #f))
              (dest-status   (if dest-value (list-ref dest-value 2) #f))

              (src-value     (hash-table-ref/default src-hash key #f))   ;; (list test-id state status)
              (src-test-id   (if src-value (list-ref src-value 0) #f))
              (src-state     (if src-value (list-ref src-value 1) #f))
              (src-status    (if src-value (list-ref src-value 2) #f))

              (incomplete-statuses '("DELETED" "INCOMPLETE" "STUCK/DEAD" "N/A")) ;; if any of these statuses apply, treat test as incomplete

              (dest-complete
               (and dest-value dest-state dest-status
                    (equal? dest-state "COMPLETED")
                    (not (member dest-status incomplete-statuses))))
              (src-complete
               (and src-value src-state src-status
                    (equal? src-state "COMPLETED")
                    (not (member src-status incomplete-statuses))))
              (status-compare-result (dcommon:status-compare3 src-status dest-status))
              (xor-new-item
               (cond
                ;; complete, for this case means: state=compelte AND status not in ( deleted uncomplete stuck/dead n/a )
                ;; neither complete -> bad

                ;; src !complete, dest complete -> better
                ((and (not dest-complete) (not src-complete))
                 (list dest-test-id "BOTH-BAD" "BOTH-INCOMPLETE"))
                ((not dest-complete)
                 (list src-test-id "DIFF-MISSING" "DEST-INCOMPLETE"))  
                ((not src-complete)
                 (list dest-test-id "DIFF-NEW" "SRC-INCOMPLETE"))      
                ((and
                  (equal? src-state dest-state)
                  (equal? src-status dest-status))
                 (list dest-test-id  (conc "CLEAN") (conc "CLEAN-" dest-status) )) 
                ;;    better or worse: pass > warn > waived > skip > fail > abort
                ;;     pass > warn > waived > skip > fail > abort
                
                ((= 1 status-compare-result) ;; src is better, dest is worse
                 (list dest-test-id "DIRTY-WORSE" (conc src-status "->" dest-status)))
                (else
                 (list dest-test-id "DIRTY-BETTER" (conc src-status "->" dest-status)))
                 )))
         (list test-name item-path  xor-new-item)))
     all-keys)))

(define (dcommon:examine-xterm run-id test-id)
  (let* ((testdat (rmt:get-test-info-by-id run-id test-id)))
    (if (not testdat)
	(begin
	  (debug:print 2 "ERROR: No test data found for test " test-id ", exiting")
	  (exit 1))
        (let*
309
310
311
312
313
314
315


316
317
318
319
320
321
322
                               (message-window  (conc "Directory " rundir " not found"))))))
          (xterm)
          (print "Adding xterm code")))))

;;======================================================================
;; D A T A   T A B L E S
;;======================================================================



;; Table of keys
(define (dcommon:keys-matrix rawconfig)
  (let* ((curr-row-num 1)
	 (key-vals     (configf:section-vars rawconfig "fields"))
	 (keys-matrix  (iup:matrix
			#:alignment1 "ALEFT"







>
>







406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
                               (message-window  (conc "Directory " rundir " not found"))))))
          (xterm)
          (print "Adding xterm code")))))

;;======================================================================
;; D A T A   T A B L E S
;;======================================================================



;; Table of keys
(define (dcommon:keys-matrix rawconfig)
  (let* ((curr-row-num 1)
	 (key-vals     (configf:section-vars rawconfig "fields"))
	 (keys-matrix  (iup:matrix
			#:alignment1 "ALEFT"

Modified gutils.scm from [628c78d614] to [8c2f334f02].

39
40
41
42
43
44
45





46
47
48
49
50
51
52
       (else (list "180 33 49" status))))
    ;;      (if (equal? status "PASS")
    ;;	  '("70 249 73" "PASS")
    ;;	  (if (or (equal? status "WARN")
    ;;		  (equal? status "WAIVED"))
    ;;	      (list "255 172 13" status)
    ;;	      (list "223 33 49"  status)))) ;; greenish orangeish redish





    ((LAUNCHED)         (list "101 123 142"  state))
    ((CHECK)            (list "255 100 50"   state))
    ((REMOTEHOSTSTART)  (list "50 130 195"   state))
    ((RUNNING)          (list "9 131 232"    state))
    ((KILLREQ)          (list "39 82 206"    state))
    ((KILLED)           (list "234 101 17"   state))
    ((NOT_STARTED)      (list "240 240 240"  state))







>
>
>
>
>







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
       (else (list "180 33 49" status))))
    ;;      (if (equal? status "PASS")
    ;;	  '("70 249 73" "PASS")
    ;;	  (if (or (equal? status "WARN")
    ;;		  (equal? status "WAIVED"))
    ;;	      (list "255 172 13" status)
    ;;	      (list "223 33 49"  status)))) ;; greenish orangeish redish

    ((CLEAN)       (list "60  235 63" status))
    ((DIRTY-BETTER)     (list "160  255 153" status))
    ((DIRTY-WORSE)      (list "165 42  42" status))
    ((BOTH-BAD)         (list "253 33 49" state))
    ((LAUNCHED)         (list "101 123 142"  state))
    ((CHECK)            (list "255 100 50"   state))
    ((REMOTEHOSTSTART)  (list "50 130 195"   state))
    ((RUNNING)          (list "9 131 232"    state))
    ((KILLREQ)          (list "39 82 206"    state))
    ((KILLED)           (list "234 101 17"   state))
    ((NOT_STARTED)      (list "240 240 240"  state))