Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -439,11 +439,12 @@ (args:get-arg "-runstep")) (if (not (getenv "MT_CMDINFO")) (begin (print "ERROR: MT_CMDINFO env var not set, commands -test-status, -runstep and -setlog must be called *inside* a megatest environment!") (exit 5)) - (let* ((cmdinfo (read (open-input-string (base64:base64-decode (getenv "MT_CMDINFO"))))) + (let* ((startingdir (current-directory)) + (cmdinfo (read (open-input-string (base64:base64-decode (getenv "MT_CMDINFO"))))) (testpath (assoc/default 'testpath cmdinfo)) (test-name (assoc/default 'test-name cmdinfo)) (runscript (assoc/default 'runscript cmdinfo)) (db-host (assoc/default 'db-host cmdinfo)) (run-id (assoc/default 'run-id cmdinfo)) @@ -471,37 +472,42 @@ (if (null? remargs) (begin (print "ERROR: nothing specified to run!") (sqlite3:finalize! db) (exit 6)) - (let* ((logprofile (args:get-arg "-logpro")) - (logfile (conc test-name ".log")) + (let* ((stepname (args:get-arg "-runstep")) + (logprofile (args:get-arg "-logpro")) + (logfile (conc stepname ".log")) (cmd (if (null? remargs) #f (car remargs))) (params (if cmd (cdr remargs) '())) (exitstat #f) (shell (last (string-split (get-environment-variable "SHELL") "/"))) (redir (case (string->symbol shell) ((tcsh csh ksh) ">&") ((zsh bash sh ash) "2>&1"))) - (fullcmd (string-intersperse - (cons cmd (list params redir logfile)) - " "))) + (fullcmd (conc "(" (string-intersperse + (cons cmd params) " ") + ") " redir " " logfile))) ;; mark the start of the test (test-set-status! db run-id test-name "start" "n/a" itemdat (args:get-arg "-m")) ;; close the db (sqlite3:finalize! db) ;; run the test step - (print "INFO: Running " fullcmd) - (set! exitstat (process-run fullcmd)) ;; cmd params)) + (print "INFO: Running \"" fullcmd "\"") + (change-directory startingdir) + (set! exitstat (system fullcmd)) ;; cmd params)) + (change-directory testpath) ;; re-open the db (set! db (open-db)) ;; run logpro if applicable ;; (process-run "ls" (list "/foo" "2>&1" "blah.log")) - (if logpro - (let ((htmllogfile (conc test-name ".html")) - (cmd (string-intersperse (list "logpro" logpro logfile "<" logfile ">" (conc test-name "_logpro.log")) " "))) - (print "INFO: running " cmd) - (set! exitstat (process-run cmd)) + (if logprofile + (let* ((htmllogfile (conc stepname ".html")) + (cmd (string-intersperse (list "logpro" logprofile htmllogfile "<" logfile ">" (conc stepname "_logpro.log")) " "))) + (print "INFO: running \"" cmd "\"") + (change-directory startingdir) + (set! exitstat (system cmd)) + (change-directory testpath) (test-set-log! db run-id test-name itemdat logfile))) (test-set-status! db run-id test-name "end" exitstat itemdat (args:get-arg "-m")) (sqlite3:finalize! db) (exit exitstat) ;; open the db ADDED tests/tests/runfirst/wasting_time.logpro Index: tests/tests/runfirst/wasting_time.logpro ================================================================== --- /dev/null +++ tests/tests/runfirst/wasting_time.logpro @@ -0,0 +1,1 @@ +;; put stuff here