Index: common.scm ================================================================== --- common.scm +++ common.scm @@ -905,10 +905,22 @@ (begin (debug:print-error 0 *default-log-port* "Unable to find megatest home directory.") #f) (loop (pathname-directory thepath))))) )) + + +(define (common:db-tmp-area-path) + (conc "/tmp/" + (current-user-name) + "/megatest_localdb/" + (common:get-testsuite-name) + "/" + (string-translate *toppath* "/" ".") + ) +) + ;;====================================================================== ;; redefine for future cleanup (converge on area-name, the more generic ;; (define common:get-area-name common:get-testsuite-name) Index: dashboard.scm ================================================================== --- dashboard.scm +++ dashboard.scm @@ -204,10 +204,11 @@ tabdat)) ;; gets and calls updater list based on curr-tab-num ;; (define (dboard:common-run-curr-updaters commondat #!key (tab-num #f)) + (copy-db-to-tmp) (if (dboard:common-get-tabdat commondat tab-num: tab-num) ;; only update if there is a tabdat (let* ((tnum (or tab-num (dboard:commondat-curr-tab-num commondat))) (updaters (hash-table-ref/default (dboard:commondat-updaters commondat) tnum '()))) @@ -1940,11 +1941,11 @@ (dashboard:run-id->tests-mindat dest-run-id tabdat runs-hash) hide-clean: hide-clean) #f))) -(define (dashboard:get-runs-hash tabdat) +(define (dashboard:get-runs-hash tabdat) (let* ((access-mode (dboard:tabdat-access-mode tabdat)) (last-runs-update 0);;(dboard:tabdat-last-runs-update tabdat)) (runs-dat (rmt:get-runs-by-patt (dboard:tabdat-keys tabdat) "%" #f #f #f #f last-runs-update)) (runs-header (vector-ref runs-dat 0)) ;; 0 is header, 1 is list of records (runs (vector-ref runs-dat 1)) @@ -3854,14 +3855,30 @@ ) "update buttons once")) (th2 (make-thread iup:main-loop "Main loop"))) (print "Starting main loop") (thread-start! th2) (thread-join! th2) - ) - ) - ) - ) + ) + ) + ) +) + +(define last-copy-time 0) + + +;; Do this only if in read-only mode. + +(define (copy-db-to-tmp) + (let* ((db-file "./.megatest/main.db")) + (if (and (not (file-write-access? db-file)) ( > (current-seconds) (+ last-copy-time 5))) + (begin + (system (conc "rsync -a .megatest " (common:get-db-tmp-area))) + (set! last-copy-time (current-seconds)) + ) + ) + ) +) ;; ########################### top level code ######################## ;; check for MT_* environment variables and exit if found (if (not (args:get-arg "-test")) (begin Index: dbfile.scm ================================================================== --- dbfile.scm +++ dbfile.scm @@ -473,11 +473,11 @@ (define (dbfile:cautious-open-database fname init-proc #!optional (tries-left 50)) (let* ((busy-file (conc fname"-journal")) (delay-time (* (- 51 tries-left) 1.1)) - (write-access (file-write-access? fname)) + (write-access (file-write-access? fname)) (retry (lambda () (thread-sleep! delay-time) (if (> tries-left 0) (dbfile:cautious-open-database fname init-proc (- tries-left 1)))))) (assert (>= tries-left 0) (conc "FATAL: too many attempts in dbfile:cautious-open-database of "fname", giving up.")) @@ -492,24 +492,23 @@ (dbfile:print-err "INFO: forcing journal rollup "busy-file) (dbfile:brute-force-salvage-db fname))) (dbfile:cautious-open-database fname init-proc (- tries-left 1))) (let* ((result (condition-case - (if write-access - (dbfile:with-simple-file-lock - (conc fname ".lock") - (lambda () - (let* ((db-exists (file-exists? fname)) - (db (sqlite3:open-database fname))) - (if (and init-proc (not db-exists)) - (init-proc db)) - db))) - (if (file-exists? fname ) + (if write-access + (dbfile:with-simple-file-lock + (conc fname ".lock") + (lambda () + (let* ((db-exists (file-exists? fname)) + (db (sqlite3:open-database fname))) + (if (and init-proc (not db-exists)) + (init-proc db)) + db))) + (if (file-exists? fname ) (sqlite3:open-database fname) - #f - ) - ) + ) + ) (exn (io-error) (dbfile:print-err exn "ERROR: i/o error with " fname ". Check permissions, disk space etc. and try again.") (retry)) (exn (corrupt) (dbfile:print-err exn "ERROR: database " fname " is corrupt. Repair it to proceed.") Index: dcommon.scm ================================================================== --- dcommon.scm +++ dcommon.scm @@ -528,11 +528,14 @@ (common:without-vars command "MT_.*")) (message-window (conc "Directory " rundir " not found")))))) (xterm) - (print "Adding xterm code"))))) + ) + ) + ) +) ;;====================================================================== ;; D A T A T A B L E S ;;====================================================================== Index: launch.scm ================================================================== --- launch.scm +++ launch.scm @@ -1450,12 +1450,12 @@ (contour #f)) ;; NOT READY FOR THIS (args:get-arg "-contour"))) (let loop ((delta (- (current-seconds) *last-launch*)) (launch-delay (configf:lookup-number *configdat* "setup" "launch-delay" default: 0))) (if (> launch-delay delta) (begin - (if (common:low-noise-print 1200 "test launch delay") ;; every two hours or so remind the user about launch delay. - (debug:print-info 0 *default-log-port* "NOTE: test launches are delayed by " launch-delay " seconds. See megatest.config launch-delay setting to adjust.")) ;; launch of " test-name " for " (- launch-delay delta) " seconds")) + ;; (if (common:low-noise-print 1200 "test launch delay") ;; every two hours or so remind the user about launch delay. + ;; (debug:print-info 0 *default-log-port* "NOTE: test launches are delayed by " launch-delay " seconds. See megatest.config launch-delay setting to adjust.")) ;; launch of " test-name " for " (- launch-delay delta) " seconds")) (thread-sleep! (- launch-delay delta)) (loop (- (current-seconds) *last-launch*) launch-delay)))) (change-directory *toppath*) (alist->env-vars ;; consolidate this code with the code in megatest.scm for "-execute", *maybe* - the longer they are set the longer each launch takes (must be non-overlapping with the vars) (append Index: utils/mt_xterm ================================================================== --- utils/mt_xterm +++ utils/mt_xterm @@ -16,14 +16,25 @@ # # You should have received a copy of the GNU General Public License # along with Megatest. If not, see . MT_TMPDISPLAY=$DISPLAY -if [ -e megatest.sh ];then - source megatest.sh -fi +MT_TMPUSER=$USER +MT_HOME=$HOME + +tmpfile=`mktemp` + +grep -v "export USER=" megatest.sh | grep -v "export HOME=" > $tmpfile +source $tmpfile +rm $tmpfile + +# if [ -e megatest.sh ];then +#source megatest.sh +#fi export DISPLAY=$MT_TMPDISPLAY +export USER=$USER +export HOME=$MT_HOME if [ x"$MT_XTERM_CMD" == "x" ];then exec xterm "$@" else exec $MT_XTERM_CMD