Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -31,11 +31,11 @@ cgisetup/models/pgdb.scm # module source files # ftail.scm rmtmod.scm commonmod.scm removed MSRCFILES = ducttape-lib.scm pkts.scm stml2.scm cookie.scm mutils.scm \ - mtargs.scm commonmod.scm + mtargs.scm commonmod.scm dbmod.scm GUISRCF = dashboard-context-menu.scm dashboard-tests.scm \ dashboard-guimonitor.scm gutils.scm dcommon.scm tree.scm \ vg.scm @@ -79,12 +79,12 @@ csc $(CSCOPTS) $(OFILES) $(MOFILES) $(MOIMPFILES) megatest.o -o mtest showmtesthash: @echo $(MTESTHASH) -dboard : $(OFILES) $(GOFILES) dashboard.scm $(MOFILES) - csc $(CSCOPTS) $(OFILES) dashboard.scm $(GOFILES) $(MOFILES) -o dboard +dboard : $(OFILES) $(GOFILES) dashboard.scm $(MOFILES) $(MOIMPFILES) + csc $(CSCOPTS) $(OFILES) dashboard.scm $(GOFILES) $(MOFILES) $(MOIMPFILES) -o dboard ndboard : newdashboard.scm $(OFILES) $(GOFILES) csc $(CSCOPTS) $(OFILES) $(GOFILES) newdashboard.scm -o ndboard mtut: $(OFILES) $(MOFILES) megatest-fossil-hash.scm mtut.scm @@ -203,10 +203,13 @@ # specific rules for .o files that genuninely depend on mofiles/something # megatest.o : megatest.scm stml2.o mutils.o commonmod.o csc $(CSCOPTS) -c megatest.scm stml2.o mutils.o commonmod.o +dashboard.o : dashboard.scm stml2.o mutils.o commonmod.o dbmod.o + csc $(CSCOPTS) -c megatest.scm stml2.o mutils.o commonmod.o dbmod.o + common.o : megatest.scm mofiles/commonmod.o common.scm csc $(CSCOPTS) -c common.scm mofiles/commonmod.o configf.o : configf.scm mofiles/commonmod.o csc $(CSCOPTS) -c configf.scm mofiles/commonmod.o Index: TODO ================================================================== --- TODO +++ TODO @@ -24,34 +24,39 @@ WW14 . Streamline compilation - DONE, all non-official egg modules are now bundled. WW15 . syscheck; touch file in home, tmp, runs, links and start xterm -. pull in ftfplan (not integrated, just code pulled in) . fill newview matrix with data, filter pipeline gui elements . improve [script], especially indent handling WW16 . split db into megatest.db (runs etc.) db/.db . release basic newview implementation +. archiving improvements/extentions +.. -get-data, -put-data +.. use MT_ vars if defined and no switch present +.. fix archive "first run" bug +.. areas path1 path2 ... -> search path for archives +.. -propagate -> move archive data forward when it is found in older bundles WW18 . release split db implementation . mtutil calls from dashboard (for remote control) . logs browser (esp. for surfacing mtutil related activities) WW19 . break command line into sections; all, run control, queries, utilities etc. +. pull in ftfplan (not integrated, just code pulled in) WW20 . Switch to using simple runs query everywhere . Add end_time to runs and add a rollup call that sets state, status and end_time Future . Switch to scsh-process pipeline management for job execution/control . Use call-with-environment-variables more. - Migration to inmem db plus per run db ------------------------------------- . Re-work the dbstruct data structure? Index: common.scm ================================================================== --- common.scm +++ common.scm @@ -1613,29 +1613,17 @@ )))))) ;; if it looks like a number -> convert it to a number, else return it ;; (define (common:lazy-convert inval) - (let* ((as-num (if (string? inval)(string->number inval) #f))) - (or as-num inval))) + (cmod:lazy-convert inval)) ;; convert string a=1; b=2; c=a silly thing; d= ;; to '((a . 1)(b . 2)(c . "a silly thing")(d . "")) ;; (define (common:val->alist val #!key (convert #f)) - (let ((val-list (string-split-fields ";\\s*" val #:infix))) - (if val-list - (map (lambda (x) - (let ((f (string-split-fields "\\s*=\\s*" x #:infix))) - (case (length f) - ((0) `(,#f)) ;; null string case - ((1) `(,(string->symbol (car f)))) - ((2) `(,(string->symbol (car f)) . ,(let ((inval (cadr f))) - (if convert (common:lazy-convert inval) inval)))) - (else f)))) - val-list) - '()))) + (cmod:val->alist val #!key (convert #f))) ;;====================================================================== ;; S Y S T E M S T U F F ;;====================================================================== Index: commonmod.scm ================================================================== --- commonmod.scm +++ commonmod.scm @@ -23,14 +23,25 @@ (module commonmod * (import scheme chicken data-structures extras files) (import (prefix sqlite3 sqlite3:) posix typed-records srfi-18 srfi-69 - md5 message-digest) + md5 message-digest + regex srfi-1) + +;;====================================================================== +;; CONTENTS +;; +;; config file utils +;; misc conversion, data manipulation functions +;; testsuite and area utilites +;; +;;====================================================================== -(define (just-testing) - (print "JUST TESTING")) +;;====================================================================== +;; config file utils +;;====================================================================== (define (lookup cfgdat section var) (if (hash-table? cfgdat) (let ((sectdat (hash-table-ref/default cfgdat section '()))) (if (null? sectdat) @@ -40,31 +51,102 @@ (cadr match) #f)) )) #f)) +;; returns var key1=val1; key2=val2 ... as alist +(define (get-key-list cfgdat section var) + ;; convert string a=1; b=2; c=a silly thing; d= + (let ((valstr (lookup cfgdat section var))) + (if valstr + (val->alist valstr) + '()))) ;; should it return empty list or #f to indicate not set? + + +(define (get-section cfgdat section) + (hash-table-ref/default cfgdat section '())) + +;;====================================================================== +;; misc conversion, data manipulation functions +;;====================================================================== + +;; if it looks like a number -> convert it to a number, else return it +;; +(define (lazy-convert inval) + (let* ((as-num (if (string? inval)(string->number inval) #f))) + (or as-num inval))) + +;; to '((a . 1)(b . 2)(c . "a silly thing")(d . "")) +;; +(define (val->alist val #!key (convert #f)) + (let ((val-list (string-split-fields ";\\s*" val #:infix))) + (if val-list + (map (lambda (x) + (let ((f (string-split-fields "\\s*=\\s*" x #:infix))) + (case (length f) + ((0) `(,#f)) ;; null string case + ((1) `(,(string->symbol (car f)))) + ((2) `(,(string->symbol (car f)) . + ,(let ((inval (cadr f))) + (if convert (lazy-convert inval) inval)))) + (else f)))) + (filter (lambda (x) + (not (string-match "^\\s*" x))) + val-list)) + '()))) + +;;====================================================================== +;; testsuite and area utilites +;;====================================================================== + (define (get-testsuite-name toppath configdat) (or (lookup configdat "setup" "area-name") (lookup configdat "setup" "testsuite") (get-environment-variable "MT_TESTSUITE_NAME") (if (string? toppath) (pathname-file toppath) #f))) -(define (get-area-path-signature toppath) - (message-digest-string (md5-primitive) toppath)) +(define (get-area-path-signature toppath #!optional (short #f)) + (let ((res (message-digest-string (md5-primitive) toppath))) + (if short + (substring res 0 4) + res))) -(define (get-area-name toppath configdat) +(define (get-area-name configdat toppath #!optional (short #f)) ;; look up my area name in areas table (future) ;; generate auto name - (conc (get-area-path-signature toppath) + (conc (get-area-path-signature toppath short) "-" (get-testsuite-name toppath configdat))) +;; need generic find-record-with-var-nmatching-val +;; +(define (path->area-record cfgdat path) + (let* ((areadat (get-cfg-areas cfgdat)) + (all (filter (lambda (x) + (let* ((keyvals (cdr x)) + (pth (alist-ref 'path keyvals))) + (equal? path pth))) + areadat))) + (if (null? all) + #f + (car all)))) ;; return first match + +;; given a config return an alist of alists +;; area-name => data +;; +(define (get-cfg-areas cfgdat) + (let ((adat (get-section cfgdat "areas"))) + (map (lambda (entry) + `(,(car entry) . + ,(val->alist (cadr entry)))) + adat))) + ;; (define (debug:print . params) #f) ;; (define (debug:print-info . params) #f) ;; ;; (define (set-functions dbgp dbgpinfo) ;; (set! debug:print dbgp) ;; (set! debug:print-info dbgpinfo)) ) Index: dashboard.scm ================================================================== --- dashboard.scm +++ dashboard.scm @@ -47,10 +47,15 @@ (declare (uses subrun)) ;; (declare (uses dashboard-main)) (declare (uses megatest-version)) (declare (uses mt)) +(declare (uses dbmod)) +(import (prefix dbmod dbmod:)) +(declare (uses commonmod)) +(import (prefix commonmod cmod:)) + (include "common_records.scm") (include "db_records.scm") (include "run_records.scm") (include "task_records.scm") (include "megatest-fossil-hash.scm") Index: dbmod.scm ================================================================== --- dbmod.scm +++ dbmod.scm @@ -16,13 +16,13 @@ ;; You should have received a copy of the GNU General Public License ;; along with Megatest. If not, see . ;;====================================================================== -(declare (unit commonmod)) +(declare (unit dbmod)) -(module commonmod +(module dbmod * (import scheme chicken data-structures extras) (import (prefix sqlite3 sqlite3:) posix typed-records srfi-18)