Index: configf.scm ================================================================== --- configf.scm +++ configf.scm @@ -90,15 +90,19 @@ (string-intersperse res " "))))) (hash-table-set! res curr-section-name (config:assoc-safe-add alist key val)) (loop (read-line inp) curr-section-name #f #f)) (loop (read-line inp) curr-section-name #f #f))) - (key-val-pr ( x key val ) (let ((alist (hash-table-ref/default res curr-section-name '())) - (realval (if (and environ-patt (string-match (regexp environ-patt) curr-section-name)) + (key-val-pr ( x key val ) (let* ((alist (hash-table-ref/default res curr-section-name '())) + (envar (and environ-patt (string-match (regexp environ-patt) curr-section-name))) + (realval (if envar (config:eval-string-in-environment val) val))) - (setenv key realval) + (if envar + (begin + (debug:print 4 "INFO: read-config key=" key ", val=" val ", realval=" realval) + (setenv key realval))) (hash-table-set! res curr-section-name (config:assoc-safe-add alist key realval)) (loop (read-line inp) curr-section-name key #f))) ;; if a continued line (cont-ln-rx ( x whsp val ) (let ((alist (hash-table-ref/default res curr-section-name '()))) Index: launch.scm ================================================================== --- launch.scm +++ launch.scm @@ -60,10 +60,11 @@ (runname (assoc/default 'runname cmdinfo)) (megatest (assoc/default 'megatest cmdinfo)) (mt-bindir-path (assoc/default 'mt-bindir-path cmdinfo)) (fullrunscript (if runscript (conc testpath "/" runscript) #f)) (db #f)) + (debug:print 2 "Exectuing " test-name " on " (get-host-name)) (change-directory testpath) ;; apply pre-overrides before other variables. The pre-override vars must not ;; clobbers things from the official sources such as megatest.config and runconfigs.config (if (string? set-vars) @@ -88,10 +89,11 @@ (begin (debug:print 0 "Failed to setup, exiting") (exit 1))) ;; now can find our db (set! db (open-db)) + (set-megatest-env-vars db run-id) ;; these may be needed by the launching process (change-directory work-area) (set-run-config-vars db run-id) ;; environment overrides are done *before* the remaining critical envars. (alist->env-vars env-ovrd) (set-megatest-env-vars db run-id) Index: runconfig.scm ================================================================== --- runconfig.scm +++ runconfig.scm @@ -11,17 +11,21 @@ (include "common_records.scm") (define (setup-env-defaults db fname run-id already-seen #!key (environ-patt #f)) (let* ((keys (get-keys db)) (keyvals (get-key-vals db run-id)) - (keyval (thekey (string-intersperse (map (lambda (x)(if x x "-na-")) keyvals) "/")) (confdat (read-config fname #f #f environ-patt: environ-patt)) (whatfound (make-hash-table)) (sections (list "default" thekey))) (debug:print 4 "Using key=\"" thekey "\"") - + + (for-each + (lambda (key val) + (setenv (vector-ref key 0) val)) + keys keyvals) + (for-each (lambda (section) (let ((section-dat (hash-table-ref/default confdat section #f))) (if section-dat (for-each @@ -42,6 +46,6 @@ (define (set-run-config-vars db run-id) (let ((runconfigf (conc *toppath* "/runconfigs.config"))) (if (file-exists? runconfigf) (setup-env-defaults db runconfigf run-id #f environ-patt: ".*") (debug:print 0 "WARNING: You do not have a run config file: " runconfigf)))) - + Index: runs.scm ================================================================== --- runs.scm +++ runs.scm @@ -550,10 +550,12 @@ (deferred '()) ;; delay running these since they have a waiton clause (runconfigf (conc *toppath* "/runconfigs.config"))) ;; on the first pass or call to run-tests set FAILS to NOT_STARTED if ;; -keepgoing is specified + (set-megatest-env-vars db run-id) ;; these may be needed by the launching process + (if (file-exists? runconfigf) (setup-env-defaults db runconfigf run-id *already-seen-runconfig-info* environ-patt: ".*") (debug:print 0 "WARNING: You do not have a run config file: " runconfigf)) (if (and (eq? *passnum* 0) @@ -590,11 +592,13 @@ (define (run-one-test db run-id test-name keyvallst) (debug:print 1 "Launching test " test-name) ;; All these vars might be referenced by the testconfig file reader (setenv "MT_TEST_NAME" test-name) ;; (setenv "MT_RUNNAME" (args:get-arg ":runname")) - (set-megatest-env-vars db run-id) ;; these may be needed by the launching process + + ;; (set-megatest-env-vars db run-id) ;; these may be needed by the launching process + (change-directory *toppath*) (let* ((test-path (conc *toppath* "/tests/" test-name)) ;; could use test:get-testconfig here ... (test-configf (conc test-path "/testconfig")) (testexists (and (file-exists? test-configf)(file-read-access? test-configf))) (test-conf (if testexists (read-config test-configf #f #t) (make-hash-table))) @@ -830,10 +834,12 @@ (deferred '()) ;; delay running these since they have a waiton clause (keepgoing (hash-table-ref/default flags "-keepgoing" #f)) (test-names '()) (runconfigf (conc *toppath* "/runconfigs.config")) (required-tests '())) + + (set-megatest-env-vars db run-id) ;; these may be needed by the launching process (if (file-exists? runconfigf) (setup-env-defaults db runconfigf run-id *already-seen-runconfig-info* "pre-launch-env-vars") (debug:print 0 "WARNING: You do not have a run config file: " runconfigf))