@@ -17,10 +17,19 @@ ;; along with Megatest. If not, see . ;; ;;====================================================================== (declare (unit dcommon)) +(declare (uses gutils)) +(declare (uses dbmod)) +(declare (uses mtver)) +(declare (uses debugprint)) +(declare (uses commonmod)) +(declare (uses configfmod)) +(declare (uses rmtmod)) +(declare (uses mtargs)) +(declare (uses testsmod)) (module dcommon * (import scheme @@ -31,57 +40,53 @@ chicken.sort chicken.time chicken.file chicken.file.posix + chicken.port chicken.process chicken.process-context - chicken.process-context.posix - - srfi-18 + chicken.process-context.posix) + + (import srfi-18 format iup (prefix iup iup:) canvas-draw - + canvas-draw-iup + regex typed-records matchable srfi-69 sparse-vectors srfi-1 ) -(declare (uses gutils)) -(declare (uses dbmod)) -(declare (uses mtver)) -(declare (uses debugprint)) -(declare (uses commonmod)) -(declare (uses configfmod)) -(declare (uses rmtmod)) +(import mtver + dbmod + commonmod + debugprint + configfmod + rmtmod + gutils + (prefix mtargs args:) + testsmod) ;; (include "megatest-version.scm") -;; (include "common_records.scm") -(include "db_records.scm") -(include "key_records.scm") -(include "run_records.scm") - -(import - mtver - dbmod - commonmod - debugprint - configfmod - rmtmod - gutils - ) +(include "common_records.scm") +;; (include "db_records.scm") +;; (include "key_records.scm") +;; (include "run_records.scm") ;; yes, this is non-ideal (define dashboard:update-summary-tab #f) (define dashboard:update-servers-table #f) (define *last-monitor-update-time* 0) +(define *exit-started* #f) + ;;====================================================================== ;; C O M M O N D A T A S T R U C T U R E ;;====================================================================== ;; @@ -259,10 +264,16 @@ ;; runs summary view tests-tree ;; used in newdashboard ) +;; additional setters for dboard:data +(define (dboard:tabdat-test-patts-set!-use vec val) + (dboard:tabdat-test-patts-set! vec (if (equal? val "") #f val))) + +(define (dboard:tabdat-test-patts-use vec) + (let ((val (dboard:tabdat-test-patts vec)))(if val val ""))) ;;RADT => What is the if for? ;;====================================================================== ;; D O T F I L E ;;====================================================================== @@ -846,10 +857,32 @@ (set! changed #t) (iup:attribute-set! stats-matrix key value))))) run-stats) (if changed (iup:attribute-set! stats-matrix "REDRAW" "ALL"))))) +;; if tab-num passed in then use it, otherwise look in commondat at curr-tab-num +;; adds the updater passed in the updaters list at that hashkey +;; +(define (dboard:commondat-add-updater commondat updater #!key (tab-num #f)) + (let* ((tnum (or tab-num + (dboard:commondat-curr-tab-num commondat))) + (curr-updaters (hash-table-ref/default (dboard:commondat-updaters commondat) tnum '()))) + (hash-table-set! (dboard:commondat-updaters commondat) + tnum + (cons updater curr-updaters)))) + +;; ;; if tab-num passed in then use it, otherwise look in commondat at curr-tab-num +;; ;; adds the updater passed in the updaters list at that hashkey +;; ;; +;; (define (dboard:commondat-add-updater commondat updater #!key (tab-num #f)) +;; (let* ((tnum (or tab-num +;; (dboard:commondat-curr-tab-num commondat))) +;; (curr-updaters (hash-table-ref/default (dboard:commondat-updaters commondat) tnum '()))) +;; (hash-table-set! (dboard:commondat-updaters commondat) +;; tnum +;; (cons updater curr-updaters)))) +;; (define (dcommon:run-stats commondat tabdat #!key (tab-num #f)) (let* ((stats-matrix (iup:matrix expand: "YES")) (stats-updater (lambda () (dcommon:stats-updater commondat tabdat stats-matrix)))) @@ -1302,10 +1335,60 @@ #:action (lambda (obj) ;; (let ((cmd (conc ;; "xterm -geometry 180x20 -e \"" (common:run-a-command (iup:attribute (dboard:tabdat-command-tb data) "VALUE"))))))) ;; ";echo Press any key to continue;bash -c 'read -n 1 -s'\" &"))) ;; (system cmd))))))) + +;; Extract the various bits of data from tabdat and create the command line equivalent that will be displayed +;; +(define (dashboard:update-run-command tabdat) + (let* ((cmd-tb (dboard:tabdat-command-tb tabdat)) + (cmd (dboard:tabdat-command tabdat)) + (test-patt (let ((tp (dboard:tabdat-test-patts tabdat))) + (if (or (not tp) + (equal? tp "")) + "%" + tp))) + (states (dboard:tabdat-states tabdat)) + (statuses (dboard:tabdat-statuses tabdat)) + (target (let ((targ-list (dboard:tabdat-target tabdat))) + (if targ-list (string-intersperse targ-list "/") "no-target-selected"))) + (run-name (dboard:tabdat-run-name tabdat)) + (states-str (if (or (not states) + (null? states)) + "" + (conc " -state " (string-intersperse states ",")))) + (statuses-str (if (or (not statuses) + (null? statuses)) + "" + (conc " -status " (string-intersperse statuses ",")))) + (full-cmd "megatest")) + (case (string->symbol cmd) + ((run) + (set! full-cmd (conc full-cmd + " -run" + " -testpatt " + test-patt + " -target " + target + " -runname " + run-name + " -clean-cache" + ))) + ((remove-runs) + (set! full-cmd (conc full-cmd + " -remove-runs -runname " + run-name + " -target " + target + " -testpatt " + test-patt + states-str + statuses-str + ))) + (else (set! full-cmd " no valid command "))) + (iup:attribute-set! cmd-tb "VALUE" full-cmd))) (define (dcommon:command-action-selector commondat tabdat #!key (tab-num #f)) (iup:frame #:title "Set the action to take" (iup:hbox