Megatest

Check-in [ae21e2aec1]
Login
Overview
Comment:tested basic functionality - custom context menu items now available
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.65-custom-menu
Files: files | file ages | folders
SHA1: ae21e2aec14b38a3186f609656779e22eec3a11b
User & Date: bb on 2018-02-14 00:33:59
Other Links: branch diff | manifest | tags
Context
2018-02-14
00:35
tested basic functionality - custom context menu items now available Leaf check-in: ae42e0260e user: bb tags: v1.65-custom-menu
00:33
tested basic functionality - custom context menu items now available check-in: ae21e2aec1 user: bb tags: v1.65-custom-menu
2018-02-13
23:10
wip check-in: 915e74bc33 user: bb tags: v1.65-custom-menu
Changes

Modified dashboard-context-menu.scm from [01bb33e0f6] to [15cb83ed76].

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
;;======================================================================
;; Copyright 2006-2012, Matthew Welland.
;; 
;;  This program is made available under the GNU GPL version 2.0 or
;;  greater. See the accompanying file COPYING for details.
;; 
;;  This program is distributed WITHOUT ANY WARRANTY; without even the
;;  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;;  PURPOSE.
;;======================================================================

;;======================================================================

;; Test info panel
;;======================================================================

(use format fmt)
(require-library iup)
(import (prefix iup iup:))

(use canvas-draw)












>
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
;;======================================================================
;; Copyright 2006-2012, Matthew Welland.
;; 
;;  This program is made available under the GNU GPL version 2.0 or
;;  greater. See the accompanying file COPYING for details.
;; 
;;  This program is distributed WITHOUT ANY WARRANTY; without even the
;;  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;;  PURPOSE.
;;======================================================================

;;======================================================================
;; implementation of context menu that pops up on
;; right click on test cell in Runs & Runs Summary Tabs
;;======================================================================

(use format fmt)
(require-library iup)
(import (prefix iup iup:))

(use canvas-draw)
217
218
219
220
221
222
223















224
225


























226








227









228
229





230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
                        (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:custom-menu-items  run-id test-id target runname test-name testpatt item-test-path test-info)


























  '())


















(define (dashboard:context-menu  run-id test-id target runname test-name testpatt item-test-path test-info)
  (let* (





         (run-menu-items
          (dashboard:run-menu-items  run-id test-id target runname test-name testpatt item-test-path test-info))
         (test-menu-items
          (dashboard:test-menu-items  run-id test-id target runname test-name testpatt item-test-path test-info))
         (custom-menu-items
          (dashboard:custom-menu-items run-id test-id target runname test-name testpatt item-test-path test-info))
         (toplevel-menu-items
          (dashboard:toplevel-menu-items  run-id test-id target runname test-name testpatt item-test-path test-info))
         )
    (apply iup:menu
           `(,@toplevel-menu-items
             ,(iup:menu-item
              "Run"
              (apply iup:menu run-menu-items))
             ,(iup:menu-item
              "Test"
              (apply iup:menu test-menu-items))
             ,@(if (null? custom-menu-items)
                   '()
                   custom-menu-items)))))







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
|
|
>
>
>
>
>
|
















<
<
|
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310


311
                        (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]
;; <unique var> <menu item text, can have template variables> : <command line with template %variable%s>
;; item1  custom show run-id (%run-id%):echo "%run-id%"
;; item2  custom show test-id (%test-id%):echo "%test-id%"
;; item3  custom show target (%target%):echo "%target%"
;; item4  custom show test-name (%test-name%):echo "%test-name%"
;; item5  custom show test-patt (%test-patt%):echo "%test-patt%"
;; item6  custom show test-run-dir (%test-run-dir%):echo "%test-run-dir%"
;; 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)
  (let* ((vars (configf:section-vars *configdat* "custom-context-menu-items"))
         (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)))
         (if m
             (let* ((menu-item-text-raw (list-ref m 1))
                    (command-line-raw   (list-ref m 2))
                    (subst-alist ;; template vars
                          `(( "%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))
                            ( "%mt-root%" . ,mt-root)
                            ( "%run-area-home%" . ,*toppath*)
                            ( "%item-test-patt%" . ,item-test-path )))
                    (command-line ;; replace template vars
                          (foldr
                           (lambda (x i)
                             (string-substitute
                              (car x)
                              (->string (cdr x))
                              i
                              #t))
                           command-line-raw
                           subst-alist))
                    (menu-item-text ;; replace template vars
                          (foldr
                           (lambda (x i)
                             (string-substitute
                              (car x)
                              (->string (cdr x))
                              i
                              #t))
                           menu-item-text-raw
                           subst-alist)))
               (iup:menu-item
                menu-item-text
                #:action
                (lambda (obj)
                  ;; TODO: with-env-vars <runconfig target vars, env-override vars from mtest>
                  ;; TODO: with-env-vars MT_*

                  (let* ((foo 'foo))
                    (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
          (dashboard:run-menu-items  run-id test-id target runname test-name testpatt item-test-path test-info))
         (test-menu-items
          (dashboard:test-menu-items  run-id test-id target runname test-name testpatt item-test-path test-info))
         (custom-menu-items
          (dashboard:custom-menu-items run-id test-id target runname test-name testpatt item-test-path test-info))
         (toplevel-menu-items
          (dashboard:toplevel-menu-items  run-id test-id target runname test-name testpatt item-test-path test-info))
         )
    (apply iup:menu
           `(,@toplevel-menu-items
             ,(iup:menu-item
              "Run"
              (apply iup:menu run-menu-items))
             ,(iup:menu-item
              "Test"
              (apply iup:menu test-menu-items))


             ,@custom-menu-items))))

Modified scratch.org from [78eb448d8d] to [9cd657563e].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
* template variables
- run-id
- test-id
- item-test-path
- runname
- test-name
- target
* launch-type
- in an xterm (common:run-a-command ... )
* insertion
[custom-context-menu-items]
item1=Test/netbatch_diagnose:$MT_RUN_AREA_HOME/../bin/nbdiag -test-id %test-id -test-path %item-test-path
item2=netbatch_diagnose:$MT_RUN_AREA_HOME/../bin/nbdiag -test-id %test-id -test-path %item-test-path














|




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
* template variables
- run-id
- test-id
- item-test-path
- runname
- test-name
- target
* launch-type
- in an xterm (common:run-a-command ... )
* insertion
[custom-context-menu-items]
item1=Menu Item Text:$MT_RUN_AREA_HOME/../bin/nbdiag -test-id %test-id -test-path %item-test-path
item2=netbatch_diagnose:$MT_RUN_AREA_HOME/../bin/nbdiag -test-id %test-id -test-path %item-test-path