@@ -96,10 +96,12 @@ typed-records s11n sparse-vectors sxml-serializer sxml-modifications + (prefix sxml-modifications sxml-) + sxml-transforms system-information z3 spiffy uri-common intarweb @@ -176,11 +178,11 @@ (include "db_records.scm") (include "run_records.scm") (include "test_records.scm") (include "common.scm") -(include "megatest-fossil-hash.scm") +;; (include "megatest-fossil-hash.scm") (include "configf.scm") (include "margs.scm") (include "process.scm") (include "keys.scm") @@ -216,38 +218,38 @@ ;;; ;; ;;; ;; (use sparse-vectors) ;;; ;; ;;; ;; (require-library mutils) ;;; -;;; ;; copied from egg call-with-environment-variables -;;; ;; -;;; (define (call-with-environment-variables variables thunk) -;;; ;; @("Sets up environment variable via dynamic-wind which are taken down after thunk." -;;; ;; (variables "An alist of the form {{'((\"var\" . \"value\") ...)}}") -;;; ;; (thunk "The thunk to execute with a modified environment")) -;;; (let ((pre-existing-variables -;;; (map (lambda (var-value) -;;; (let ((var (car var-value))) -;;; (cons var (get-environment-variable var)))) -;;; variables))) -;;; (dynamic-wind -;;; (lambda () (void)) -;;; (lambda () -;;; ;; (use posix) -;;; (for-each (lambda (var-value) -;;; (setenv (car var-value) (cdr var-value))) -;;; variables) -;;; (thunk)) -;;; (lambda () -;;; (for-each (lambda (var-value) -;;; (let ((var (car var-value)) -;;; (value (cdr var-value))) -;;; (if value -;;; (setenv var value) -;;; (unsetenv var)))) -;;; pre-existing-variables))))) -;;; +;; copied from egg call-with-environment-variables +;; +(define (call-with-environment-variables variables thunk) + ;; @("Sets up environment variable via dynamic-wind which are taken down after thunk." + ;; (variables "An alist of the form {{'((\"var\" . \"value\") ...)}}") + ;; (thunk "The thunk to execute with a modified environment")) + (let ((pre-existing-variables + (map (lambda (var-value) + (let ((var (car var-value))) + (cons var (get-environment-variable var)))) + variables))) + (dynamic-wind + (lambda () (void)) + (lambda () +;; (use posix) + (for-each (lambda (var-value) + (setenv (car var-value) (cdr var-value))) + variables) + (thunk)) + (lambda () + (for-each (lambda (var-value) + (let ((var (car var-value)) + (value (cdr var-value))) + (if value + (setenv var value) + (unsetenv var)))) + pre-existing-variables))))) + ;;; ;;; ;;; (define *usage-log-file* #f) ;; put path to file for logging usage in this var in the ~/.megatestrc file ;;; (define *usage-use-seconds* #t) ;; for Epoc seconds in usage logging change this to #t in ~/.megatestrc file ;;; @@ -679,21 +681,22 @@ ;;; (if targ (setenv "MT_TARGET" targ))) ;;; ;;; ;; The watchdog is to keep an eye on things like db sync etc. ;;; ;; ;;; -;;; ;; TODO: for multiple areas, we will have multiple watchdogs; and multiple threads to manage -;;; (define *watchdog* (make-thread -;;; (lambda () -;;; (handle-exceptions -;;; exn -;;; (begin -;;; (print-call-chain) -;;; (print " message: " ((condition-property-accessor 'exn 'message) exn) ", exn=" exn)) -;;; (common:watchdog))) -;;; "Watchdog thread")) -;;; + +;; TODO: for multiple areas, we will have multiple watchdogs; and multiple threads to manage +(define *watchdog* (make-thread + (lambda () + (handle-exceptions + exn + (begin + (print-call-chain) + (print " message: " ((condition-property-accessor 'exn 'message) exn) ", exn=" exn)) + (common:watchdog))) + "Watchdog thread")) + ;;; ;;(if (not (args:get-arg "-server")) ;;; ;; (thread-start! *watchdog*)) ;; if starting a server; wait till we get to running state before kicking off watchdog ;;; (let* ((no-watchdog-args ;;; '("-list-runs" ;;; "-testdata-csv" @@ -1170,52 +1173,52 @@ ;;; (json-write targets)) ;;; (else ;;; (debug:print-error 0 *default-log-port* "dump output format " (args:get-arg "-dumpmode") " not supported for -list-targets"))) ;;; (set! *didsomething* #t)))) ;;; -;;; ;; cache the runconfigs in $MT_LINKTREE/$MT_TARGET/$MT_RUNNAME/.runconfig -;;; ;; -;;; (define (full-runconfigs-read) -;;; ;; in the envprocessing branch the below code replaces the further below code -;;; ;; (if (eq? *configstatus* 'fulldata) -;;; ;; *runconfigdat* -;;; ;; (begin -;;; ;; (launch:setup) -;;; ;; *runconfigdat*))) -;;; -;;; (let* ((rundir (if (and (getenv "MT_LINKTREE")(getenv "MT_TARGET")(getenv "MT_RUNNAME")) -;;; (conc (getenv "MT_LINKTREE") "/" (getenv "MT_TARGET") "/" (getenv "MT_RUNNAME")) -;;; #f)) -;;; (cfgf (if rundir (conc rundir "/.runconfig." megatest-version "-" megatest-fossil-hash) #f))) -;;; (if (and cfgf -;;; (common:file-exists? cfgf) -;;; (file-writable? cfgf) -;;; (common:use-cache?)) -;;; (configf:read-alist cfgf) -;;; (let* ((keys (rmt:get-keys)) -;;; (target (common:args-get-target)) -;;; (key-vals (if target (keys:target->keyval keys target) #f)) -;;; (sections (if target (list "default" target) #f)) -;;; (data (begin -;;; (setenv "MT_RUN_AREA_HOME" *toppath*) -;;; (if key-vals -;;; (for-each (lambda (kt) -;;; (setenv (car kt) (cadr kt))) -;;; key-vals)) -;;; ;; (read-config (conc *toppath* "/runconfigs.config") #f #t sections: sections)))) -;;; (runconfig:read (conc *toppath* "/runconfigs.config") target #f)))) -;;; (if (and rundir ;; have all needed variabless -;;; (directory-exists? rundir) -;;; (file-writable? rundir)) -;;; (begin -;;; (if (not (common:in-running-test?)) -;;; (configf:write-alist data cfgf)) -;;; ;; force re-read of megatest.config - this resolves circular references between megatest.config -;;; (launch:setup force-reread: #t) -;;; ;; (launch:cache-config) ;; there are two independent config cache locations, turning this one off for now. MRW. -;;; )) ;; we can safely cache megatest.config since we have a valid runconfig -;;; data)))) + +;; cache the runconfigs in $MT_LINKTREE/$MT_TARGET/$MT_RUNNAME/.runconfig +;; +(define (full-runconfigs-read) +;; in the envprocessing branch the below code replaces the further below code +;; (if (eq? *configstatus* 'fulldata) +;; *runconfigdat* +;; (begin +;; (launch:setup) +;; *runconfigdat*))) + (let* ((rundir (if (and (getenv "MT_LINKTREE")(getenv "MT_TARGET")(getenv "MT_RUNNAME")) + (conc (getenv "MT_LINKTREE") "/" (getenv "MT_TARGET") "/" (getenv "MT_RUNNAME")) + #f)) + (cfgf (if rundir (conc rundir "/.runconfig." megatest-version "-" megatest-fossil-hash) #f))) + (if (and cfgf + (common:file-exists? cfgf) + (file-writable? cfgf) + (common:use-cache?)) + (configf:read-alist cfgf) + (let* ((keys (rmt:get-keys)) + (target (common:args-get-target)) + (key-vals (if target (keys:target->keyval keys target) #f)) + (sections (if target (list "default" target) #f)) + (data (begin + (setenv "MT_RUN_AREA_HOME" *toppath*) + (if key-vals + (for-each (lambda (kt) + (setenv (car kt) (cadr kt))) + key-vals)) + ;; (read-config (conc *toppath* "/runconfigs.config") #f #t sections: sections)))) + (runconfig:read (conc *toppath* "/runconfigs.config") target #f)))) + (if (and rundir ;; have all needed variabless + (directory-exists? rundir) + (file-writable? rundir)) + (begin + (if (not (common:in-running-test?)) + (configf:write-alist data cfgf)) + ;; force re-read of megatest.config - this resolves circular references between megatest.config + (launch:setup force-reread: #t) + ;; (launch:cache-config) ;; there are two independent config cache locations, turning this one off for now. MRW. + )) ;; we can safely cache megatest.config since we have a valid runconfig + data)))) ;;; ;;; (if (args:get-arg "-show-runconfig") ;;; (let ((tl (launch:setup))) ;;; (push-directory *toppath*) ;;; (let ((data (full-runconfigs-read)))