Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -19,22 +19,23 @@ # rm .o ; make install CSCOPTS='-profile' ; ... ; chicken-profile | less SHELL=/bin/bash PREFIX=$(PWD) CSCOPTS= INSTALL=install -SRCFILES = common.scm items.scm launch.scm runconfig.scm \ +SRCFILES = common.scm launch.scm runconfig.scm \ server.scm configf.scm db.scm \ process.scm runs.scm tests.scm genexample.scm \ - http-transport.scm filedb.scm tdb.scm mt.scm \ + http-transport.scm filedb.scm mt.scm \ ezsteps.scm lock-queue.scm sdb.scm rmt.scm api.scm \ subrun.scm archive.scm env.scm \ diff-report.scm # module source files MSRCFILES = dbmod.scm servermod.scm apimod.scm commonmod.scm rmtmod.scm \ ods.scm configfmod.scm transport.scm portlogger.scm tasks.scm \ - pgdb.scm margsmod.scm debugprint.scm client.scm + pgdb.scm margsmod.scm debugprint.scm client.scm items.scm \ + tdb.scm MOFILES = $(addprefix mofiles/,$(MSRCFILES:%.scm=%.o)) MOIMPFILES = $(MSRCFILES:%.scm=%.import.o) # ftail.scm rmtmod.scm commonmod.scm removed @@ -85,14 +86,14 @@ # ARCHSTR=$(BASH_MACHTYPE)_$(shell lsb_release -sr) ARCHSTR=$(shell if [[ -e /usr/bin/sw_vers ]]; then /usr/bin/sw_vers -productVersion; else lsb_release -sr; fi) PNGFILES = $(shell cd docs/manual;ls *png) -# all : $(PREFIX)/bin/.$(ARCHSTR) mtest dboard mtut ndboard all : $(PREFIX)/bin/.$(ARCHSTR) mtest dboard mtut tcmt mtest: $(OFILES) readline-fix.scm megatest.o $(MOFILES) $(MOIMPFILES) megatest-version.scm + @echo "Suggestion: run make build.pdf to regenerate dependencies" csc $(CSCOPTS) $(OFILES) $(MOFILES) $(MOIMPFILES) megatest.o -o mtest showmtesthash: @echo $(MTESTHASH) @@ -106,27 +107,23 @@ # include makefile.inc TCMTOBJS = \ api.o \ archive.o \ - cgisetup/models/pgdb.o \ - client.o \ common.o \ configf.o \ db.o \ env.o \ http-transport.o \ - items.o \ launch.o \ lock-queue.o \ mt.o \ process.o \ rmt.o \ runconfig.o \ runs.o \ server.o \ - tdb.o \ tests.o \ subrun.o \ ezsteps.o # ods.o \ @@ -445,12 +442,14 @@ csc $(CSCOPTS) portlogger-example.scm api.o archive.o client.o common.o configf.o dashboard-tests.o dashboard-context-menu.o db.o dcommon.o ezsteps.o filedb.o genexample.o gutils.o http-transport.o items.o launch.o lock-queue.o mofiles/margsmod.o mt.o mofiles/portlogger.o process.o rmt.o runconfig.o runs.o sdb.o server.o synchash.o mofiles/tasks.o tdb.o tests.o tree.o %.pdf : %.dot dot -Tpdf $*.dot -o $*.pdf -all.dot all-inc.dot : *.scm cgisetup/models/pgdb.scm - gendeps all *.scm +build.dot build-inc.dot : *.scm cgisetup/models/pgdb.scm + gendeps build *.scm + +# build.inc : build.dot buildmanual: cd docs/manual && make wikipage=plan Index: api.scm ================================================================== --- api.scm +++ api.scm @@ -19,7 +19,10 @@ ;; along with Megatest. If not, see . ;; ;;====================================================================== (use srfi-69 posix) + +(declare (unit api)) + Index: build.inc ================================================================== --- build.inc +++ build.inc @@ -1,54 +1,71 @@ # To regenerate this file do: # (cd utils/;ck52 csc gendeps.scm) && ./utils/gendeps allunits *scm # cp allunits.inc build.inc # -mofiles/apimod.o : mofiles/commonmod.o +mofiles/tdb.o : mofiles/dbmod.o +mofiles/tasks.o : mofiles/dbmod.o +mofiles/servermod.o : mofiles/dbmod.o +mofiles/rmtmod.o : mofiles/dbmod.o +mofiles/portlogger.o : mofiles/dbmod.o +mofiles/client.o : mofiles/dbmod.o mofiles/apimod.o : mofiles/dbmod.o +mofiles/tdb.o : mofiles/ods.o +mofiles/dbmod.o : mofiles/ods.o +mofiles/transport.o : mofiles/configfmod.o +mofiles/tasks.o : mofiles/configfmod.o +mofiles/servermod.o : mofiles/configfmod.o +mofiles/rmtmod.o : mofiles/configfmod.o +mofiles/portlogger.o : mofiles/configfmod.o +mofiles/pgdb.o : mofiles/configfmod.o +mofiles/items.o : mofiles/configfmod.o +mofiles/dcommonmod.o : mofiles/configfmod.o +mofiles/dbmod.o : mofiles/configfmod.o +mofiles/commonmod.o : mofiles/configfmod.o +mofiles/transport.o : mofiles/portlogger.o +mofiles/rmtmod.o : mofiles/portlogger.o +mofiles/rmtmod.o : mofiles/items.o +mofiles/rmtmod.o : mofiles/tdb.o +mofiles/tasks.o : mofiles/pgdb.o +mofiles/transport.o : mofiles/debugprint.o +mofiles/tdb.o : mofiles/debugprint.o +mofiles/tasks.o : mofiles/debugprint.o +mofiles/servermod.o : mofiles/debugprint.o +mofiles/rmtmod.o : mofiles/debugprint.o +mofiles/portlogger.o : mofiles/debugprint.o +mofiles/pgdb.o : mofiles/debugprint.o +mofiles/ods.o : mofiles/debugprint.o +mofiles/items.o : mofiles/debugprint.o +mofiles/dcommonmod.o : mofiles/debugprint.o +mofiles/dbmod.o : mofiles/debugprint.o +mofiles/configfmod.o : mofiles/debugprint.o +mofiles/commonmod.o : mofiles/debugprint.o +mofiles/client.o : mofiles/debugprint.o mofiles/apimod.o : mofiles/debugprint.o mofiles/apimod.o : mofiles/tasks.o -mofiles/apimod.o : mofiles/client.o -mofiles/commonmod.o : mofiles/debugprint.o -mofiles/commonmod.o : mofiles/margsmod.o -mofiles/commonmod.o : mofiles/configfmod.o -mofiles/configfmod.o : mofiles/margsmod.o -mofiles/client.o : mofiles/servermod.o -mofiles/client.o : mofiles/rmtmod.o -mofiles/dbmod.o : mofiles/commonmod.o -mofiles/dbmod.o : mofiles/configfmod.o -mofiles/dbmod.o : mofiles/debugprint.o -mofiles/dbmod.o : mofiles/margsmod.o -mofiles/dbmod.o : mofiles/ods.o +mofiles/transport.o : mofiles/commonmod.o +mofiles/tdb.o : mofiles/commonmod.o +mofiles/tasks.o : mofiles/commonmod.o +mofiles/servermod.o : mofiles/commonmod.o +mofiles/rmtmod.o : mofiles/commonmod.o +mofiles/portlogger.o : mofiles/commonmod.o +mofiles/pgdb.o : mofiles/commonmod.o +mofiles/ods.o : mofiles/commonmod.o +mofiles/items.o : mofiles/commonmod.o mofiles/dcommonmod.o : mofiles/commonmod.o -mofiles/dcommonmod.o : mofiles/configfmod.o -mofiles/dcommonmod.o : mofiles/debugprint.o -mofiles/debugprint.o : mofiles/margsmod.o -mofiles/ods.o : mofiles/commonmod.o -mofiles/ods.o : mofiles/debugprint.o -mofiles/portlogger.o : mofiles/commonmod.o -mofiles/portlogger.o : mofiles/configfmod.o -mofiles/portlogger.o : mofiles/dbmod.o -mofiles/portlogger.o : mofiles/debugprint.o +mofiles/dbmod.o : mofiles/commonmod.o +mofiles/client.o : mofiles/commonmod.o +mofiles/apimod.o : mofiles/commonmod.o +mofiles/transport.o : mofiles/apimod.o mofiles/rmtmod.o : mofiles/apimod.o -mofiles/rmtmod.o : mofiles/commonmod.o -mofiles/rmtmod.o : mofiles/configfmod.o -mofiles/rmtmod.o : mofiles/dbmod.o -mofiles/rmtmod.o : mofiles/debugprint.o -mofiles/rmtmod.o : mofiles/portlogger.o -mofiles/servermod.o : mofiles/commonmod.o -mofiles/servermod.o : mofiles/configfmod.o -mofiles/servermod.o : mofiles/dbmod.o -mofiles/servermod.o : mofiles/debugprint.o -mofiles/servermod.o : mofiles/rmtmod.o -mofiles/tasks.o : mofiles/commonmod.o -mofiles/tasks.o : mofiles/configfmod.o -mofiles/tasks.o : mofiles/dbmod.o -mofiles/tasks.o : mofiles/debugprint.o +mofiles/tdb.o : mofiles/margsmod.o mofiles/tasks.o : mofiles/margsmod.o -mofiles/tasks.o : mofiles/pgdb.o -mofiles/transport.o : mofiles/apimod.o -mofiles/transport.o : mofiles/commonmod.o -mofiles/transport.o : mofiles/configfmod.o -mofiles/transport.o : mofiles/debugprint.o -mofiles/transport.o : mofiles/portlogger.o +mofiles/rmtmod.o : mofiles/margsmod.o +mofiles/pgdb.o : mofiles/margsmod.o +mofiles/debugprint.o : mofiles/margsmod.o +mofiles/dbmod.o : mofiles/margsmod.o +mofiles/configfmod.o : mofiles/margsmod.o +mofiles/commonmod.o : mofiles/margsmod.o mofiles/transport.o : mofiles/servermod.o +mofiles/client.o : mofiles/servermod.o +mofiles/servermod.o : mofiles/rmtmod.o Index: dashboard.scm ================================================================== --- dashboard.scm +++ dashboard.scm @@ -23,21 +23,32 @@ (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 - matchable) ;; defstruct +(use sqlite3 + srfi-1 + posix + regex + regex-case + srfi-69 + typed-records + sparse-vectors + matchable) + (import (prefix sqlite3 sqlite3:)) (declare (uses common)) (declare (uses margsmod)) (import margsmod) (declare (uses items)) +(import items) + (declare (uses db)) (declare (uses configf)) (declare (uses process)) (declare (uses launch)) (declare (uses runs)) Index: db_records.scm ================================================================== --- db_records.scm +++ db_records.scm @@ -76,15 +76,15 @@ ;; (dbr:dbstruct-locdbs-set! v (make-hash-table)) ;; v)) ;; Returns the database for a particular run-id fron the dbstruct:localdbs ;; -(define (dbr:dbstruct-localdb v run-id) - (hash-table-ref/default (dbr:dbstruct-locdbs v) run-id #f)) - -(define (dbr:dbstruct-localdb-set! v run-id db) - (hash-table-set! (dbr:dbstruct-locdbs v) run-id db)) +;; (define (dbr:dbstruct-localdb v run-id) +;; (hash-table-ref/default (dbr:dbstruct-locdbs v) run-id #f)) +;; +;; (define (dbr:dbstruct-localdb-set! v run-id db) +;; (hash-table-set! (dbr:dbstruct-locdbs v) run-id db)) (define (make-db:test)(make-vector 20)) (define-inline (db:test-get-id vec) (vector-ref vec 0)) (define-inline (db:test-get-run_id vec) (vector-ref vec 1)) Index: dcommon.scm ================================================================== --- dcommon.scm +++ dcommon.scm @@ -30,10 +30,11 @@ (declare (uses gutils)) (declare (uses db)) (declare (uses commonmod)) (declare (uses debugprint)) + (import commonmod) (import debugprint) (declare (uses dbmod)) (import dbmod) Index: http-transport.scm ================================================================== --- http-transport.scm +++ http-transport.scm @@ -64,11 +64,11 @@ (import servermod) (declare (uses transport)) (import transport) -(declare (uses margsmod)]) +(declare (uses margsmod)) (import margsmod) (include "common_records.scm") (include "db_records.scm") ;; (include "js-path.scm") Index: items.scm ================================================================== --- items.scm +++ items.scm @@ -21,18 +21,24 @@ ;; (temperature "cool medium hot") ;; (season "summer winter fall spring"))) (declare (unit items)) (declare (uses common)) - (declare (uses commonmod)) (declare (uses debugprint)) +(declare (uses configfmod)) + +(module items + * + +(import scheme chicken data-structures extras ports) (import commonmod) (import debugprint) - -(declare (uses configfmod)) (import configfmod) +(import srfi-69 + srfi-1 + ) (include "common_records.scm") ;; Puts out all combinations (define (process-itemlist hierdepth curritemkey itemlist) @@ -212,9 +218,8 @@ (items:read-items-file slashf 'slash) (items:read-items-file sxmlf 'sxml) (items:read-items-file spacef 'space)) '(())))) -;; (pp (item-assoc->item-list itemdat)) - +) Index: pgdb.scm ================================================================== --- pgdb.scm +++ pgdb.scm @@ -1,1 +1,1 @@ -(include "cgisetup/models/pgdb.scm") +cgisetup/models/pgdb.scm Index: rmtmod.scm ================================================================== --- rmtmod.scm +++ rmtmod.scm @@ -24,10 +24,12 @@ (declare (uses apimod)) (declare (uses dbmod)) (declare (uses configfmod)) (declare (uses margsmod)) (declare (uses portlogger)) +(declare (uses items)) +(declare (uses tdb)) (module rmtmod * (import scheme chicken data-structures extras ports) @@ -56,10 +58,12 @@ (import debugprint) (import dbmod) (import configfmod) (import margsmod) (import portlogger) +(import items) +(import tdb) (defstruct alldat (areapath #f) (ulexdat #f) ) @@ -2568,8 +2572,44 @@ ;; (server:kind-run areapath) (server:start-and-wait areapath) (debug:print-info 0 *default-log-port* "client:setup, no server registered, remaining-tries=" remaining-tries) (thread-sleep! 1) ;; (+ 5 (random (- 20 remaining-tries)))) ;; give server a little time to start up, randomize a little to avoid start storms. (client:setup-http areapath remaining-tries: (- remaining-tries 1))))))))) + +;; NOTE: Run this local with #f for db !!! +(define (tdb:load-test-data run-id test-id) + (let loop ((lin (read-line))) + (if (not (eof-object? lin)) + (begin + (debug:print 4 *default-log-port* lin) + ;;(when lin ;; this when blocked stack dump caused by .dat file from logpro being 0-byte. fixed by upgrading logpro + (rmt:csv->test-data run-id test-id lin) + ;;) + (loop (read-line))))) + ;; roll up the current results. + ;; FIXME: Add the status too + (rmt:test-data-rollup run-id test-id #f)) + +;; NOTE: Run this local with #f for db !!! +(define (tdb:load-logpro-data run-id test-id) + (let loop ((lin (read-line))) + (if (not (eof-object? lin)) + (begin + (debug:print 4 *default-log-port* lin) + ;;(when lin ;; this when blocked stack dump caused by .dat file from logpro being 0-byte. fixed by upgrading logpro + (rmt:csv->test-data run-id test-id lin) + ;;) + (loop (read-line))))) + ;; roll up the current results. + ;; FIXME: Add the status too + (rmt:test-data-rollup run-id test-id #f)) + +;; find and open the testdat.db file for an existing test +(define (tdb:open-test-db-by-test-id test-id #!key (work-area #f)) + (let* ((test-path (if work-area + work-area + (rmt:test-get-rundir-from-test-id test-id)))) + (debug:print 3 *default-log-port* "TEST PATH: " test-path) + (open-test-db test-path))) ) Index: tdb.scm ================================================================== --- tdb.scm +++ tdb.scm @@ -20,32 +20,41 @@ ;;====================================================================== ;; Database access ;;====================================================================== -(require-extension (srfi 18) extras tcp) -(use sqlite3 srfi-1 posix regex regex-case srfi-69 csv-xml s11n md5 message-digest base64) -(import (prefix sqlite3 sqlite3:)) -(import (prefix base64 base64:)) - (declare (unit tdb)) (declare (uses common)) (declare (uses client)) (declare (uses mt)) (declare (uses db)) (declare (uses margsmod)) -(import margsmod) - (declare (uses commonmod)) (declare (uses debugprint)) +(declare (uses dbmod)) +(declare (uses ods)) + +(module tdb + * + +(import scheme chicken data-structures extras ports) + +(import (srfi 18) extras tcp) +(use sqlite3 srfi-1 posix regex regex-case srfi-69 csv-xml s11n md5 message-digest base64) + + + +(import (prefix sqlite3 sqlite3:)) +(import (prefix base64 base64:)) + +(import margsmod) + (import commonmod) (import debugprint) -(declare (uses dbmod)) (import dbmod) -(declare (uses ods)) (import ods) (include "common_records.scm") (include "db_records.scm") (include "key_records.scm") @@ -161,18 +170,10 @@ (debug:print-info 11 *default-log-port* "open-test-db END (unsucessful)" work-area) ;; provide an in-mem db (this is dangerous!) (tdb:testdb-initialize baddb) baddb))) -;; find and open the testdat.db file for an existing test -(define (tdb:open-test-db-by-test-id test-id #!key (work-area #f)) - (let* ((test-path (if work-area - work-area - (rmt:test-get-rundir-from-test-id test-id)))) - (debug:print 3 *default-log-port* "TEST PATH: " test-path) - (open-test-db test-path))) - ;; find and open the testdat.db file for an existing test (define (tdb:open-test-db-by-test-id-local dbstruct run-id test-id #!key (work-area #f)) (let* ((test-path (if work-area work-area (db:test-get-rundir-from-test-id dbstruct run-id test-id)))) @@ -264,38 +265,10 @@ ;; "SELECT id,test_id,category,variable,value,expected,tol,units,comment,status,type FROM test_data WHERE test_id=? AND category LIKE ? ORDER BY category,variable;" test-id categorypatt) ;; (sqlite3:finalize! tdb) ;; (reverse res)) ;; '()))) -;; NOTE: Run this local with #f for db !!! -(define (tdb:load-test-data run-id test-id) - (let loop ((lin (read-line))) - (if (not (eof-object? lin)) - (begin - (debug:print 4 *default-log-port* lin) - ;;(when lin ;; this when blocked stack dump caused by .dat file from logpro being 0-byte. fixed by upgrading logpro - (rmt:csv->test-data run-id test-id lin) - ;;) - (loop (read-line))))) - ;; roll up the current results. - ;; FIXME: Add the status too - (rmt:test-data-rollup run-id test-id #f)) - -;; NOTE: Run this local with #f for db !!! -(define (tdb:load-logpro-data run-id test-id) - (let loop ((lin (read-line))) - (if (not (eof-object? lin)) - (begin - (debug:print 4 *default-log-port* lin) - ;;(when lin ;; this when blocked stack dump caused by .dat file from logpro being 0-byte. fixed by upgrading logpro - (rmt:csv->test-data run-id test-id lin) - ;;) - (loop (read-line))))) - ;; roll up the current results. - ;; FIXME: Add the status too - (rmt:test-data-rollup run-id test-id #f)) - ;;====================================================================== ;; S T E P S ;;====================================================================== (define (tdb:step-get-time-as-string vec) @@ -449,14 +422,15 @@ (conc (vector-ref b 2))) #f)) (string