Megatest

Check-in [b0b795e94c]
Login
Overview
Comment:Clean up output of -show-keys. Use struct for keeping all the misc data associated with an area
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.70-ndboard
Files: files | file ages | folders
SHA1: b0b795e94c31289415eabd886d41c405372f0369
User & Date: matt on 2022-10-30 21:56:17
Other Links: branch diff | manifest | tags
Context
2022-10-30
22:59
info from -show commands should go to stdout. Misc progress on newdashboard check-in: e4d1922be4 user: matt tags: v1.70-ndboard
21:56
Clean up output of -show-keys. Use struct for keeping all the misc data associated with an area check-in: b0b795e94c user: matt tags: v1.70-ndboard
20:55
Switch dashboard.scm to use treemod. Updated Makefile deps for newdashboard. check-in: f09a7b7261 user: matt tags: v1.70-ndboard
Changes

Modified megatest.scm from [33833baced] to [806d7f7e0d].

2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
    (let ((db #f)
	  (keys #f))
      (if (not (launch:setup))
	  (begin
	    (debug:print 0 *default-log-port* "Failed to setup, exiting")
	    (exit 1)))
      (set! keys (rmt:get-keys)) ;;  db))
      (debug:print 1 *default-log-port* "Keys: " (string-intersperse keys ", "))
      (if (sqlite3:database? db)(sqlite3:finalize! db))
      (set! *didsomething* #t)))

(if (args:get-arg "-gui")
    (begin
      (debug:print 0 *default-log-port* "Look at the dashboard for now")
      ;; (megatest-gui)
      (set! *didsomething* #t)))







|
<







2277
2278
2279
2280
2281
2282
2283
2284

2285
2286
2287
2288
2289
2290
2291
    (let ((db #f)
	  (keys #f))
      (if (not (launch:setup))
	  (begin
	    (debug:print 0 *default-log-port* "Failed to setup, exiting")
	    (exit 1)))
      (set! keys (rmt:get-keys)) ;;  db))
      (debug:print 0 *default-log-port* (string-intersperse keys " "))

      (set! *didsomething* #t)))

(if (args:get-arg "-gui")
    (begin
      (debug:print 0 *default-log-port* "Look at the dashboard for now")
      ;; (megatest-gui)
      (set! *didsomething* #t)))

Modified newdashboard.scm from [bf479b8af3] to [f00b30fbcd].

19
20
21
22
23
24
25

26
27

28
29

30
31
32
33
34
35
36
37
38

39
40
41
42
43
44
45
;;======================================================================

;; (declare (uses common))
;; (declare (uses megatest-version))
(declare (uses mtargs))
(declare (uses treemod))


(use srfi-1 posix regex regex-case srfi-69 typed-records sparse-vectors)
(use format

     (prefix iup iup:)
     canvas-draw)

(import canvas-draw-iup)
;; (debug:setup)

(module ndboard
    *

(import scheme
	chicken
	data-structures

	format
	(prefix iup iup:)
	canvas-draw
	canvas-draw-iup
	matchable
	srfi-1 posix regex regex-case
	srfi-69 typed-records sparse-vectors ;; defstruct







>
|
|
>


>

<







>







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
;;======================================================================

;; (declare (uses common))
;; (declare (uses megatest-version))
(declare (uses mtargs))
(declare (uses treemod))

(use srfi-1
     posix regex regex-case srfi-69 typed-records sparse-vectors
     format
     extras
     (prefix iup iup:)
     canvas-draw)

(import canvas-draw-iup)


(module ndboard
    *

(import scheme
	chicken
	data-structures
	extras
	format
	(prefix iup iup:)
	canvas-draw
	canvas-draw-iup
	matchable
	srfi-1 posix regex regex-case
	srfi-69 typed-records sparse-vectors ;; defstruct
113
114
115
116
117
118
119



120







121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136






































137
138

139
140
141
142
143
144
145

;; areas
;;

(define *areas* (make-hash-table))
(defstruct area
  path



  )








(define (get-areas-file)
  (conc (get-environment-variable "HOME")"/.ndboard/areas.scm"))

(define (get-areas)
  (let* ((areas-file (get-areas-file)))
    (if (file-exists? areas-file)
	(with-input-from-file areas-file read))))

(define (register-area areadat)
  (hash-table-set! *areas* (car areadat)
		   (make-area (cdr areadat))))

(define (get-area-info area-name)
  (hash-table-ref/default *areas* area-name #f))







































;; gui utils
;;

(define (message-window msg)
  (iup:show
   (iup:dialog
    (iup:vbox 
     (iup:label msg #:margin "40x40")))))

(define (iuplistbox-fill-list lb items . default)







>
>
>
|
>
>
>
>
>
>
>











|




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


>







116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197

;; areas
;;

(define *areas* (make-hash-table))
(defstruct area
  path
  keys
  targets
  targets-update-time
  
  )

(define (area-get-path area-name)
  (let* ((adat (hash-table-ref/default *areas* area-name #f)))
    (if adat
	(area-path adat)
	#f)))

(define (get-areas-file)
  (conc (get-environment-variable "HOME")"/.ndboard/areas.scm"))

(define (get-areas)
  (let* ((areas-file (get-areas-file)))
    (if (file-exists? areas-file)
	(with-input-from-file areas-file read))))

(define (register-area areadat)
  (hash-table-set! *areas* (car areadat)
		   (make-area path: (cdr areadat))))

(define (get-area-info area-name)
  (hash-table-ref/default *areas* area-name #f))

;; megatest calls, run in "area"
;;

;; TODO store the last time the query was run
;; and clear cache based on timestamp on main.db
;;
(define (megatest-get-targets area-name)
  (let* ((ainfo   (get-area-info area-name))
	 (targets (area-targets ainfo)))
    (if targets
	targets
	(let* ((path (area-get-path area-name))
	       (raw-targs   (with-input-from-pipe
				(conc "megatest -list-targets -start-dir "path)
			      read-lines))
	       (clean-targs (filter (lambda (x)
				      (not (equal? x "default")))
				    raw-targs)))
	  (area-targets-set! ainfo clean-targs)
	  (area-targets-update-time-set! ainfo (current-seconds))
	  clean-targs))))

(define (megatest-get-keys area-name)
  (let* ((ainfo   (get-area-info area-name))
	 (keys    (area-keys ainfo)))
    (if keys
	keys
	(let* ((path     (area-path ainfo))
	       (keysstrs (with-input-from-pipe
			     (conc "megatest -show-keys -start-dir "path)
			   read-lines)))
	  (if (null? keysstrs)
	      (print "Unknown error getting keys for area "area-name", path: "path)
	      (let* ((keystr (car keysstrs))
		     (keys   (string-split keystr)))
		(area-keys-set! ainfo keys)
		keys))))))
	  
;; gui utils
;;

(define (message-window msg)
  (iup:show
   (iup:dialog
    (iup:vbox 
     (iup:label msg #:margin "40x40")))))

(define (iuplistbox-fill-list lb items . default)
174
175
176
177
178
179
180
181
182
183
184



185
186
187








188
189
190
191
192
193
194
   #:expand "YES"
   #:addexpanded "YES"
   #:size "10x"
   #:selection-cb
   (lambda (obj id state)
     (let* ((path (tree:node->path obj id)))
       (match path
	 ((treename)(print "nothing to do here"))
	 ((treename area)

	  #f ;; read the megatest area targets and fill out the tree



	  ))
       
       (print "obj: "obj", id: "id", state: "state", path: "path)))))









(define (runs window-id)
  (iup:hbox
   (add-widget "main-tree" (main-tree))
   ;;
   ))








|

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







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
   #:expand "YES"
   #:addexpanded "YES"
   #:size "10x"
   #:selection-cb
   (lambda (obj id state)
     (let* ((path (tree:node->path obj id)))
       (match path
	 ((treename) #f) ;;(print "nothing to do here"))
	 ((treename area)
	  (let ((tb (get-widget "main-tree")))
	    (refresh-targets tb area)))
	 ((treename area . target)
	  (print "area: "area", target: "target))
	 (else
	  (print "path: "path))
	  )
       #;(print "obj: "obj", id: "id", state: "state", path: "path)))))

(define (refresh-targets tb area)
  (let* ((targets (megatest-get-targets area)))
    (for-each
     (lambda (target)
       (let* ((t-path (string-split target "/")))
	 (tree:add-node tb "Areas" (cons area t-path))))
     targets)))

(define (runs window-id)
  (iup:hbox
   (add-widget "main-tree" (main-tree))
   ;;
   ))