@@ -257,12 +257,13 @@ ;; item7 custom show run-area-home (%run-area-home%):echo "%run-area-home%" ;; item8 custom show megatest root (%mt-root%):echo "%mt-root%" ;; item9 custom ls : ls -lrt ;; item10 custom see $MT_RUN_AREA_HOME (not yet implemented) : echo $MT_RUN_AREA_HOME -(define (dashboard:custom-menu-items run-id test-id target runname test-name testpatt item-test-path test-info) +(define (dashboard:custom-menu-items run-id test-id target run-name test-name testpatt item-test-path test-info) (let* ((vars (configf:section-vars *configdat* "custom-context-menu-items")) + (item-path (db:test-get-item-path test-info)) (mt-root (pathname-directory (pathname-directory *common:this-exe-dir* )))) (filter-map (lambda (var) (let* ((val (configf:lookup *configdat* "custom-context-menu-items" var)) (m (string-match "^\\s*([^:]+?)\\s*:\\s*(.*?)\\s*$" val))) @@ -273,13 +274,15 @@ `(( "%run-id%" . ,run-id ) ( "%test-id%" . ,test-id ) ( "%target%" . ,target ) ( "%test-name%" . ,test-name) ( "%test-patt%" . ,testpatt) - ( "%test-run-dir%" . ,(db:test-get-rundir test-info)) + ( "%test-run-dir%" . ,(db:test-get-rundir test-info)) ( "%mt-root%" . ,mt-root) + ( "%run-name%" . ,run-name) ( "%run-area-home%" . ,*toppath*) + ( "%item-path%" . ,item-path) ( "%item-test-patt%" . ,item-test-path ))) (command-line ;; replace template vars (foldr (lambda (x i) (string-substitute @@ -301,24 +304,28 @@ subst-alist))) (iup:menu-item (conc "*"menu-item-text) #:action (lambda (obj) - ;; TODO: with-env-vars - ;; TODO: with-env-vars MT_* (let* ((scheme-match (string-match "^#(\\(.*)" command-line))) ;;(BB> "cmdline is >"command-line"<") - (if scheme-match - (begin - (handle-exceptions - exn - (print "error with custom menu scheme") - (begin - ;;(BB> "gonna eval it!") - (eval (with-input-from-string (cadr scheme-match) read))))) - (common:run-a-command command-line)))))) + (common:with-env-vars + ;; TODO: with-env-vars + ;; TODO: with-env-vars MT_* + (runs:get-mt-env-alist run-id run-name target test-name item-path) + + (lambda () + (if scheme-match + (begin + (handle-exceptions + exn + (print "error with custom menu scheme") + (begin + ;;(BB> "gonna eval it!") + (eval (with-input-from-string (cadr scheme-match) read))))) + (common:run-a-command command-line with-vars: #t)))))))) #f))) vars))) (define (dashboard:context-menu run-id test-id target runname test-name testpatt item-test-path test-info) (let* ((run-menu-items