Index: common.scm ================================================================== --- common.scm +++ common.scm @@ -210,11 +210,11 @@ (define (assoc/default key lst . default) (let ((res (assoc key lst))) (if res (cadr res)(if (null? default) #f (car default))))) (define (common:get-testsuite-name) - (or (configf:lookup *configdat* "server" "testsuite" ) + (or (configf:lookup *configdat* "setup" "testsuite" ) (pathname-file *toppath*))) ;;====================================================================== ;; Misc utils ;;====================================================================== Index: http-transport.scm ================================================================== --- http-transport.scm +++ http-transport.scm @@ -275,12 +275,14 @@ ;; (condition-case (with-input-from-request "http://localhost"; #f read-lines) ;; ((exn http client-error) e (print e))) (set! res (handle-exceptions exn (begin - (debug:print 0 "ERROR: failure in with-input-from-request. Giving up.") + (debug:print 0 "WARNING: failure in with-input-from-request. Killing associated server to allow clean retry.") (debug:print 0 " message: " ((condition-property-accessor 'exn 'message) exn)) + (hash-table-delete! *runremote* run-id) + (tasks:kill-server-run-id run-id) #f) (with-input-from-request ;; was dat fullurl (list (cons 'key "thekey") (cons 'cmd cmd) Index: launch.scm ================================================================== --- launch.scm +++ launch.scm @@ -112,10 +112,15 @@ (debug:print 0 "Failed to setup, exiting") ;; (sqlite3:finalize! db) ;; (sqlite3:finalize! tdb) (exit 1))) (change-directory *toppath*) + + ;; NOTE: Current order is to process runconfigs *before* setting the MT_ vars. This + ;; seems non-ideal but could well break stuff + ;; BUG? BUG? BUG? + (let ((rconfig (full-runconfigs-read))) ;; (read-config (conc *toppath* "/runconfigs.config") #f #t sections: (list "default" target)))) ;; (setup-env-defaults (conc *toppath* "/runconfigs.config") run-id (make-hash-table) keyvals target) ;; (set-run-config-vars run-id keyvals target) ;; (db:get-target db run-id)) ;; Now have runconfigs data loaded, set environment vars (for-each (lambda (section) @@ -158,11 +163,13 @@ (list "MT_ITEM_INFO" (conc itemdat)) (list "MT_ITEMPATH" item-path) (list "MT_RUNNAME" runname) (list "MT_MEGATEST" megatest) (list "MT_TARGET" target) - (list "MT_LINKTREE" (configf:lookup *configdat* "setup" "linktree")))) + (list "MT_LINKTREE" (configf:lookup *configdat* "setup" "linktree")) + (list "MT_TESTSUITENAME" (common:get-testsuite-name)))) + (if mt-bindir-path (setenv "PATH" (conc (getenv "PATH") ":" mt-bindir-path))) ;; (change-directory top-path) ;; Can setup as client for server mode now ;; (client:setup) Index: portlogger.scm ================================================================== --- portlogger.scm +++ portlogger.scm @@ -26,20 +26,28 @@ (begin (system (conc "rm -f " fname)) (sqlite3:open-database fname)))) (handler (make-busy-timeout 136000)) (canwrite (file-write-access? fname))) + ;; (db-init (lambda () + ;; (sqlite3:execute + ;; db + ;; "CREATE TABLE IF NOT EXISTS ports ( + ;; port INTEGER PRIMARY KEY, + ;; state TEXT DEFAULT 'not-used', + ;; fail_count INTEGER DEFAULT 0, + ;; update_time TIMESTAMP DEFAULT (strftime('%s','now')) );")))) (sqlite3:set-busy-handler! db handler) (sqlite3:execute db "PRAGMA synchronous = 0;") - (if (not exists) - (sqlite3:execute - db - "CREATE TABLE IF NOT EXISTS ports ( + ;; (if (not exists) ;; needed with IF NOT EXISTS? + (sqlite3:execute + db + "CREATE TABLE IF NOT EXISTS ports ( port INTEGER PRIMARY KEY, state TEXT DEFAULT 'not-used', fail_count INTEGER DEFAULT 0, - update_time TIMESTAMP DEFAULT (strftime('%s','now')) );")) + update_time TIMESTAMP DEFAULT (strftime('%s','now')) );") db)) (define (portlogger:open-run-close proc . params) (let* ((fname (conc "/tmp/." (current-user-name) "-portlogger.db")) (avail (tasks:wait-on-journal fname 10))) ;; wait up to about 10 seconds for the journal to go away Index: runs.scm ================================================================== --- runs.scm +++ runs.scm @@ -66,10 +66,11 @@ keyvals) ;; Set up various and sundry known vars here (setenv "MT_RUN_AREA_HOME" toppath) (setenv "MT_RUNNAME" runname) (setenv "MT_TARGET" target) + (setenv "MT_TESTSUITENAME" (common:get-testsuite-name)) (set! envdat (append envdat (list (list "MT_RUN_AREA_HOME" toppath) (list "MT_RUNNAME" runname) (list "MT_TARGET" target)))) Index: tasks.scm ================================================================== --- tasks.scm +++ tasks.scm @@ -348,20 +348,22 @@ (unsetenv "TARGETHOST_LOGF") (unsetenv "TARGETHOST")) ;; look up a server by run-id and send it a kill, also delete the record for that server ;; -(define (tasks:kill-server-run-id run-id) +(define (tasks:kill-server-run-id run-id #!key (tag "default")) (let* ((tdb (tasks:open-db)) - (sdat (tasks:get-server mdb run-id))) + (sdat (tasks:get-server tdb run-id))) (if sdat (let ((hostname (vector-ref sdat 6)) - (pid (vector-ref sdat 5))) - (debug:print-info 0 "Killing server for run-id " run-id " on host " hostname " with pid " pid) + (pid (vector-ref sdat 5)) + (server-id (vector-ref sdat 0))) + (debug:print-info 0 "Killing server " server-id " for run-id " run-id " on host " hostname " with pid " pid) (tasks:kill-server hostname pid) - (tasks:server-delete-record mdb server-id tag) ) - (debug:print-info 0 "No server found for run-id " run-id ", nothing to kill")))) + (tasks:server-delete-record tdb server-id tag) ) + (debug:print-info 0 "No server found for run-id " run-id ", nothing to kill")) + (sqlite3:finalize! tdb))) ;; (if status ;; #t means alive ;; (begin ;; (if (equal? hostname (get-host-name)) ;; (handle-exceptions