Index: megatest-version.scm ================================================================== --- megatest-version.scm +++ megatest-version.scm @@ -1,7 +1,7 @@ ;; Always use two digit decimal ;; 1.01, 1.02...1.10,1.11 ... 1.99,2.00.. (declare (unit megatest-version)) -(define megatest-version 1.5114) +(define megatest-version 1.5115) Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -185,10 +185,13 @@ "-archive" "-repl" "-lock" "-unlock" "-listservers" + ;; mist queries + "-list-disks" + "-list-targets" ;; queries "-test-paths" ;; get path(s) to a test, ordered by youngest first "-runall" ;; run all tests "-remove-runs" @@ -259,19 +262,33 @@ (if (args:get-arg "-env2file") (begin (save-environment-as-files (args:get-arg "-env2file")) (set! *didsomething* #t))) + +(if (args:get-arg "-list-targets") + (print (string-intersperse + (sort (map car (hash-table->alist + (read-config "runconfigs.config" + (make-hash-table) #f))) string 20 seconds since ;; server last used then start shutdown + +;; (let ((die-timeout ( + (let loop ((count 0)) (thread-sleep! 4) ;; no need to do this very often (db:write-cached-data) ;; (print "Server running, count is " count) (if (< count 1) ;; 3x3 = 9 secs aprox @@ -153,13 +156,13 @@ (debug:print 0 "ERROR: Heartbeat failed, committing servercide") (exit)) (open-run-close tasks:server-update-heartbeat tasks:open-db (car server-info))) ;; (if ;; (or (> numrunning 0) ;; stay alive for two days after last access (if (> (+ *last-db-access* - ;; (* 48 60 60) ;; 48 hrs + (* 70 60 60) ;; 70 hrs is enough that the server will still be available after the weekend ;; 60 ;; one minute - (* 60 60) ;; one hour + ;; (* 60 60) ;; one hour ) (current-seconds)) (begin ;; (debug:print-info 2 "Server continuing, tests running: " numrunning ", seconds since last db access: " (- (current-seconds) *last-db-access*)) (debug:print-info 2 "Server continuing, seconds since last db access: " (- (current-seconds) *last-db-access*)) @@ -188,14 +191,14 @@ (if (> trynum 0) (server:find-free-port-and-open iface s (+ p 1) trynum: (- trynum 1)) (debug:print-info 0 "Tried ports up to " p " but all were in use. Please try a different port range by starting the server with parameter \" -port N\" where N is the starting port number to use"))) (let ((zmq-url (conc "tcp://" iface ":" p))) - (print "Trying to start server on " zmq-url) + (debug:print 2 "Trying to start server on " zmq-url) (bind-socket s zmq-url) (set! *runremote* #f) - (debug:print 0 "Server started on " zmq-url) + (debug:print 2 "Server started on " zmq-url) (mutex-lock! *heartbeat-mutex*) (set! *server-info* (open-run-close tasks:server-register tasks:open-db (current-process-id) iface p 0 'live)) (mutex-unlock! *heartbeat-mutex*) (list iface s port))))) @@ -273,12 +276,16 @@ (debug:print-info 2 "Failed to login or connect to " conurl) (set! *runremote* #f) #f))))) (if (> numtries 0) (let ((exe (car (argv)))) - (debug:print-info 1 "No server available, attempting to start one...") + (debug:print-info 2 "No server available, attempting to start one...") (process-run exe (list "-server" "-" "-debug" (conc *verbosity*))) + ;; (process-fork (lambda () + ;; (server:launch) + ;; (exit) ;; should never get here .... + ;; )) (sleep 5) ;; give server time to start ;; we are starting a server, do not try again! That can lead to ;; recursively starting many processes!!! (server:client-setup numtries: 0)) (debug:print-info 1 "Too many attempts, giving up"))))) @@ -288,26 +295,26 @@ (if (not *toppath*) (if (not (setup-for-run)) (begin (debug:print 0 "ERROR: cannot find megatest.config, exiting") (exit)))) - (debug:print-info 1 "Starting the standalone server") + (debug:print-info 2 "Starting the standalone server") (let ((hostinfo (open-run-close tasks:get-best-server tasks:open-db))) (if hostinfo - (debug:print-info 1 "NOT starting new server, one is already running on " (car hostinfo) ":" (cadr hostinfo)) + (debug:print-info 2 "NOT starting new server, one is already running on " (car hostinfo) ":" (cadr hostinfo)) (if *toppath* (let* ((th1 (make-thread (lambda () (let ((server-info #f)) ;; wait for the server to be online and available (let loop () - (debug:print-info 1 "Waiting for the server to come online before starting heartbeat") + (debug:print-info 2 "Waiting for the server to come online before starting heartbeat") (thread-sleep! 2) (mutex-lock! *heartbeat-mutex*) (set! server-info *server-info* ) (mutex-unlock! *heartbeat-mutex*) (if (not server-info)(loop))) - (debug:print 1 "Server alive, starting self-ping") + (debug:print 2 "Server alive, starting self-ping") (server:self-ping (cadr server-info)(caddr server-info)))) "Self ping")) (th2 (make-thread (lambda () (server:run (args:get-arg "-server"))) "Server run")) (th3 (make-thread (lambda () (server:keep-running)) "Keep running")))