Index: common.scm ================================================================== --- common.scm +++ common.scm @@ -747,25 +747,10 @@ (set! res #t)))) (string-split patts ",")) res) #t)) -;; (map print (map car (hash-table->alist (read-config "runconfigs.config" #f #t)))) -(define (common:get-runconfig-targets #!key (configf #f)) - (let ((targs (sort (map car (hash-table->alist - (or configf ;; NOTE: There is no value in using runconfig:read here. - (read-config (conc *toppath* "/runconfigs.config") - #f #t) - (make-hash-table)))) - stringalist (read-config "runconfigs.config" #f #t)))) +;; +(define (common:get-runconfig-targets #!key (configf #f)) + (let ((targs (sort (map car (hash-table->alist + (or configf ;; NOTE: There is no value in using runconfig:read here. + (read-config (conc *toppath* "/runconfigs.config") + #f #t) + (make-hash-table)))) + string in runconfigs instead of default TESTPATT if -testpatt and -tagexpr are not specified - -tag-expr tag1,tag2%,.. : select tests with tags matching expression -new state/status : specify new state/status for set-ss Misc -start-dir path : switch to this directory before running mtutil -set-vars V1=1,V2=2 : Add environment variables to a run NB// these are @@ -109,10 +112,11 @@ ("-area" . G) ;; maps to group ("-target" . t) ("-run-name" . n) ("-state" . e) ("-status" . s) + ("-contour" . c) ("-test-patt" . p) ;; idea, enhance margs ("-test-patt" "-testpatt") => yields one value in "-test-patt" ("-mode-patt" . o) ("-tag-expr" . x) ("-item-patt" . i) ;; misc @@ -129,11 +133,10 @@ ("-manual" . #f) ("-version" . #f) ;; misc ("-repl" . #f) ("-immediate" . I) - ("-process" . #f) ;; read any new actions, process actions as needed, archive action pkts when appropriate )) ;; a action ;; u username (Unix) ;; D timestamp @@ -168,33 +171,40 @@ ;;====================================================================== ;; Process pkts ;;====================================================================== (define (load-pkts-to-db mtconf) - (let* ((pktsdir (configf:lookup mtconf "setup" "pktsdir")) - (toppath (configf:lookup mtconf "dyndat" "toppath")) - (pdbpath (or (configf:lookup mtconf "setup" "pdbpath") pktsdir))) - (if (not (and pktsdir toppath pdbpath)) + (let* ((pktsdirs (configf:lookup mtconf "setup" "pktsdirs")) + (pktsdir (if pktsdirs (car (string-split pktsdirs " ")) #f)) + (toppath (configf:lookup mtconf "dyndat" "toppath")) + (pdbpath (or (configf:lookup mtconf "setup" "pdbpath") pktsdir))) + (if (not (and pktsdir toppath pdbpath)) (begin (print "ERROR: settings are missing in your megatest.config for area management.") (print " you need to have pktsdir in the [setup] section.")) (let* ((pdb (open-queue-db pdbpath "pkts.db" - schema: '("CREATE TABLE groups (id INTEGER PRIMARY KEY,groupname TEXT, CONSTRAINT group_constraint UNIQUE (groupname));"))) - (pkts (glob (conc pktsdir "/*.pkt")))) + schema: '("CREATE TABLE groups (id INTEGER PRIMARY KEY,groupname TEXT, CONSTRAINT group_constraint UNIQUE (groupname));")))) (for-each - (lambda (pkt) - (let* ((uuid (cadr (string-match ".*/([0-9a-f]+).pkt" pkt))) - (exists (lookup-by-uuid pdb uuid #f))) - (if (not exists) - (let ((pktdat (string-intersperse - (with-input-from-file pkt read-lines) - "\n"))) - (add-to-queue pdb pktdat uuid 'cmd #f 0) - (print "Added " uuid " to queue")) - (print "pkt: " uuid " exists, skipping...") - ))) - pkts) + (lambda (pktsdir) ;; look at all + (if (and (file-exists? pktsdir) + (directory? pktsdir) + (file-read-access? pktsdir)) + (let ((pkts (glob (conc pktsdir "/*.pkt")))) + (for-each + (lambda (pkt) + (let* ((uuid (cadr (string-match ".*/([0-9a-f]+).pkt" pkt))) + (exists (lookup-by-uuid pdb uuid #f))) + (if (not exists) + (let ((pktdat (string-intersperse + (with-input-from-file pkt read-lines) + "\n"))) + (add-to-queue pdb pktdat uuid 'cmd #f 0) + (print "Added " uuid " to queue")) + (print "pkt: " uuid " exists, skipping...") + ))) + pkts)))) + (string-split pktsdirs)) (dbi:close pdb))))) ;;====================================================================== ;; Runs ;;====================================================================== @@ -242,11 +252,12 @@ (if *action* (case (string->symbol *action*) ((run remove rerun set-ss archive kill) (let* ((mtconfdat (simple-setup (args:get-arg "-start-dir"))) (mtconf (car mtconfdat)) - (pktsdir (configf:lookup mtconf "setup" "pktsdir")) + (pktsdirs (configf:lookup mtconf "setup" "pktsdirs")) + (pktsdir (if pktsdirs (car (string-split pktsdirs " ")) #f)) (adjargs (hash-table-copy args:arg-hash))) ;; (for-each ;; (lambda (key) ;; (if (not (member key *legal-params*)) ;; (hash-table-delete! adjargs key))) ;; we need to delete any params intended for mtutil @@ -257,14 +268,15 @@ (with-output-to-file (conc pktsdir "/" uuid ".pkt") (lambda () (print pkt))) (print "ERROR: cannot process commands without a pkts directory"))))) - ((process) + ((process import rungen) (let* ((mtconfdat (simple-setup (args:get-arg "-start-dir"))) (mtconf (car mtconfdat))) - (load-pkts-to-db mtconf))))) + (case (string->symbol *action*) + ((import)(load-pkts-to-db mtconf))))))) (if (or (args:get-arg "-repl") (args:get-arg "-load")) (begin (import extras) ;; might not be needed Index: runconfig.scm ================================================================== --- runconfig.scm +++ runconfig.scm @@ -80,6 +80,68 @@ environ-patt: (conc "(default" (if targ (conc "|" targ ")") ")"))) (debug:print 0 *default-log-port* "WARNING: You do not have a run config file: " runconfigf)))) - + +;; given (a (b c) d) return ((a b d)(a c d)) +;; NOTE: this feels like it has been done before - perhaps with items handling? +;; +(define (runconfig:combinations inlst) + (let loop ((hed (car inlst)) + (tal (cdr inlst)) + (res '())) + ;; (print "res: " res " hed: " hed) + (if (list? hed) + (let ((newres (if (null? res) ;; first time through convert incoming items to list of items + (map list hed) + (apply append + (map (lambda (r) ;; iterate over items in res + (map (lambda (h) ;; iterate over items in hed + (append r (list h))) + hed)) + res))))) + ;; (print "newres1: " newres) + (if (null? tal) + newres + (loop (car tal)(cdr tal) newres))) + (let ((newres (if (null? res) + (list (list hed)) + (map (lambda (r) + (append r (list hed))) + res)))) + ;; (print "newres2: " newres) + (if (null? tal) + newres + (loop (car tal)(cdr tal) newres)))))) + +;; multi-part expand +;; Given a/b,c,d/e,f return a/b/e a/b/f a/c/e a/c/f a/d/e a/d/f +;; +(define (runconfig:expand target) + (let* ((parts (map (lambda (x) + (string-split x ",")) + (string-split target "/")))) + (map (lambda (x) + (string-intersperse x "/")) + (runconfig:combinations parts)))) + +;; multi-target expansion +;; a/b/c/x,y,z a/b/d/x,y => a/b/c/x a/b/c/y a/b/c/z a/b/d/x a/b/d/y +;; +(define (runconfig:expand-target target-strs) + (delete-duplicates + (apply append (map runconfig:expand (string-split target-strs " "))))) + +#| + (if (null? target-strs) + '() + (let loop ((hed (car target-strs)) + (tal (cdr target-strs)) + (res '())) + ;; first break all parts into individual target patterns + (if (string-index hed " ") ;; this is a multi-target target + (let ((newres (append (string-split hed " ") res))) + (runconfig:expand-target newres)) + (if (string-index hed ",") ;; this is a multi-target where one or more parts are comma separated + +|# ADDED rungen.config Index: rungen.config ================================================================== --- /dev/null +++ rungen.config @@ -0,0 +1,7 @@ +[v1.63/tip/dev] +# file: files changes since last run trigger new run +# script: script is called with unix seconds as last parameter (other parameters are preserved) +# +# contour:sensetype runname params +quick:file auto *.scm +quick:script auto checkfossil.sh v1.63