Overview
Comment: | rebased newdashboard branch forward on v1.70 |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.70-ndboard |
Files: | files | file ages | folders |
SHA1: |
5820f690ed31f874b4a22449d8453c0f |
User & Date: | mrwellan on 2022-11-18 12:53:31 |
Other Links: | branch diff | manifest | tags |
Context
2022-11-23
| ||
20:16 | Merged in nohomehost since multi-area dashboard will depend on nohomehost Leaf check-in: aac724292e user: matt tags: v1.70-ndboard | |
2022-11-18
| ||
12:53 | rebased newdashboard branch forward on v1.70 check-in: 5820f690ed user: mrwellan tags: v1.70-ndboard | |
2022-11-10
| ||
13:37 | Fixed server/client signature. I think. check-in: bf877ecde8 user: matt tags: v1.70 | |
2022-10-31
| ||
09:47 | If .megatest does not exist but megatest.db does, try using it. NOTE: can't work with current calls creating .megatest area. Abandon this but keep the code for now. check-in: 533667efde user: matt tags: v1.70-ndboard | |
Changes
Modified Makefile from [6526b7c191] to [bb24b91254].
︙ | ︙ | |||
26 27 28 29 30 31 32 | process.scm runs.scm tasks.scm tests.scm genexample.scm \ http-transport.scm tdb.scm client.scm mt.scm \ ezsteps.scm lock-queue.scm rmt.scm api.scm \ subrun.scm portlogger.scm archive.scm env.scm \ diff-report.scm cgisetup/models/pgdb.scm # module source files | | > | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | process.scm runs.scm tasks.scm tests.scm genexample.scm \ http-transport.scm tdb.scm client.scm mt.scm \ ezsteps.scm lock-queue.scm rmt.scm api.scm \ subrun.scm portlogger.scm archive.scm env.scm \ diff-report.scm cgisetup/models/pgdb.scm # module source files MSRCFILES = dbmod.scm dbfile.scm debugprint.scm mtargs.scm commonmod.scm \ treemod.scm all : $(PREFIX)/bin/.$(ARCHSTR) mtest ndboard dboard mtut tcmt # dbmod.import.o is just a hack here mofiles/dbfile.o : mofiles/debugprint.o dbmod.import.o mofiles/debugprint.o : mofiles/mtargs.o # ftail.scm rmtmod.scm commonmod.scm removed # MSRCFILES = ducttape-lib.scm pkts.scm stml2.scm cookie.scm mutils.scm \ |
︙ | ︙ | |||
92 93 94 95 96 97 98 99 100 101 102 103 104 105 | csc $(CSCOPTS) $(OFILES) $(MOFILES) $(MOIMPFILES) megatest.o -o mtest showmtesthash: @echo $(MTESTHASH) dboard : $(OFILES) $(GOFILES) dashboard.scm $(MOFILES) $(MOIMPFILES) megatest-version.scm megatest-fossil-hash.scm csc $(CSCOPTS) $(OFILES) dashboard.scm $(GOFILES) $(MOFILES) $(MOIMPFILES) -o dboard mtut: $(OFILES) $(MOFILES) megatest-fossil-hash.scm mtut.scm megatest-version.scm csc $(CSCOPTS) $(OFILES) $(MOFILES) mtut.scm -o mtut # include makefile.inc TCMTOBJS = \ | > > > | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | csc $(CSCOPTS) $(OFILES) $(MOFILES) $(MOIMPFILES) megatest.o -o mtest showmtesthash: @echo $(MTESTHASH) dboard : $(OFILES) $(GOFILES) dashboard.scm $(MOFILES) $(MOIMPFILES) megatest-version.scm megatest-fossil-hash.scm csc $(CSCOPTS) $(OFILES) dashboard.scm $(GOFILES) $(MOFILES) $(MOIMPFILES) -o dboard ndboard : $(OFILES) $(GOFILES) newdashboard.scm $(MOFILES) $(MOIMPFILES) megatest-version.scm megatest-fossil-hash.scm csc $(CSCOPTS) $(OFILES) newdashboard.scm $(GOFILES) $(MOFILES) $(MOIMPFILES) -o ndboard mtut: $(OFILES) $(MOFILES) megatest-fossil-hash.scm mtut.scm megatest-version.scm csc $(CSCOPTS) $(OFILES) $(MOFILES) mtut.scm -o mtut # include makefile.inc TCMTOBJS = \ |
︙ | ︙ | |||
221 222 223 224 225 226 227 | $(PREFIX)/bin/.$(ARCHSTR)/mtest : mtest utils/mk_wrapper @echo Installing to PREFIX=$(PREFIX) $(INSTALL) mtest $(PREFIX)/bin/.$(ARCHSTR)/mtest utils/mk_wrapper $(PREFIX) mtest $(PREFIX)/bin/megatest chmod a+x $(PREFIX)/bin/megatest | < < < < < < < < < | < < < < < < | | < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | > < | 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 | $(PREFIX)/bin/.$(ARCHSTR)/mtest : mtest utils/mk_wrapper @echo Installing to PREFIX=$(PREFIX) $(INSTALL) mtest $(PREFIX)/bin/.$(ARCHSTR)/mtest utils/mk_wrapper $(PREFIX) mtest $(PREFIX)/bin/megatest chmod a+x $(PREFIX)/bin/megatest $(PREFIX)/bin/.$(ARCHSTR)/dboard : dboard $(FILES) utils/mk_wrapper utils/mk_wrapper $(PREFIX) dboard $(PREFIX)/bin/dashboard chmod a+x $(PREFIX)/bin/dashboard $(INSTALL) dboard $(PREFIX)/bin/.$(ARCHSTR)/dboard # install dashboard as dboard so wrapper script can be called dashboard $(PREFIX)/bin/.$(ARCHSTR)/ndboard : ndboard $(FILES) utils/mk_wrapper utils/mk_wrapper $(PREFIX) ndboard $(PREFIX)/bin/newdashboard chmod a+x $(PREFIX)/bin/newdashboard $(INSTALL) ndboard $(PREFIX)/bin/.$(ARCHSTR)/ndboard $(PREFIX)/bin/.$(ARCHSTR)/lib/libpangox-1.0.so : lib/libpangox-1.0.so if [[ $(ARCHSTR) == 12.5 ]]; then \ mkdir -p $(PREFIX)/bin/.$(ARCHSTR)/lib; \ $(INSTALL) lib/libpangox-1.0.so $(PREFIX)/bin/.$(ARCHSTR)/lib/libpangox-1.0.so; \ fi $(PREFIX)/bin/.$(ARCHSTR)/lib/libpangox-1.0.so.0 : lib/libpangox-1.0.so.0 if [[ $(ARCHSTR) == 12.5 ]]; then \ mkdir -p $(PREFIX)/bin/.$(ARCHSTR)/lib; \ $(INSTALL) lib/libpangox-1.0.so.0 $(PREFIX)/bin/.$(ARCHSTR)/lib/libpangox-1.0.so.0; \ fi $(PREFIX)/bin/.$(ARCHSTR)/lib/libxcb-xlib.so.0 : lib/libxcb-xlib.so.0 if [[ $(ARCHSTR) == 12.5 ]]; then \ mkdir -p $(PREFIX)/bin/.$(ARCHSTR)/lib; \ $(INSTALL) lib/libxcb-xlib.so.0 $(PREFIX)/bin/.$(ARCHSTR)/lib/libxcb-xlib.so.0; \ fi install : $(PREFIX)/bin/.$(ARCHSTR) $(PREFIX)/bin/.$(ARCHSTR)/mtest $(PREFIX)/bin/megatest \ $(PREFIX)/bin/.$(ARCHSTR)/dboard $(PREFIX)/bin/.$(ARCHSTR)/ndboard $(PREFIX)/bin/dashboard \ $(HELPERS) $(PREFIX)/bin/nbfake \ $(PREFIX)/bin/.$(ARCHSTR)/mtexec $(PREFIX)/bin/mtexec $(PREFIX)/bin/serialize-env \ $(PREFIX)/bin/nbfind $(PREFIX)/bin/mtrunner $(PREFIX)/bin/viewscreen $(PREFIX)/bin/mt_xterm \ $(PREFIX)/bin/mt-old-to-new.sh $(PREFIX)/bin/mt-new-to-old.sh \ $(PREFIX)/share/docs/megatest_manual.html $(PREFIX)/bin/remrun \ $(PREFIX)/share/docs/megatest_manual.html $(PREFIX)/bin/remrun $(PREFIX)/bin/mtutil \ $(PREFIX)/bin/tcmt $(PREFIX)/share/db/mt-pg.sql \ $(PREFIX)/share/js/jquery-3.1.0.slim.min.js \ $(PREFIX)/bin/.$(ARCHSTR)/lib/libpangox-1.0.so \ $(PREFIX)/bin/.$(ARCHSTR)/lib/libpangox-1.0.so.0 \ $(PREFIX)/bin/.$(ARCHSTR)/lib/libxcb-xlib.so.0 # $(PREFIX)/bin/newdashboard $(PREFIX)/bin/.$(ARCHSTR) : mkdir -p $(PREFIX)/bin/.$(ARCHSTR) mkdir -p $(PREFIX)/bin/.$(ARCHSTR)/lib |
︙ | ︙ | |||
388 389 390 391 392 393 394 | clean : rm -f $(OFILES) $(GOFILES) $(MOFILES) $(TCMTOBJS) \ $(PREFIX)/megatest $(PREFIX)/dashboard mtest mtutil mtut \ tcmt readline-fix.scm serialize-env dboard *.o \ megatest-fossil-hash.* altdb.scm mofiles/*.o \ mofiles/*.o vg.o cookie.o dashboard-main.o \ ducttape-lib.o ftail.o mutils.o pkts.o rmtmod.o stml2.o \ | | | 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | clean : rm -f $(OFILES) $(GOFILES) $(MOFILES) $(TCMTOBJS) \ $(PREFIX)/megatest $(PREFIX)/dashboard mtest mtutil mtut \ tcmt readline-fix.scm serialize-env dboard *.o \ megatest-fossil-hash.* altdb.scm mofiles/*.o \ mofiles/*.o vg.o cookie.o dashboard-main.o \ ducttape-lib.o ftail.o mutils.o pkts.o rmtmod.o stml2.o \ tcmt.o *.import.scm *.import.o ndboard rm -f $(OFILES) $(GOFILES) $(MOFILES) $(TCMTOBJS) \ $(PREFIX)/megatest $(PREFIX)/dashboard mtest mtutil mtut \ tcmt ftail.import.scm readline-fix.scm serialize-env \ dboard dboard.o megatest.o dashboard.o \ megatest-fossil-hash.* altdb.scm mofiles/*.o vg.o rm -rf share |
︙ | ︙ |
Modified dashboard.scm from [6283f67b19] to [a97a4ba4cd].
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with Megatest. If not, see <http://www.gnu.org/licenses/>. ;; ;;====================================================================== (use format) (require-library iup) (import (prefix iup iup:)) (use canvas-draw) (import canvas-draw-iup) (use ducttape-lib) (use sqlite3 srfi-1 posix regex regex-case srfi-69 typed-records sparse-vectors) ;; defstruct (import (prefix sqlite3 sqlite3:)) (import dbfile) | > > > > > > > > > > > > > > > > > > | < < < < < < < < < < < < < < < < < | 14 15 16 17 18 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 49 50 51 52 53 54 55 56 57 | ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with Megatest. If not, see <http://www.gnu.org/licenses/>. ;; ;;====================================================================== (declare (uses common)) (declare (uses margs)) (declare (uses keys)) (declare (uses items)) (declare (uses db)) (declare (uses configf)) (declare (uses process)) (declare (uses launch)) (declare (uses runs)) (declare (uses dashboard-tests)) (declare (uses treemod)) (declare (uses dcommon)) (declare (uses dashboard-context-menu)) (declare (uses vg)) (declare (uses subrun)) (declare (uses mt)) (declare (uses dbfile)) (use format) (require-library iup) (import (prefix iup iup:)) (use canvas-draw) (import canvas-draw-iup) (use ducttape-lib) (use sqlite3 srfi-1 posix regex regex-case srfi-69 typed-records sparse-vectors) ;; defstruct (import (prefix sqlite3 sqlite3:)) (import dbfile) (import treemod) (include "common_records.scm") (include "db_records.scm") (include "run_records.scm") (include "task_records.scm") (include "megatest-version.scm") (include "megatest-fossil-hash.scm") |
︙ | ︙ | |||
635 636 637 638 639 640 641 | ;; ;; NOTE: Yes, this is used ;; (define (dboard:get-tests-for-run-duplicate tabdat run-id run testnamepatt key-vals) (let* ((start-time (current-seconds)) (access-mode (dboard:tabdat-access-mode tabdat)) (num-to-get (string->number (or (configf:lookup *configdat* "setup" "num-tests-to-get") | | | 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 | ;; ;; NOTE: Yes, this is used ;; (define (dboard:get-tests-for-run-duplicate tabdat run-id run testnamepatt key-vals) (let* ((start-time (current-seconds)) (access-mode (dboard:tabdat-access-mode tabdat)) (num-to-get (string->number (or (configf:lookup *configdat* "setup" "num-tests-to-get") "400"))) (states (hash-table-keys (dboard:tabdat-state-ignore-hash tabdat))) (statuses (hash-table-keys (dboard:tabdat-status-ignore-hash tabdat))) (do-not-use-db-file-timestamps #t) ;; (configf:lookup *configdat* "setup" "do-not-use-db-file-timestamps")) ;; this still hosts runs-summary-tab (do-not-use-query-timestamps #t) ;; (configf:lookup *configdat* "setup" "do-not-use-query-timestamps")) ;; this no longer troubles runs-summary-tab (sort-info (get-curr-sort)) (sort-by (vector-ref sort-info 1)) (sort-order (vector-ref sort-info 2)) |
︙ | ︙ |
Modified megatest.scm from [7c70251ef1] to [706b66691e].
︙ | ︙ | |||
2277 2278 2279 2280 2281 2282 2283 | (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)) | | < | 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)) (print (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 [a0c1909f88] to [b85c6e1ccc].
︙ | ︙ | |||
14 15 16 17 18 19 20 | ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with Megatest. If not, see <http://www.gnu.org/licenses/>. ;;====================================================================== | > > | > > > > > | > > < > > > > > > > > > > > > > | > > > | | | > | < | < | 14 15 16 17 18 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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with Megatest. If not, see <http://www.gnu.org/licenses/>. ;;====================================================================== ;; (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 sqlite3) (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 sqlite3 treemod (prefix mtargs args:) ) (include "megatest-version.scm") ;; (declare (uses launch)) ;; (declare (uses gutils)) ;; (declare (uses db)) ;; (declare (uses server)) ;; (declare (uses synchash)) ;; (declare (uses dcommon)) ;; ;; (include "common_records.scm") ;; (include "db_records.scm") ;; (include "key_records.scm") (define help (conc "Megatest Dashboard, documentation at http://www.kiatoa.com/fossils/megatest |
︙ | ︙ | |||
79 80 81 82 83 84 85 | (if (args:get-arg "-h") (begin (print help) (exit))) ;; ease debugging by loading ~/.dashboardrc | | | < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < | < < < < < < < < < < < | < < < < < < < | < < < < < < < < < | < < < < < < < < < < < < < < | < < < < < < < < | < < | < < < < | < < < < < < < < < < < < | < < | | < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < | < | | < < < < < < < < < | > > | | < < < < < < < < < | < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < | < < < | < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < > | < < < < < < < < < > > > < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < | < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < | | < < < | < < < < < < < < < < < | < < < | < < | < < < < < | < < < < | | | | | | | | | > > | | > | > > > > > > > | | 102 103 104 105 106 107 108 109 110 111 112 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 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 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 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 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 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | (if (args:get-arg "-h") (begin (print help) (exit))) ;; ease debugging by loading ~/.dashboardrc (let ((debugcontrolf (conc (get-environment-variable "HOME") "/.newdashboardrc"))) (if (file-exists? debugcontrolf) (load debugcontrolf))) (define *tim* (iup:timer)) (define *ord* #f) (iup:attribute-set! *tim* "TIME" 300) (iup:attribute-set! *tim* "RUN" "YES") ;; areas ;; (define *areas* (make-hash-table)) (defstruct area path keys targets targets-update-time (dbhs (make-hash-table)) ) (define (area-get-path area-name) (let* ((adat (get-area-info area-name))) (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)) (define (area-save-dbh area-name dbname mtdbh) (hash-table-set! (area-dbhs (get-area-info area-name)) dbname mtdbh)) (define (area-get-dbh area-name dbname) (hash-table-ref/default (area-dbhs (get-area-info area-name)) dbname #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)) (keysstr (with-input-from-pipe (conc "megatest -show-keys -start-dir "path) read-line))) (if (not (string? keysstr)) (print "Unknown error getting keys for area "area-name", path: "path) (let* ((keys (string-split keysstr))) (area-keys-set! ainfo keys) keys)))))) ;; megatest area database access functions ;; (defstruct mtdb name db path) ;; fall back to old megatest db if .megatest/dbname not found ;; (define (megatest-find-db path dbname) (let ((newpath (conc path"/.megatest/"dbname)) (oldpath (conc path"/megatest.db"))) (if (file-exists? newpath) newpath (if (file-exists? oldpath) oldpath #f)))) ;; dbname is main.db, 1.db ... (define (megatest-open-db area-name dbname) (let* ((mtdbh (area-get-dbh area-name dbname))) (if mtdbh mtdbh (let* ((ainfo (get-area-info area-name)) (path (area-path ainfo)) (dbpath (megatest-find-db path dbname)) (dbexists (and dbpath (file-exists? dbpath) (file-read-access? dbpath)))) (if dbexists (let* ((db (open-database dbpath))) (set-busy-handler! db (make-busy-timeout 136000)) (execute db "PRAGMA synchronous = 0;") (let* ((mtdbh (make-mtdb db: db path: dbpath))) (area-save-dbh area-name dbname mtdbh) mtdbh)) #f))))) ;; ADD on-exit to close the opened dbs ;; keys is list, targpatts is list, both same length ;; and *fully* specified ;; returns targvals and runname (define (megatest-get-run-names area-name keys targpatts) (let* ((mtdbh (megatest-open-db area-name "main.db")) (selector (string-intersperse (map (lambda (k v)(conc k" like '"v"'")) keys targpatts) " AND ")) (field-sel (string-intersperse keys ",")) (fullqry (conc "SELECT "field-sel",runname FROM runs WHERE "selector";"))) (print "fullqry="fullqry) (fold-row ;; proc init db-or-stmt . params) (lambda (res . row) (cons row res)) '() (mtdb-db mtdbh) ;; get the db handle fullqry))) ;; gui utils ;; (define (message-window msg) (iup:show (iup:dialog (iup:vbox (iup:label msg #:margin "40x40"))))) (define (iuplistbox-fill-list lb items . default) (let ((i 1) (selected-item (if (null? default) #f (car default)))) (iup:attribute-set! lb "VALUE" (if selected-item selected-item "")) (for-each (lambda (item) (iup:attribute-set! lb (number->string i) item) (if selected-item (if (equal? selected-item item) (iup:attribute-set! lb "VALUE" item))) ;; (number->string i)))) (set! i (+ i 1))) items) i)) ;; simple widget registration and finding (define *widgets* (make-hash-table)) (define (add-widget name wgt) (hash-table-set! *widgets* name wgt) wgt) (define (get-widget name) (hash-table-ref/default *widgets* name #f)) (define (pad-list l n)(append l (make-list (- n (length l))))) ;; the main tree, everything starts from here ;; (define (main-tree) (iup:treebox #:value 0 #:title "Areas" #: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"))) ;; wait, isn't this just "obj"? (refresh-targets tb area))) ((treename area . target) (let* ((keys (megatest-get-keys area))) (if (eq? (length keys)(length target)) (let* ((runnames (megatest-get-run-names area keys target))) (for-each (lambda (runnamedat) (tree:add-node obj "Areas" (cons area runnamedat))) runnames))))) (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)) )) (define (runs-init) (let* ((areas (get-areas)) (tb (get-widget "main-tree"))) (for-each (lambda (areadat) (tree:add-node tb "Areas" `(,(car areadat))) (register-area areadat)) areas))) ;; Browse and control a single run ;; (define (runcontrol window-id) (iup:hbox)) ;; Main Panel (define (main-panel window-id) (iup:dialog #:title "Megatest Control Panel" ;; #:menu (dcommon:main-menu) #:shrink "YES" (let ((tabtop (iup:tabs (add-widget "runs" (runs window-id)) ;; (tests window-id) (runcontrol window-id) ;; (mtest *toppath* window-id) ;; (rconfig window-id) ))) (iup:attribute-set! tabtop "TABTITLE0" "Runs") ;; (iup:attribute-set! tabtop "TABTITLE1" "Tests") (iup:attribute-set! tabtop "TABTITLE1" "Run Control") ;; (iup:attribute-set! tabtop "TABTITLE3" "megatest.config") ;; (iup:attribute-set! tabtop "TABTITLE4" "runconfigs.config") tabtop))) (define *current-window-id* 0) (define (newdashboard dbstruct) (let* ((data (make-hash-table)) (keys '()) ;; (db:get-keys dbstruct)) (runname "%") (testpatt "%") (keypatts '()) ;; (map (lambda (k)(list k "%")) keys)) (states '()) (statuses '()) (nextmintime (current-milliseconds)) (my-window-id *current-window-id*)) (set! *current-window-id* (+ 1 *current-window-id*)) ;; (dboard:data-runs-set! *data* data) ;; make this data available to the rest of the application (iup:show (main-panel my-window-id)) (runs-init) ;; Yes, running iup:show will pop up a new panel ;; (iup:show (main-panel my-window-id)) (iup:callback-set! *tim* "ACTION_CB" (lambda (x) ;; Want to dedicate no more than 50% of the time to this so skip if ;; 2x delta time has not passed since last query #t #;(if (< nextmintime (current-milliseconds)) (let* ((starttime (current-milliseconds)) ;; (changes (dcommon:run-update keys data runname keypatts testpatt states statuses 'full my-window-id)) (endtime (current-milliseconds))) (set! nextmintime (+ endtime (* 2 (- endtime starttime)))) ;; (debug:print 11 *default-log-port* "CHANGE(S): " (car changes) "...")) ) (print "Server overloaded")))))) ) ;;====================================================================== ;; D A S H B O A R D ;;====================================================================== (import ndboard) (newdashboard #f) (iup:main-loop) |
Added treemod.scm version [54272b22b5].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 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 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | ;;====================================================================== ;; Copyright 2006-2013, Matthew Welland. ;; ;; This file is part of Megatest. ;; ;; Megatest is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; ;; Megatest is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with Megatest. If not, see <http://www.gnu.org/licenses/>. ;; ;;====================================================================== (declare (unit treemod)) ;; (declare (uses margs)) ;; (declare (uses launch)) ;; ;; (declare (uses megatest-version)) ;; (declare (uses gutils)) ;; (declare (uses db)) ;; (declare (uses server)) ;; ;; (declare (uses synchash)) ;; (declare (uses dcommon)) ;; ;; (include "megatest-version.scm") ;; (include "common_records.scm") ;; (include "db_records.scm") ;; (include "key_records.scm") (module treemod * (import scheme chicken data-structures (prefix iup iup:) canvas-draw iup regex srfi-1 srfi-13 format ) ;;====================================================================== ;; T R E E S T U F F ;;====================================================================== ;; path is a list of nodes, each the child of the previous ;; this routine returns the id so another node can be added ;; either as a leaf or as a branch ;; ;; BUG: This needs a stop sensor for when a branch is exhausted ;; (define (tree:find-node obj path) ;; start at the base of the tree (if (null? path) #f ;; or 0 ???? (let loop ((hed (car path)) (tal (cdr path)) (depth 0) (nodenum 0)) ;; nodes in iup tree are 100% sequential so iterate over nodenum (if (iup:attribute obj (conc "DEPTH" nodenum)) ;; end when no more nodes (let ((node-depth (string->number (iup:attribute obj (conc "DEPTH" nodenum)))) (node-title (iup:attribute obj (conc "TITLE" nodenum)))) (if (and (equal? depth node-depth) (equal? hed node-title)) ;; yep, this is the one! (if (null? tal) ;; end of the line nodenum (loop (car tal)(cdr tal)(+ depth 1)(+ 1 nodenum))) ;; this is the case where we found part of the hierarchy but not ;; all of it, i.e. the node-depth went from deep to less deep (if (> depth node-depth) ;; (+ 1 node-depth)) #f (loop hed tal depth (+ nodenum 1))))) #f)))) ;; top is the top node name zeroeth node VALUE=0 (define (tree:add-node obj top nodelst #!key (userdata #f)) (let ((curr-top (iup:attribute obj "TITLE0"))) (if (or (not (string? curr-top)) (string-null? curr-top) (string-match "^\\s*$" curr-top)) (iup:attribute-set! obj "ADDBRANCH0" top)) (cond ((not (equal? top (iup:attribute obj "TITLE0"))) (print "ERROR: top name " top " doesn't match " (iup:attribute obj "TITLE0"))) ((null? nodelst)) (else (let loop ((hed (car nodelst)) (tal (cdr nodelst)) (depth 1) (pathl (list top))) ;; Because the tree dialog changes node numbers when ;; nodes are added or removed we must look up nodes ;; each and every time. 0 is the top node so default ;; to that. (let* ((newpath (append pathl (list hed))) (parentnode (tree:find-node obj pathl)) (nodenum (tree:find-node obj newpath))) ;; Add the branch under lastnode if not found (if (not nodenum) (begin (iup:attribute-set! obj (conc "ADDBRANCH" parentnode) hed) ;; ERROR? ADDING DATA TO PARENT, DONT WE WANT IT ON CREATED NODE? (if userdata (iup:attribute-set! obj (conc "USERDATA" parentnode) userdata)) (if (null? tal) #t ;; reset to top (loop (car nodelst)(cdr nodelst) 1 (list top)))) (if (null? tal) ;; if null here then this path has already been added #t (loop (car tal)(cdr tal)(+ depth 1) newpath))))))))) (define (tree:node->path obj nodenum) (let loop ((currnode 0) (path '())) (let* ((node-depth (string->number (iup:attribute obj (conc "DEPTH" currnode)))) (node-title (iup:attribute obj (conc "TITLE" currnode))) (trimpath (if (and (not (null? path)) (> (length path) node-depth)) (take path node-depth) path)) (newpath (append trimpath (list node-title)))) (if (>= currnode nodenum) newpath (loop (+ currnode 1) newpath))))) (define (tree:delete-node obj top node-path) ;; node-path is a list of strings (let ((id (tree:find-node obj (cons top node-path)))) (print "Found node to remove " id " for path " top " " node-path) (iup:attribute-set! obj (conc "DELNODE" id) "SELECTED"))) ) #| (let* ((tb (iup:treebox #:value 0 #:name "Runs" #:expand "YES" #:addexpanded "NO" #:selection-cb (lambda (obj id state) ;; (print "obj: " obj ", id: " id ", state: " state) (let* ((run-path (tree:node->path obj id)) (run-id (tree-path->run-id (cdr run-path)))) (if run-id (begin (dboard:data-curr-run-id-set! data run-id) (dashboard:update-run-summary-tab))) ;; (print "path: " (tree:node->path obj id) " run-id: " run-id) )))) |# |