@@ -59,13 +59,12 @@ (include "vg_records.scm") (dbfile:db-init-proc db:initialize-main-db) (define help (conc - "Megatest Dashboard, documentation at http://www.kiatoa.com/fossils/megatest - version " megatest-version " - license GPL, Copyright (C) Matt Welland 2012-2017 + "Megatest Dashboard, documentation at http://www.kiatoa.com/fossils/megatest version " megatest-version + " license GPL, Copyright (C) Matt Welland 2012-2017 Usage: dashboard [options] -h : this help -test run-id,test-id : control test identified by testid -skip-version-check : skip the version check @@ -72,11 +71,12 @@ -use-db-cache : access database via cache Misc -rows R : set number of rows -cols C : set number of columns -")) +" +)) ;; -server host:port : connect to host:port instead of db access ;; -xterm run-id,test-id : Start a new xterm with specified run-id and test-id ;; -guimonitor : control panel for runs @@ -106,22 +106,24 @@ "-:p" ;; ignore the built in chicken profiling switch ) args:arg-hash 0)) +;; ################### Top level code ################### + ;; check for MT_* environment variables and exit if found (if (not (args:get-arg "-test")) (begin - (display "Checking for MT_ vars: ") (for-each (lambda (var) - (display " ")(display var) + ;; (display " ")(display var) (if (get-environment-variable var) (begin (print "ERROR: environment variable " var " is set in this terminal, this will cause you problems. Exiting now.") (exit 1)))) '("MT_RUN_AREA_HOME" "MT_MEGATEST" "MT_CMDINFO" "MT_TEST_RUN_DIR" "MT_LINKTREE" "MT_TESTSUITENAME")) - (print ". Done. All ok."))) + ) +) (if (not (null? remargs)) (begin (print "Unrecognised arguments: " (string-intersperse remargs " ")) (exit))) @@ -140,10 +142,11 @@ (debug:print-error 0 *default-log-port* "non-existant start dir " (args:get-arg "-start-dir") " specified, exiting.") (exit 1)))) ;; TODO: Move this inside (main) ;; +(print "launch:setup") (if (not (launch:setup)) (begin (print "Failed to find megatest.config, exiting") (exit 1))) @@ -155,11 +158,16 @@ (not (file-exists? "/etc/os-release"))) (set! iup:detachbox iup:vbox)) (if (not (common:on-homehost?)) (begin - (debug:print 0 *default-log-port* "WARNING: Current policy requires running dashboard on homehost: " (common:get-homehost)))) + (debug:print 0 *default-log-port* "WARNING: You are starting the dashboard on a machine that is not the homehost:" (common:get-homehost)) + (debug:print 0 *default-log-port* "It will be slower." (common:get-homehost)) + )) + +;; ########################### end top level code ############################## + ;; RA => Might require revert for filters ;; create a watch dog to move changes from lt/.db/*.db to megatest.db ;; ;;;(if (file-write-access? (conc *toppath* "/megatest.db")) @@ -3302,11 +3310,11 @@ (filtrstr (conc targpatt "/" runpatt "/" testpatt))) ;; (print "targpatt: " targpatt " runpatt: " runpatt " testpatt: " testpatt) (if (not (equal? (dboard:tabdat-last-filter-str tabdat) filtrstr)) (let ((dwg (dboard:tabdat-drawing tabdat))) - (print "reseting drawing") + (print "resetting drawing") (dboard:tabdat-layout-update-ok-set! tabdat #f) (vg:drawing-libs-set! dwg (make-hash-table)) (vg:drawing-insts-set! dwg (make-hash-table)) (vg:drawing-cache-set! dwg '()) (dboard:tabdat-allruns-by-id-set! tabdat (make-hash-table)) @@ -3816,10 +3824,11 @@ ;;====================================================================== ;; The heavy lifting starts here ;;====================================================================== (define (main) + (print "Starting dashboard main") (let ((mtdb-path (conc *toppath* "/megatest.db"))) ;; (if (and (common:file-exists? mtdb-path) (file-write-access? mtdb-path)) (if (not (args:get-arg "-skip-version-check")) (common:exit-on-version-changed))) @@ -3871,18 +3880,21 @@ (mutex-lock! (dboard:commondat-update-mutex commondat)) (dboard:commondat-updating-set! commondat #f) (mutex-unlock! (dboard:commondat-update-mutex commondat))) )) 1)))) - + (print "Starting updaters") (let ((th1 (make-thread (lambda () (thread-sleep! 1) (dboard:common-run-curr-updaters commondat 0) ;; force update of summary tab ) "update buttons once")) (th2 (make-thread iup:main-loop "Main loop"))) + (print "Starting main loop") (thread-start! th2) (thread-join! th2))))) + +;; ########################### top level code ######################## ;; ease debugging by loading ~/.dashboardrc (let ((debugcontrolf (conc (get-environment-variable "HOME") "/.dashboardrc"))) (if (common:file-exists? debugcontrolf) (load debugcontrolf)))