Megatest

Diff
Login

Differences From Artifact [42ca30b425]:

To Artifact [50bbb611aa]:


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
(declare (uses configf))

(include "common_records.scm")
(include "db_records.scm")
(include "key_records.scm")

(define help (conc 
"Megatest Dashboard, documentation at http://www.kiatoa.com/fossils/megatest
  version " megatest-version "
  license GPL, Copyright (C) Matt Welland 2011

Usage: dashboard [options]
  -h                : this help
  -group groupname  : display this group of areas
  -test testid      : control test identified by testid







|







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
(declare (uses configf))

(include "common_records.scm")
(include "db_records.scm")
(include "key_records.scm")

(define help (conc 
	      "Megatest Dashboard, documentation at http://www.kiatoa.com/fossils/megatest
  version " megatest-version "
  license GPL, Copyright (C) Matt Welland 2011

Usage: dashboard [options]
  -h                : this help
  -group groupname  : display this group of areas
  -test testid      : control test identified by testid
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
		 (argv)
		 (list  "-group" ;; display this group of areas
			"-debug"
			) 
		 (list  "-h"
			"-v"
			"-q"
		       )
		 args:arg-hash
		 0))

(if (args:get-arg "-h")
    (begin
      (print help)
      (exit)))

;;; REMOVE ME, this is a stop-gap
(define *area-dat* (make-megatest:area
		    "default"         ;; area name
		    #f                ;; area path
		    'http             ;; transport
		    #f                ;; configinfo
		    #f                ;; configdat
		    (make-hash-table) ;; denoise
		    #f                ;; client signature
		    #f                ;; remote connections
		    ))

(if (not (launch:setup-for-run *area-dat*))
    (begin
      (print "Failed to find megatest.config, exiting") 
      (exit 1)))

;; (if (args:get-arg "-host")
;;     (begin
;;       (set! (common:get-remote remote) (string-split (args:get-arg "-host" ":")))
;;       (client:launch))
;;     (client:launch))

;; ease debugging by loading ~/.dashboardrc







|








<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

















68
69
70
71
72
73
74
		 (argv)
		 (list  "-group" ;; display this group of areas
			"-debug"
			) 
		 (list  "-h"
			"-v"
			"-q"
			)
		 args:arg-hash
		 0))

(if (args:get-arg "-h")
    (begin
      (print help)
      (exit)))


















;; (if (args:get-arg "-host")
;;     (begin
;;       (set! (common:get-remote remote) (string-split (args:get-arg "-host" ":")))
;;       (client:launch))
;;     (client:launch))

;; ease debugging by loading ~/.dashboardrc
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
     (list setup-matrix jobtools-matrix validvals-matrix envovrd-matrix))

    (iup:attribute-set! validvals-matrix "WIDTH1" "290")
    (iup:attribute-set! envovrd-matrix   "WIDTH1" "290")

    (iup:vbox
     (iup:hbox
       
      (iup:vbox
       (let ((tabs (iup:tabs 
		    ;; The required tab
		    (iup:hbox
		     ;; The keys
		     (iup:frame 
		      #:title "Keys (required)"







|







181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
     (list setup-matrix jobtools-matrix validvals-matrix envovrd-matrix))

    (iup:attribute-set! validvals-matrix "WIDTH1" "290")
    (iup:attribute-set! envovrd-matrix   "WIDTH1" "290")

    (iup:vbox
     (iup:hbox
      
      (iup:vbox
       (let ((tabs (iup:tabs 
		    ;; The required tab
		    (iup:hbox
		     ;; The keys
		     (iup:frame 
		      #:title "Keys (required)"
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
		     (iup:frame
		      #:title "Validvalues"
		      validvals-matrix)
		     ))))
	 (iup:attribute-set! tabs "TABTITLE0" "Required settings")
	 (iup:attribute-set! tabs "TABTITLE1" "Optional settings")
	 tabs))
       ))))

;; The runconfigs.config file
;;
(define (rconfig window-id)
  (iup:vbox
   (iup:frame #:title "Default")))








|







231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
		     (iup:frame
		      #:title "Validvalues"
		      validvals-matrix)
		     ))))
	 (iup:attribute-set! tabs "TABTITLE0" "Required settings")
	 (iup:attribute-set! tabs "TABTITLE1" "Optional settings")
	 tabs))
      ))))

;; The runconfigs.config file
;;
(define (rconfig window-id)
  (iup:vbox
   (iup:frame #:title "Default")))

356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
     (lambda (mat)
       ;; (iup:attribute-set! mat "0:1" "Value")
       ;; (iup:attribute-set! mat "0:0" "Var")
       (iup:attribute-set! mat "HEIGHT0" 0)
       (iup:attribute-set! mat "ALIGNMENT1" "ALEFT")
       ;; (iup:attribute-set! mat "FIXTOTEXT" "C1")
       (iup:attribute-set! mat "RESIZEMATRIX" "YES"))
       ;; (iup:attribute-set! mat "WIDTH1" "120")
       ;; (iup:attribute-set! mat "WIDTH0" "100"))
     (list run-info-matrix test-info-matrix test-run-matrix meta-dat-matrix))

    ;; Steps matrix
    (iup:attribute-set! steps-matrix "0:1" "Step Name")
    (iup:attribute-set! steps-matrix "0:2" "Start")
    (iup:attribute-set! steps-matrix "WIDTH2" "40")
    (iup:attribute-set! steps-matrix "0:3" "End")







|
|







339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
     (lambda (mat)
       ;; (iup:attribute-set! mat "0:1" "Value")
       ;; (iup:attribute-set! mat "0:0" "Var")
       (iup:attribute-set! mat "HEIGHT0" 0)
       (iup:attribute-set! mat "ALIGNMENT1" "ALEFT")
       ;; (iup:attribute-set! mat "FIXTOTEXT" "C1")
       (iup:attribute-set! mat "RESIZEMATRIX" "YES"))
     ;; (iup:attribute-set! mat "WIDTH1" "120")
     ;; (iup:attribute-set! mat "WIDTH0" "100"))
     (list run-info-matrix test-info-matrix test-run-matrix meta-dat-matrix))

    ;; Steps matrix
    (iup:attribute-set! steps-matrix "0:1" "Step Name")
    (iup:attribute-set! steps-matrix "0:2" "Start")
    (iup:attribute-set! steps-matrix "WIDTH2" "40")
    (iup:attribute-set! steps-matrix "0:3" "End")
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
	  keys)
	 (iup:attribute-set! mat "REDRAW" "ALL")))
     (list
      (list run-info-matrix  '("Run Id"  "Target"   "Runname" "Run Start Time" ))
      (list test-info-matrix '("Test Id" "Testname" "Itempath" "State"   "Status" "Test Start Time" "Comment"))
      (list test-run-matrix  '("Hostname" "Host info" "Disk Free" "CPU Load" "Run Duration"))
      (list meta-dat-matrix  '("Author"   "Owner"     "Last Reviewed" "Tags" "Description"))))
	    
    (iup:split
      #:orientation "HORIZONTAL"
      (iup:vbox
       (iup:hbox
	(iup:vbox
	 run-info-matrix
	 test-info-matrix)
       ;; test-info-matrix)
	(iup:vbox
	 test-run-matrix
	 meta-dat-matrix))
       (iup:vbox
	(iup:vbox
	 (iup:hbox 
	  (iup:button "View Log"    #:action viewlog      #:size "60x" )   ;; #:size "30x" 
	  (iup:button "Start Xterm" #:action xterm        #:size "60x" ))	 ;; #:size "30x" 
	 (iup:hbox
	   (iup:button "Run Test"    #:action run-test    #:size "60x" )	 ;; #:size "30x" 
	   (iup:button "Clean Test"  #:action remove-test #:size "60x" )))	 ;; #:size "30x" 
	(iup:hbox
	 ;; hiup:split ;; hbox
	 ;; #:orientation "HORIZONTAL"
	 ;; #:value 300
	 command-text-box
	 command-launch-button)))
      (iup:vbox
       (let ((tabs (iup:tabs
		    steps-matrix
		    data-matrix)))
	 (iup:attribute-set! tabs "TABTITLE0" "Test Steps")
	 (iup:attribute-set! tabs "TABTITLE1" "Test Data")
	 tabs)))))
       
;; Test browser
(define (tree-browser data adat window-id)
  ;; (iup:split
  (let* ((tb      (iup:treebox
		   #:selection-cb
		   (lambda (obj id state)
		     ;; (print "obj: " obj ", id: " id ", state: " state)







|

|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
	  keys)
	 (iup:attribute-set! mat "REDRAW" "ALL")))
     (list
      (list run-info-matrix  '("Run Id"  "Target"   "Runname" "Run Start Time" ))
      (list test-info-matrix '("Test Id" "Testname" "Itempath" "State"   "Status" "Test Start Time" "Comment"))
      (list test-run-matrix  '("Hostname" "Host info" "Disk Free" "CPU Load" "Run Duration"))
      (list meta-dat-matrix  '("Author"   "Owner"     "Last Reviewed" "Tags" "Description"))))
    
    (iup:split
     #:orientation "HORIZONTAL"
     (iup:vbox
      (iup:hbox
       (iup:vbox
	run-info-matrix
	test-info-matrix)
       ;; test-info-matrix)
       (iup:vbox
	test-run-matrix
	meta-dat-matrix))
      (iup:vbox
       (iup:vbox
	(iup:hbox 
	 (iup:button "View Log"    #:action viewlog      #:size "60x" )   ;; #:size "30x" 
	 (iup:button "Start Xterm" #:action xterm        #:size "60x" ))	 ;; #:size "30x" 
	(iup:hbox
	 (iup:button "Run Test"    #:action run-test    #:size "60x" )	 ;; #:size "30x" 
	 (iup:button "Clean Test"  #:action remove-test #:size "60x" )))	 ;; #:size "30x" 
       (iup:hbox
	;; hiup:split ;; hbox
	;; #:orientation "HORIZONTAL"
	;; #:value 300
	command-text-box
	command-launch-button)))
     (iup:vbox
      (let ((tabs (iup:tabs
		   steps-matrix
		   data-matrix)))
	(iup:attribute-set! tabs "TABTITLE0" "Test Steps")
	(iup:attribute-set! tabs "TABTITLE1" "Test Data")
	tabs)))))

;; Test browser
(define (tree-browser data adat window-id)
  ;; (iup:split
  (let* ((tb      (iup:treebox
		   #:selection-cb
		   (lambda (obj id state)
		     ;; (print "obj: " obj ", id: " id ", state: " state)
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
	     (run-id       (db:test-get-run_id test-data))
	     (targ/runname (hash-table-ref/default (dboard:data-get-run-keys *data*) 
						   run-id
						   '()))
	     (target       (if (null? targ/runname) "" (string-intersperse (reverse (cdr (reverse targ/runname))) "/")))
	     (runname      (if (null? targ/runname) "" (car (cdr targ/runname))))
	     (steps-dat    (tests:get-compressed-steps *dbstruct-local* run-id test-id)))
				
	(if test-data
	    (begin
	      ;; 
	      (for-each 
	       (lambda (data)
		 (let ((mat    (car data))
		       (vals   (cadr data))







|







459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
	     (run-id       (db:test-get-run_id test-data))
	     (targ/runname (hash-table-ref/default (dboard:data-get-run-keys *data*) 
						   run-id
						   '()))
	     (target       (if (null? targ/runname) "" (string-intersperse (reverse (cdr (reverse targ/runname))) "/")))
	     (runname      (if (null? targ/runname) "" (car (cdr targ/runname))))
	     (steps-dat    (tests:get-compressed-steps *dbstruct-local* run-id test-id)))
	
	(if test-data
	    (begin
	      ;; 
	      (for-each 
	       (lambda (data)
		 (let ((mat    (car data))
		       (vals   (cadr data))
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
				(db:test-get-uname    test-data)
				(db:test-get-diskfree test-data)
				(db:test-get-cpuload  test-data)
				(seconds->hr-min-sec (db:test-get-run_duration test-data)))
			  (make-list 5 "")))
		))
	      (dcommon:populate-steps steps-dat steps-matrix))))))
		;;(list meta-dat-matrix
		;;      (if test-id
		;;	  (list (

  
;;======================================================================
;; R U N   C O N T R O L
;;======================================================================

;; General displayer
;;
(define (area-display data adat window-id)







|
|
|

|







506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
				(db:test-get-uname    test-data)
				(db:test-get-diskfree test-data)
				(db:test-get-cpuload  test-data)
				(seconds->hr-min-sec (db:test-get-run_duration test-data)))
			  (make-list 5 "")))
		))
	      (dcommon:populate-steps steps-dat steps-matrix))))))
;;(list meta-dat-matrix
;;      (if test-id
;;	  (list (


;;======================================================================
;; R U N   C O N T R O L
;;======================================================================

;; General displayer
;;
(define (area-display data adat window-id)
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
  (iup:hbox))

;;======================================================================
;; D A S H B O A R D
;;======================================================================

(define (make-area-panel data area-name window-id)
  (let* ((adat   (hash-table-ref areas area-name))
	 (tb     (tree-browser data adat window-id)) ;; (dboard:areas-tree-browser data)
	 (ad     (area-display data adat window-id))
	(areas  (dboard:data-areas data)))
    (dboard:area-tree-set!   adat tb)
    (dboard:area-matrix-set! adat ad)
    (iup:split
     #:value 200
     tb ad)))









|


|







549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
  (iup:hbox))

;;======================================================================
;; D A S H B O A R D
;;======================================================================

(define (make-area-panel data area-name window-id)
  (let* ((adat   (hash-table-ref (dboard:data-areas data) area-name))
	 (tb     (tree-browser data adat window-id)) ;; (dboard:areas-tree-browser data)
	 (ad     (area-display data adat window-id))
	 (areas  (dboard:data-areas data)))
    (dboard:area-tree-set!   adat tb)
    (dboard:area-matrix-set! adat ad)
    (iup:split
     #:value 200
     tb ad)))


592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611

612
613
614
615
616
617
618
619




620
621



622
623
624
625
626
627
628
	   (area-panels (map (lambda (aname)
			       (make-area-panel data aname window-id))
			     area-names))
	   (tabtop      (apply iup:tabs areas)))
      (let loop ((index 0)
		 (hed   (car area-names))
		 (tal   (cdr area-names)))
	(let* ((apath   (hash-table-ref (dboard:data-cfgdat data)) hed)
	       (mtconf    (read-config apath (make-hash-table) #f)) ;; megatest.config
	       (area-dat (make-megatest:area
			  hed      ;; area name
			  apath    ;; path to area
			  'http    ;; transport
			  (list apath mtconf) ;; configinfo (legacy)
			  mtconf   ;; megatest.config
			  (make-hash-table)
			  #f
			  #f       ;; remote connections
			  #f       ;; run keys
			  (make-hash-table) ;; run-id -> (hash of test-ids => dat)

			  )))
	  (hash-table-set! (dboard:data-areas data) hed 
			   (make-dboard:area
			    #f ;; tree
			    #f ;; matrix
			    (and (file-exists?       apath)
				 (file-write-access? apath))
			    area-dat




			    hed 




			    ))
	  (debug:print 0 "Adding area " hed " with index " index " to dashboard")
	  (iup:attribute-set! tabtop (conc "TABTITLE" index) hed)
	  (if (not (null? tal))
	      (loop (+ index 1)(car tal)(cdr tal))))
	tabtop)))))








|

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

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







575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600


601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
	   (area-panels (map (lambda (aname)
			       (make-area-panel data aname window-id))
			     area-names))
	   (tabtop      (apply iup:tabs areas)))
      (let loop ((index 0)
		 (hed   (car area-names))
		 (tal   (cdr area-names)))
	(let* ((apath     (hash-table-ref (dboard:data-cfgdat data) hed))
	       (mtconf    (read-config apath (make-hash-table) #f)) ;; megatest.config
	       (area-dat  (make-megatest:area
			   hed      ;; area name
			   apath    ;; path to area
			   'http    ;; transport
			   (list apath mtconf) ;; configinfo (legacy)
			   mtconf   ;; megatest.config
			   (make-hash-table) ;; denoise hash
			   #f       ;; client-signature
			   #f       ;; remote connections
			   #f       ;; run keys
			   (make-hash-table) ;; run-id -> (hash of test-ids => dat)
			   (and (file-exists? apath)(file-write-access? apath)) ;; read-only
			   )))
	  (hash-table-set! (dboard:data-areas data) hed 
			   (make-dboard:area 
			    #f           ;; tree
			    #f           ;; matrix


			    area-dat     ;;
			    #f           ;; view path
			    'default     ;; view type
			    #f           ;; matrix
			    #f           ;; controls
			    #f           ;; cached data
			    #f           ;; filters
			    #f           ;; the run-id
			    (make-hash-table) ;; run-id -> test-id, for current test id
			    ""
			    ))
	  (debug:print 0 "Adding area " hed " with index " index " to dashboard")
	  (iup:attribute-set! tabtop (conc "TABTITLE" index) hed)
	  (if (not (null? tal))
	      (loop (+ index 1)(car tal)(cdr tal))))
	tabtop)))))