Index: configf.scm ================================================================== --- configf.scm +++ configf.scm @@ -99,10 +99,12 @@ ;; (print "fullcmd=" fullcmd) (handle-exceptions exn (begin (debug:print 0 "WARNING: failed to process config input \"" l "\"") + (debug:print 0 " message: " ((condition-property-accessor 'exn 'message) exn)) + ;; (print "exn=" (condition->list exn)) (set! result (conc "#{( " cmdtype ") " cmd"}"))) (if (or allow-system (not (member cmdtype '("system" "shell")))) (with-input-from-string fullcmd (lambda () Index: launch.scm ================================================================== --- launch.scm +++ launch.scm @@ -437,17 +437,13 @@ (hash-table-ref/default testconfig "ezsteps" '()) #f))) (if testconfig (hash-table-set! *testconfigs* test-name testconfig) ;; cached for lazy reads later ... (begin - ;; got here but there are race condiitions - re-do all setup and try one more time - (if (launch:setup) - (begin - (launch:cache-config) - (set! testconfig (full-runconfigs-read))) ;; redunantly redundant, but does it resolve the race? + (launch:setup) (debug:print 0 "WARNING: no testconfig found for " test-name " in search path:\n " - (string-intersperse (tests:get-tests-search-path *configdat*) "\n "))))) + (string-intersperse (tests:get-tests-search-path *configdat*) "\n ")))) ;; after all that, still no testconfig? Time to abort (if (not testconfig) (begin (debug:print 0 "ERROR: Failed to resolve megatest.config, runconfigs.config and testconfig issues. Giving up now") (exit 1))) @@ -715,18 +711,20 @@ ;; sets; *configdat* (megatest.config info) ;; *runconfigdat* (runconfigs.config info) ;; *configstatus* (status of the read data) ;; (define (launch:setup-new #!key (force #f)) - (let* ((runname (common:args-get-runname)) + (let* ((toppath (or *toppath* (getenv "MT_RUN_AREA_HOME"))) + (runname (common:args-get-runname)) (target (common:args-get-target)) (linktree (common:get-linktree)) (rundir (if (and runname target linktree)(conc linktree "/" target "/" runname) #f)) (mtcachef (and rundir (conc rundir "/" ".megatest.cfg-" megatest-version "-" megatest-fossil-hash))) (rccachef (and rundir (conc rundir "/" ".runconfigs.cfg-" megatest-version "-" megatest-fossil-hash))) (cancreate (and rundir (file-exists? rundir)(file-write-access? rundir)))) ;; (print "runname: " runname " target: " target " mtcachef: " mtcachef " rccachef: " rccachef) + (if (not *toppath*)(set! *toppath* toppath)) ;; this probably is not needed? (cond ;; data was read and cached and available in *configstatus* ((eq? *configstatus* 'fulldata) *toppath*) ;; if mtcachef exists just read it @@ -745,11 +743,12 @@ pathenvvar: "MT_RUN_AREA_HOME"))) (if first-pass (begin (set! *configdat* (car first-pass)) (set! *configinfo* first-pass) - (set! *toppath* (cadr first-pass)) + (set! *toppath* (or toppath (cadr first-pass))) ;; use the gathered data unless already have it + (set! toppath *toppath*) ;; the seed read is done, now read runconfigs, cache it then read megatest.config one more time and cache it (let* ((keys (rmt:get-keys)) (key-vals (if target (keys:target->keyval keys target) #f)) (sections (if target (list "default" target) #f)) ;; for runconfigs (linktree (or (getenv "MT_LINKTREE") @@ -761,19 +760,21 @@ (setenv (car kt) (cadr kt))) key-vals)) (read-config (conc *toppath* "/runconfigs.config") #f #t sections: sections)))) (if cancreate (configf:write-alist runconfigdat rccachef)) (set! *runconfigdat* runconfigdat) - (let ((second-pass (find-and-read-config - (or (args:get-arg "-config") "megatest.config") - environ-patt: "env-override" - given-toppath: (get-environment-variable "MT_RUN_AREA_HOME") - pathenvvar: "MT_RUN_AREA_HOME"))) - (if cancreate (configf:write-alist (car second-pass) mtcachef)) - (set! *configdat* (car second-pass)) - (set! *toppath* (cadr second-pass)) - (if cancreate (set! *configstatus* 'fulldata))))) + (if cancreate (configf:write-alist *configdat* mtcachef)) + (if cancreate (set! *configstatus* 'fulldata)))) + ;; (let ((second-pass (find-and-read-config + ;; (or (args:get-arg "-config") "megatest.config") + ;; environ-patt: "env-override" + ;; given-toppath: (get-environment-variable "MT_RUN_AREA_HOME") + ;; pathenvvar: "MT_RUN_AREA_HOME"))) + ;; (if cancreate (configf:write-alist (car second-pass) mtcachef)) + ;; (set! *configdat* (car second-pass)) + ;; (set! *toppath* (or toppath (cadr second-pass))) ;; this should be a no-op, remove it later + ;; (if cancreate (set! *configstatus* 'fulldata))))) ;; no configs found? should not happen but let's try to recover gracefully, return an empty hash-table (set! *configdat* (make-hash-table)) ))) ;; else read what you can and set the flag accordingly (else @@ -786,17 +787,15 @@ (rdat (read-config (conc (or *toppath* (get-environment-variable "MT_RUN_AREA_HOME")(cadr cfgdat)) "/runconfigs.config") #f #t sections: sections))) (set! *configinfo* cfgdat) (set! *configdat* (car cfgdat)) (set! *runconfigdat* rdat) - (set! *toppath* (cadr cfgdat)) + (set! *toppath* (or toppath (cadr cfgdat))) + (set! toppath *toppath*) ;; remove this sillyness later (set! *configstatus* 'partial)))) - ;; final house keeping - (let* ((keys (rmt:get-keys)) - (key-vals (if target (keys:target->keyval keys target) #f)) - (sections (if target (list "default" target) #f)) ;; for runconfigs - (linktree (or (getenv "MT_LINKTREE") + ;; additional house keeping + (let* ((linktree (or (getenv "MT_LINKTREE") (if *configdat* (configf:lookup *configdat* "setup" "linktree") #f)))) (if linktree (if (not (file-exists? linktree)) (begin (handle-exceptions