@@ -35,10 +35,24 @@ (include "common_records.scm") (include "db_records.scm") (include "run_records.scm") +(define (dboard:launch-testpanel run-id test-id) + (let* (;; (cfg-sh (conc *common:this-exe-dir* "/cfg.sh")) + ;; (cmd (conc + ;; (if (common:file-exists? cfg-sh) + ;; (conc "source "cfg-sh" && ") + ;; "") + ;; *common:this-exe-fullpath* + ;; " -test " run-id "," test-id + ;; " &")) + (cmd (conc *common:this-exe-dir*"/../dashboard " + "-test " run-id "," test-id + " &"))) + (system cmd))) + (define (dashboard:run-menu-items run-id test-id target runname test-name testpatt item-test-path test-info) (list (iup:menu-item (conc "Rerun " testpatt) @@ -146,13 +160,42 @@ (cmd (conc (if (string-search editor-rx editor) (conc "xterm -e " editor) editor) " " tconfig " &"))) (system cmd)))))) + +(define (dashboard:step-logs-menu-item run-id test-id target runname test-name testpatt item-test-path test-info) + (let* ((steps (tests:get-compressed-steps run-id test-id)) ;; # + (rundir (db:test-get-rundir test-info))) + + (iup:menu-item + "Step logs" + (apply iup:menu + (map (lambda (step) + (let ((stepname (vector-ref step 0)) + (logfile (vector-ref step 5)) + (status (vector-ref step 3))) + (iup:menu-item + (conc stepname "/" (if (string=? logfile "") "no log!" logfile) " (" status ")") + #:action (lambda (obj) + (let ((fullfile (conc rundir "/" logfile))) + (if (common:file-exists? fullfile) + (dcommon:run-html-viewer fullfile) + (message-window (conc "file " fullfile " not found")))))))) + steps))))) (define (dashboard:toplevel-menu-items run-id test-id target runname test-name testpatt item-test-path test-info) (list + + (iup:menu-item + "Test Control Panel" + #:action + (lambda (obj) + (dboard:launch-testpanel run-id test-id))) + + (dashboard:step-logs-menu-item run-id test-id target runname test-name testpatt item-test-path test-info) + (iup:menu-item (conc "Rerun " item-test-path) #:action (lambda (obj) (common:run-a-command @@ -185,16 +228,10 @@ "Launch subrun dashboard" #:action (lambda (obj) (subrun:launch-dashboard rundir))) (iup:vbox))) - (iup:menu - (iup:menu-item - "Test Control Panel" - #:action - (lambda (obj) - (launch-testpanel run-id test-id))) (iup:menu-item (conc "View Log " item-test-path) #:action (lambda (obj) @@ -203,27 +240,11 @@ (fullfile (conc rundir "/" logf))) (if (common:file-exists? fullfile) (dcommon:run-html-viewer fullfile) (message-window (conc "file " fullfile " not found."))))) ) - (let* ((steps (tests:get-compressed-steps run-id test-id)) ;; # - (rundir (db:test-get-rundir test-info))) - (iup:menu-item - "Step logs" - (apply iup:menu - (map (lambda (step) - (let ((stepname (vector-ref step 0)) - (logfile (vector-ref step 5)) - (status (vector-ref step 3))) - (iup:menu-item - (conc stepname "/" (if (string=? logfile "") "no log!" logfile) " (" status ")") - #:action (lambda (obj) - (let ((fullfile (conc rundir "/" logfile))) - (if (common:file-exists? fullfile) - (dcommon:run-html-viewer fullfile) - (message-window (conc "file " fullfile " not found")))))))) - steps))))))) + )) ;; example section for megatest.config: ;; ;; ;; [custom-context-menu-items] ;; # : @@ -277,18 +298,27 @@ i #t)) menu-item-text-raw subst-alist))) (iup:menu-item - menu-item-text + (conc "*"menu-item-text) #:action (lambda (obj) ;; TODO: with-env-vars ;; TODO: with-env-vars MT_* - (let* ((foo 'foo)) - (common:run-a-command command-line))))) + (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)))))) #f))) vars))) (define (dashboard:context-menu run-id test-id target runname test-name testpatt item-test-path test-info) (let* ((run-menu-items