Changes In Branch v1.6569-multi-db Through [e4bbf91b6d] Excluding Merge-Ins
This is equivalent to a diff from d69b03fe95 to e4bbf91b6d
2021-02-07
| ||
21:52 | Moved some defstructs into dcommonmod. check-in: f7bd519f51 user: matt tags: v1.6569-multi-db | |
2021-02-06
| ||
21:09 | Pulled mtconfigf in as egg/module check-in: e4bbf91b6d user: matt tags: v1.6569-multi-db | |
2021-02-04
| ||
21:17 | Few more spots where loading of commonmod was needed check-in: 5746a55322 user: matt tags: v1.6569-multi-db | |
2021-02-01
| ||
13:29 | fixed match let in db.scm check-in: d486cc49ee user: pjhatwal tags: v1.6582, v1.65-real | |
2021-01-30
| ||
22:37 | Added graph of server for multi-db check-in: 4d273a0078 user: matt tags: v1.6569-multi-db | |
2021-01-29
| ||
11:48 | changed megatest version to v1.6582 check-in: d69b03fe95 user: mmgraham tags: v1.65-real | |
11:47 | Made CHECK an error status for PREQ_FAIL Leaf check-in: a26bbf5c36 user: mmgraham tags: v1.6569-refactor-server-key-chk | |
Modified Makefile from [0dc94ad098] to [51f77abf7e].
︙ | ︙ | |||
26 27 28 29 30 31 32 | process.scm runs.scm tasks.scm tests.scm genexample.scm \ http-transport.scm filedb.scm tdb.scm client.scm mt.scm \ ezsteps.scm lock-queue.scm sdb.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 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 | process.scm runs.scm tasks.scm tests.scm genexample.scm \ http-transport.scm filedb.scm tdb.scm client.scm mt.scm \ ezsteps.scm lock-queue.scm sdb.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 servermod.scm apimod.scm commonmod.scm rmtmod.scm # ftail.scm rmtmod.scm commonmod.scm removed # MSRCFILES = ducttape-lib.scm pkts.scm stml2.scm cookie.scm mutils.scm \ # mtargs.scm commonmod.scm dbmod.scm adjutant.scm ulex.scm \ # rmtmod.scm apimod.scm GUISRCF = dashboard-context-menu.scm dashboard-tests.scm \ dashboard-guimonitor.scm gutils.scm dcommon.scm tree.scm \ vg.scm OFILES = $(SRCFILES:%.scm=%.o) GOFILES = $(GUISRCF:%.scm=%.o) MOFILES = $(addprefix mofiles/,$(MSRCFILES:%.scm=%.o)) # compiled import files MOIMPFILES = $(MSRCFILES:%.scm=%.import.o) %.import.o : %.import.scm mofiles/%.o csc $(CSCOPTS) -unit $*.import -c $*.import.scm -o $*.import.o # I'm not sure the cp is a good idea, changed a lot of things and it may not have been necessary... # mofiles/%.o %.import.scm : %.scm megatest-fossil-hash.scm # @[ -e mofiles ] || mkdir -p mofiles # csc $(CSCOPTS) -I mofiles -I $* -J -c $< -o $*.o # cp $*.o mofiles/$*.o # ensure import.scm is touched after the .o is made # mofiles/%.o %.import.scm : %.scm csc $(CSCOPTS) -J -c $< -o mofiles/$*.o @touch $*.import.scm ADTLSCR=mt_laststep mt_runstep mt_ezstep HELPERS=$(addprefix $(PREFIX)/bin/,$(ADTLSCR)) DEPLOYHELPERS=$(addprefix deploytarg/,$(ADTLSCR)) MTESTHASH=$(shell fossil info|grep checkout:| awk '{print $$2}') ifeq ($(MTESTHASH),) |
︙ | ︙ | |||
125 126 127 128 129 130 131 | tests.o \ subrun.o \ ezsteps.o # mofiles/rmtmod.o \ # mofiles/commonmod.o \ | | | | | | > > | 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 | tests.o \ subrun.o \ ezsteps.o # mofiles/rmtmod.o \ # mofiles/commonmod.o \ tcmt : $(TCMTOBJS) tcmt.scm megatest-version.scm $(MOIMPFILES) $(MOFILES) csc $(CSCOPTS) $(TCMTOBJS) $(MOFILES) $(MOIMPFILES) tcmt.scm -o tcmt # install documentation to $(PREFIX)/docs # DOES NOT REBUILD DOCS # $(PREFIX)/share/docs/megatest_manual.html : docs/manual/megatest_manual.html mkdir -p $(PREFIX)/share/docs $(INSTALL) docs/manual/megatest_manual.html $(PREFIX)/share/docs/megatest_manual.html for png in $(PNGFILES);do $(INSTALL) docs/manual/$$png $(PREFIX)/share/docs/$$png;done # add a fake dependency so this doens't copy everytime $(PREFIX)/share/js/jquery-3.1.0.slim.min.js : # .fslckout mkdir -p $(PREFIX)/share/js fossil wiki export java-script-lib > $(PREFIX)/share/js/jquery-3.1.0.slim.min.js $(PREFIX)/share/db/mt-pg.sql : mt-pg.sql mkdir -p $(PREFIX)/share/db $(INSTALL) mt-pg.sql $(PREFIX)/share/db/mt-pg.sql # Special dependencies for the module includes $(MOFILE) $(MOIMPFILES) : megatest-fossil-hash.scm megatest.o : $(MOIMPFILES) mofiles/commonmod.o : megatest-fossil-hash.scm mofiles/dbmod.o mofiles/servermod.o mofiles/apimod.o : mofiles/commonmod.o mofiles/rmtmod.o : mofiles/apimod.o common.o : mofiles/commonmod.o # commonmod.o dashboard.o megatest.o tcmt.o apimod.o : megatest-fossil-hash.scm tests.o db.o launch.o runs.o dashboard-tests.o \ dashboard-context-menu.o dashboard-guimonitor.o dashboard-main.o \ monitor.o dashboard.o archive.o megatest.o : db_records.scm megatest-fossil-hash.scm tests.o runs.o dashboard.o dashboard-tests.o dashboard-context-menu.o dashboard-main.o : run_records.scm |
︙ | ︙ |
Modified api.scm from [68ac71805c] to [ee434c180b].
︙ | ︙ | |||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 | (use srfi-69 posix) (declare (unit api)) (declare (uses rmt)) (declare (uses db)) (declare (uses tasks)) ;; allow these queries through without starting a server ;; (define api:read-only-queries '(get-key-val-pairs get-var get-keys | > > > | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | (use srfi-69 posix) (declare (unit api)) (declare (uses rmt)) (declare (uses db)) (declare (uses tasks)) (declare (uses commonmod)) (import commonmod) ;; allow these queries through without starting a server ;; (define api:read-only-queries '(get-key-val-pairs get-var get-keys |
︙ | ︙ |
Modified apimod.scm from [0c866deee4] to [91669f1e5a].
︙ | ︙ | |||
16 17 18 19 20 21 22 | ;; 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 apimod)) (declare (uses commonmod)) | | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | ;; 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 apimod)) (declare (uses commonmod)) ;; (declare (uses ulex)) (module apimod * (import scheme chicken data-structures extras) (import (prefix sqlite3 sqlite3:) posix typed-records srfi-18) (import commonmod) ;; (import (prefix ulex ulex:)) (define (api:execute-requests params) #f) ) |
Modified archive.scm from [a5f3e3b4ad] to [0a572a4ddb].
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ;; strftime('%m/%d/%Y %H:%M:%S','now','localtime') (use (prefix sqlite3 sqlite3:) srfi-1 posix regex regex-case srfi-69 format md5 message-digest srfi-18) (declare (unit archive)) (declare (uses db)) (declare (uses common)) (include "common_records.scm") (include "db_records.scm") ;;====================================================================== ;; ;;====================================================================== | > > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ;; strftime('%m/%d/%Y %H:%M:%S','now','localtime') (use (prefix sqlite3 sqlite3:) srfi-1 posix regex regex-case srfi-69 format md5 message-digest srfi-18) (declare (unit archive)) (declare (uses db)) (declare (uses common)) (declare (uses commonmod)) (import commonmod) (include "common_records.scm") (include "db_records.scm") ;;====================================================================== ;; ;;====================================================================== |
︙ | ︙ |
Modified client.scm from [dc4c7b41e8] to [cecbbc9d00].
︙ | ︙ | |||
25 26 27 28 29 30 31 32 33 34 35 36 37 38 | spiffy-request-vars uri-common intarweb directory-utils) (declare (unit client)) (declare (uses common)) (declare (uses db)) (declare (uses tasks)) ;; tasks are where stuff is maintained about what is running. (include "common_records.scm") (include "db_records.scm") ;; client:get-signature (define (client:get-signature) (if *my-client-signature* *my-client-signature* | > > > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | spiffy-request-vars uri-common intarweb directory-utils) (declare (unit client)) (declare (uses common)) (declare (uses db)) (declare (uses tasks)) ;; tasks are where stuff is maintained about what is running. (declare (uses commonmod)) (import commonmod) (include "common_records.scm") (include "db_records.scm") ;; client:get-signature (define (client:get-signature) (if *my-client-signature* *my-client-signature* |
︙ | ︙ |
Modified common.scm from [bf0a0a25ad] to [f8fa1c917f].
︙ | ︙ | |||
24 25 26 27 28 29 30 | matchable regex posix (srfi 18) extras ;; tcp (prefix nanomsg nmsg:) (prefix sqlite3 sqlite3:) pkts (prefix dbi dbi:) ) (declare (unit common)) | | | > > > > > > > > > | 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 | matchable regex posix (srfi 18) extras ;; tcp (prefix nanomsg nmsg:) (prefix sqlite3 sqlite3:) pkts (prefix dbi dbi:) ) (declare (unit common)) (declare (uses commonmod)) (import commonmod) (include "common_records.scm") ;; (require-library margs) ;; (include "margs.scm") ;; (define old-exit exit) ;; ;; (define (exit . code) ;; (if (null? code) ;; (old-exit) ;; (old-exit code))) (define (common:debug-setup) (debug:setup (cond ;; debug arg ((args:get-arg "-debug-noprop") 'noprop) ((args:get-arg "-debug") #t) (else #f)) (cond ;; verbosity arg ((args:get-arg "-q") 'v) ((args:get-arg "-q") 'q) (else #f)))) ;; execute thunk, return value. If exception thrown, trap exception, return #f, and emit nonfatal condition note to *default-log-port* . ;; arguments - thunk, message (define (common:fail-safe thunk warning-message-on-exception) (handle-exceptions exn (begin |
︙ | ︙ | |||
801 802 803 804 805 806 807 808 809 810 811 812 813 814 | (6 "CHECK") (7 "STUCK/DEAD") (8 "DEAD") (9 "FAIL") (10 "PREQ_FAIL") (11 "PREQ_DISCARDED") (12 "ABORT"))) (define *common:ended-states* ;; states which indicate the test is stopped and will not proceed '("COMPLETED" "ARCHIVED" "KILLED" "KILLREQ" "STUCK" "INCOMPLETE" )) (define *common:badly-ended-states* ;; these roll up as CHECK, i.e. results need to be checked '("KILLED" "KILLREQ" "STUCK" "INCOMPLETE" "DEAD")) | > > > > > > | 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 | (6 "CHECK") (7 "STUCK/DEAD") (8 "DEAD") (9 "FAIL") (10 "PREQ_FAIL") (11 "PREQ_DISCARDED") (12 "ABORT"))) (define (common:status>? s1 s2) (let* ((munged (map (lambda (x) `(,(cadr x) . ,(car x))) *common:std-statuses*)) (v1 (alist-ref s1 munged equal?)) (v2 (alist-ref s2 munged equal?))) (> v1 v2))) (define *common:ended-states* ;; states which indicate the test is stopped and will not proceed '("COMPLETED" "ARCHIVED" "KILLED" "KILLREQ" "STUCK" "INCOMPLETE" )) (define *common:badly-ended-states* ;; these roll up as CHECK, i.e. results need to be checked '("KILLED" "KILLREQ" "STUCK" "INCOMPLETE" "DEAD")) |
︙ | ︙ |
Modified common_records.scm from [80f9e14f2d] to [e4251bc312].
︙ | ︙ | |||
75 76 77 78 79 80 81 | ;; (define-inline (with-mutex mtx accessor record . val) (mutex-lock! mtx) (let ((res (apply accessor record val))) (mutex-unlock! mtx) res)) | | | | > > > > > > > > > > > > > > > > > | < < < < < < < < < < < < < < < < < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | 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 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 | ;; (define-inline (with-mutex mtx accessor record . val) (mutex-lock! mtx) (let ((res (apply accessor record val))) (mutex-unlock! mtx) res)) ;; ;; this was cached based on results from profiling but it turned out the profiling ;; ;; somehow went wrong - perhaps too many processes writing to it. Leaving the caching ;; ;; in for now but can probably take it out later. ;; ;; ;; (define (debug:calc-verbosity vstr) ;; (or (hash-table-ref/default *verbosity-cache* vstr #f) ;; (let ((res (cond ;; ((number? vstr) vstr) ;; ((not (string? vstr)) 1) ;; ;; ((string-match "^\\s*$" vstr) 1) ;; (vstr (let ((debugvals (filter number? (map string->number (string-split vstr ","))))) ;; (cond ;; ((> (length debugvals) 1) debugvals) ;; ((> (length debugvals) 0)(car debugvals)) ;; (else 1)))) ;; ((args:get-arg "-v") 2) ;; ((args:get-arg "-q") 0) ;; (else 1)))) ;; (hash-table-set! *verbosity-cache* vstr res) ;; res))) ;; ;; ;; check verbosity, #t is ok ;; (define (debug:check-verbosity verbosity vstr) ;; (if (not (or (number? verbosity) ;; (list? verbosity))) ;; (begin ;; (print "ERROR: Invalid debug value \"" vstr "\"") ;; #f) ;; #t)) ;; ;; (define (debug:debug-mode n) ;; (cond ;; ((and (number? *verbosity*) ;; number number ;; (number? n)) ;; (<= n *verbosity*)) ;; ((and (list? *verbosity*) ;; list number ;; (number? n)) ;; (member n *verbosity*)) ;; ((and (list? *verbosity*) ;; list list ;; (list? n)) ;; (not (null? (lset-intersection! eq? *verbosity* n)))) ;; ((and (number? *verbosity*) ;; (list? n)) ;; (member *verbosity* n)))) ;; ;; (define (debug:setup) ;; (let ((debugstr (or (args:get-arg "-debug") ;; (args:get-arg "-debug-noprop") ;; (getenv "MT_DEBUG_MODE")))) ;; (set! *verbosity* (debug:calc-verbosity debugstr)) ;; (debug:check-verbosity *verbosity* debugstr) ;; ;; if we were handed a bad verbosity rule then we will override it with 1 and continue ;; (if (not *verbosity*)(set! *verbosity* 1)) ;; (if (and (not (args:get-arg "-debug-noprop")) ;; (or (args:get-arg "-debug") ;; (not (getenv "MT_DEBUG_MODE")))) ;; (setenv "MT_DEBUG_MODE" (if (list? *verbosity*) ;; (string-intersperse (map conc *verbosity*) ",") ;; (conc *verbosity*)))))) ;; ;; (define (debug:print n e . params) ;; (if (debug:debug-mode n) ;; (with-output-to-port (or e (current-error-port)) ;; (lambda () ;; (if *logging* ;; (db:log-event (apply conc params)) ;; (apply print params) ;; ))))) ;; ;; ;; Brandon's debug printer shortcut (indulge me :) ;; (define *BB-process-starttime* (current-milliseconds)) ;; (define (BB> . in-args) ;; (let* ((stack (get-call-chain)) ;; (location "??")) ;; (for-each ;; (lambda (frame) ;; (let* ((this-loc (vector-ref frame 0)) ;; (temp (string-split (->string this-loc) " ")) ;; (this-func (if (and (list? temp) (> (length temp) 1)) (cadr temp) "???"))) ;; (if (equal? this-func "BB>") ;; (set! location this-loc)))) ;; stack) ;; (let* ((color-on "\x1b[1m") ;; (color-off "\x1b[0m") ;; (dp-args ;; (append ;; (list 0 *default-log-port* ;; (conc color-on location "@"(/ (- (current-milliseconds) *BB-process-starttime*) 1000) color-off " ") ) ;; in-args))) ;; (apply debug:print dp-args)))) ;; ;; (define *BBpp_custom_expanders_list* (make-hash-table)) ;; ;; ;; ;; ;; register hash tables with BBpp. ;; (hash-table-set! *BBpp_custom_expanders_list* HASH_TABLE: ;; (cons hash-table? hash-table->alist)) ;; ;; ;; test name converter ;; (define (BBpp_custom_converter arg) ;; (let ((res #f)) ;; (for-each ;; (lambda (custom-type-name) ;; (let* ((custom-type-info (hash-table-ref *BBpp_custom_expanders_list* custom-type-name)) ;; (custom-type-test (car custom-type-info)) ;; (custom-type-converter (cdr custom-type-info))) ;; (when (and (not res) (custom-type-test arg)) ;; (set! res (custom-type-converter arg))))) ;; (hash-table-keys *BBpp_custom_expanders_list*)) ;; (if res (BBpp_ res) arg))) ;; ;; (define (BBpp_ arg) ;; (cond ;; ;;((SOMESTRUCT? arg) (cons SOMESTRUCT: (SOMESTRUCT->alist arg))) ;; ;;((dboard:tabdat? arg) (cons dboard:tabdat: (dboard:tabdat->alist arg))) ;; ((hash-table? arg) ;; (let ((al (hash-table->alist arg))) ;; (BBpp_ (cons HASH_TABLE: al)))) ;; ((null? arg) '()) ;; ;;((list? arg) (cons (BBpp_ (car arg)) (BBpp_ (cdr arg)))) ;; ((pair? arg) (cons (BBpp_ (car arg)) (BBpp_ (cdr arg)))) ;; (else (BBpp_custom_converter arg)))) ;; ;; ;; Brandon's pretty printer. It expands hashes and custom types in addition to regular pp ;; (define (BBpp arg) ;; (pp (BBpp_ arg))) ;; ;; ;(use define-macro) ;; (define-syntax inspect ;; (syntax-rules () ;; [(_ x) ;; ;; (with-output-to-port (current-error-port) ;; (printf "~a is: ~a\n" 'x (with-output-to-string (lambda () (BBpp x)))) ;; ;; ) ;; ] ;; [(_ x y ...) (begin (inspect x) (inspect y ...))])) ;; ;; (define (debug:print-error n e . params) ;; ;; normal print ;; (if (debug:debug-mode n) ;; (with-output-to-port (if (port? e) e (current-error-port)) ;; (lambda () ;; (if *logging* ;; (db:log-event (apply conc params)) ;; ;; (apply print "pid:" (current-process-id) " " params) ;; (apply print "ERROR: " params) ;; )))) ;; ;; pass important messages to stderr ;; (if (and (eq? n 0)(not (eq? e (current-error-port)))) ;; (with-output-to-port (current-error-port) ;; (lambda () ;; (apply print "ERROR: " params) ;; )))) ;; ;; (define (debug:print-info n e . params) ;; (if (debug:debug-mode n) ;; (with-output-to-port (if (port? e) e (current-error-port)) ;; (lambda () ;; (if *logging* ;; (let ((res (format#format #f "INFO: (~a) ~a" n (apply conc params)))) ;; (db:log-event res)) ;; ;; (apply print "pid:" (current-process-id) " " "INFO: (" n ") " params) ;; res) ;; (apply print "INFO: (" n ") " params) ;; res) ;; ))))) ;; ;; if a value is printable (i.e. string or number) return the value ;; else return an empty string (define-inline (printable val) (if (or (number? val)(string? val)) val "")) |
Modified commonmod.scm from [9423abd515] to [7ea60c4771].
︙ | ︙ | |||
19 20 21 22 23 24 25 | ;;====================================================================== (declare (unit commonmod)) (module commonmod * | | | > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | ;;====================================================================== (declare (unit commonmod)) (module commonmod * (import scheme chicken data-structures extras files ports) (import (prefix sqlite3 sqlite3:) posix typed-records srfi-18 srfi-69 md5 message-digest regex srfi-1 format) ;;====================================================================== ;; CONTENTS ;; ;; config file utils ;; misc conversion, data manipulation functions ;; testsuite and area utilites |
︙ | ︙ | |||
147 148 149 150 151 152 153 | ;; (define (get-cfg-areas cfgdat) (let ((adat (get-section cfgdat "areas"))) (map (lambda (entry) `(,(car entry) . ,(val->alist (cadr entry)))) adat))) | | > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | ;; (define (get-cfg-areas cfgdat) (let ((adat (get-section cfgdat "areas"))) (map (lambda (entry) `(,(car entry) . ,(val->alist (cadr entry)))) adat))) ;;====================================================================== ;; debug stuff ;;====================================================================== (define verbosity (make-parameter '())) ;; (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)) ;; this was cached based on results from profiling but it turned out the profiling ;; somehow went wrong - perhaps too many processes writing to it. Leaving the caching ;; in for now but can probably take it out later. ;; (define (debug:calc-verbosity vstr arg) ;; arg is 'v (verbose) or 'q (quiet) (let* ((res (cond ((number? vstr) vstr) ((not (string? vstr)) 1) ;; ((string-match "^\\s*$" vstr) 1) (vstr (let ((debugvals (filter number? (map string->number (string-split vstr ","))))) (cond ((> (length debugvals) 1) debugvals) ((> (length debugvals) 0)(car debugvals)) (else 1)))) ((eq? arg 'v) 2) ;; verbose ((eq? arg 'q) 0) ;; quiet (else 1)))) (verbosity res) res)) ;; check verbosity, #t is ok #;(define (debug-check-verbosity verbosity vstr) (if (not (or (number? verbosity) (list? verbosity))) (begin (print "ERROR: Invalid debug value \"" vstr "\"") #f) #t)) (define (debug:debug-mode n) (let* ((vb (verbosity))) (cond ((and (number? vb) ;; number number (number? n)) (<= n vb)) ((and (list? vb) ;; list number (number? n)) (member n vb)) ((and (list? vb) ;; list list (list? n)) (not (null? (lset-intersection! eq? vb n)))) ((and (number? vb) (list? n)) (member vb n))))) (define (debug:setup debug-arg verbose-arg) ;; debug-arg= #f, #t or 'noprop (let ((debugstr (or debug-arg ;; (args:get-arg "-debug") ;; (args:get-arg "-debug-noprop") (get-environment-variable "MT_DEBUG_MODE")))) (debug:calc-verbosity debugstr verbose-arg) ;; (debug:check-verbosity *verbosity* debugstr) ;; if we were handed a bad verbosity rule then we will override it with 1 and continue (if (not (verbosity))(set! (verbosity) 1)) (if (and (not (eq? debug-arg 'noprop)) (or debug-arg (not (get-environment-variable "MT_DEBUG_MODE")))) (setenv "MT_DEBUG_MODE" (if (list? (verbosity)) (string-intersperse (map conc (verbosity)) ",") (conc (verbosity))))))) (define (debug:print n e . params) (if (debug:debug-mode n) (with-output-to-port (or e (current-error-port)) (lambda () ;; (if *logging* ;; (db:log-event (apply conc params)) (apply print params) )))) ;; ) (define (debug:print-error n e . params) ;; normal print (if (debug:debug-mode n) (with-output-to-port (if (port? e) e (current-error-port)) (lambda () (apply print "ERROR: " params) ))) ;; pass important messages to stderr (if (and (eq? n 0)(not (eq? e (current-error-port)))) (with-output-to-port (current-error-port) (lambda () (apply print "ERROR: " params) )))) (define (debug:print-info n e . params) (if (debug:debug-mode n) (with-output-to-port (if (port? e) e (current-error-port)) (lambda () (apply print "INFO: (" n ") " params) ;; res) )))) ) |
Modified configf.scm from [b115fef76f] to [fb6d9bbd39].
︙ | ︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ;;====================================================================== (use regex regex-case matchable) ;; directory-utils) (declare (unit configf)) (declare (uses process)) (declare (uses env)) (declare (uses keys)) (include "common_records.scm") ;; return list (path fullpath configname) (define (find-config configname #!key (toppath #f)) (if toppath (let ((cfname (conc toppath "/" configname))) | > > > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | ;;====================================================================== (use regex regex-case matchable) ;; directory-utils) (declare (unit configf)) (declare (uses process)) (declare (uses env)) (declare (uses keys)) (declare (uses commonmod)) (import commonmod) (include "common_records.scm") ;; return list (path fullpath configname) (define (find-config configname #!key (toppath #f)) (if toppath (let ((cfname (conc toppath "/" configname))) |
︙ | ︙ |
Modified dashboard-context-menu.scm from [48947370a7] to [4ebbf2ae46].
︙ | ︙ | |||
37 38 39 40 41 42 43 44 45 46 47 48 49 50 | (declare (uses db)) (declare (uses gutils)) (declare (uses rmt)) (declare (uses ezsteps)) ;; (declare (uses sdb)) ;; (declare (uses filedb)) (declare (uses subrun)) (include "common_records.scm") (include "db_records.scm") (include "run_records.scm") (define (dboard:launch-testpanel run-id test-id) (let* ((dboardexe (common:find-local-megatest "dashboard")) | > > > | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | (declare (uses db)) (declare (uses gutils)) (declare (uses rmt)) (declare (uses ezsteps)) ;; (declare (uses sdb)) ;; (declare (uses filedb)) (declare (uses subrun)) (declare (uses commonmod)) (import commonmod) (include "common_records.scm") (include "db_records.scm") (include "run_records.scm") (define (dboard:launch-testpanel run-id test-id) (let* ((dboardexe (common:find-local-megatest "dashboard")) |
︙ | ︙ |
Modified dashboard-guimonitor.scm from [9920d4908c] to [8b202da860].
︙ | ︙ | |||
32 33 34 35 36 37 38 39 40 41 42 43 44 45 | (import (prefix sqlite3 sqlite3:)) (declare (unit dashboard-guimonitor)) (declare (uses common)) (declare (uses keys)) (declare (uses db)) (declare (uses tasks)) (include "common_records.scm") (include "db_records.scm") (include "run_records.scm") (include "task_records.scm") (define (control-panel db tdb keys) | > > > | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | (import (prefix sqlite3 sqlite3:)) (declare (unit dashboard-guimonitor)) (declare (uses common)) (declare (uses keys)) (declare (uses db)) (declare (uses tasks)) (declare (uses commonmod)) (import commonmod) (include "common_records.scm") (include "db_records.scm") (include "run_records.scm") (include "task_records.scm") (define (control-panel db tdb keys) |
︙ | ︙ |
Modified dashboard-tests.scm from [237d160a6c] to [0de4378c1e].
︙ | ︙ | |||
36 37 38 39 40 41 42 43 44 45 46 47 48 49 | (declare (uses db)) (declare (uses gutils)) (declare (uses rmt)) (declare (uses ezsteps)) ;; (declare (uses sdb)) ;; (declare (uses filedb)) (declare (uses subrun)) (include "common_records.scm") (include "db_records.scm") (include "run_records.scm") ;;====================================================================== ;; C O M M O N | > > > | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | (declare (uses db)) (declare (uses gutils)) (declare (uses rmt)) (declare (uses ezsteps)) ;; (declare (uses sdb)) ;; (declare (uses filedb)) (declare (uses subrun)) (declare (uses commonmod)) (import commonmod) (include "common_records.scm") (include "db_records.scm") (include "run_records.scm") ;;====================================================================== ;; C O M M O N |
︙ | ︙ |
Modified dashboard.scm from [935bf4d2df] to [56ac564c81].
︙ | ︙ | |||
43 44 45 46 47 48 49 50 51 52 53 54 55 | (declare (uses tree)) (declare (uses dcommon)) (declare (uses dashboard-context-menu)) (declare (uses vg)) (declare (uses subrun)) ;; (declare (uses dashboard-main)) (declare (uses mt)) (include "common_records.scm") (include "db_records.scm") (include "run_records.scm") (include "task_records.scm") (include "megatest-version.scm") | > > > | | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | (declare (uses tree)) (declare (uses dcommon)) (declare (uses dashboard-context-menu)) (declare (uses vg)) (declare (uses subrun)) ;; (declare (uses dashboard-main)) (declare (uses mt)) (declare (uses commonmod)) (import commonmod) (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") (include "vg_records.scm") (define help (conc "Megatest Dashboard, documentation at http://www.kiatoa.com/fossils/megatest version " megatest-version " license GPL, Copyright (C) Matt Welland 2012-2017 |
︙ | ︙ | |||
349 350 351 352 353 354 355 | ;; runs summary view tests-tree ;; used in newdashboard ) ;; register tabdat with BBpp ;; this is used by BBpp (Brandon's pretty printer) to convert dboard:tabdat into a composition of lists that pp will handle | | | | | | | | | | 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | ;; runs summary view tests-tree ;; used in newdashboard ) ;; register tabdat with BBpp ;; this is used by BBpp (Brandon's pretty printer) to convert dboard:tabdat into a composition of lists that pp will handle ;; (hash-table-set! *BBpp_custom_expanders_list* TABDAT: ;; (cons dboard:tabdat? ;; (lambda (tabdat-item) ;; (filter ;; (lambda (alist-entry) ;; (member (car alist-entry) ;; '(allruns-by-id allruns))) ;; FIELDS OF INTEREST ;; (dboard:tabdat->alist tabdat-item))))) (define (dboard:tabdat-target-string vec) (let ((targ (dboard:tabdat-target vec))) (if (list? targ)(string-intersperse targ "/") "no-target-specified"))) |
︙ | ︙ | |||
499 500 501 502 503 504 505 | status start-time duration ) ;; register dboard:rundat with BBpp ;; this is used by BBpp (Brandon's pretty printer) to convert dboard:rundat into a composition of lists that pp will handle | | | | | | | | | | 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | status start-time duration ) ;; register dboard:rundat with BBpp ;; this is used by BBpp (Brandon's pretty printer) to convert dboard:rundat into a composition of lists that pp will handle ;; (hash-table-set! *BBpp_custom_expanders_list* RUNDAT: ;; (cons dboard:rundat? ;; (lambda (tabdat-item) ;; (filter ;; (lambda (alist-entry) ;; (member (car alist-entry) ;; '(run run-data-offset ))) ;; FIELDS OF INTEREST ;; (dboard:rundat->alist tabdat-item))))) (define (dboard:rundat-make-init #!key (run #f)(key-vals #f)(tests #f));; -100 is before time began (make-dboard:rundat run: run |
︙ | ︙ | |||
576 577 578 579 580 581 582 | (if t-sort (cadr t-sort) 3))) (define (get-curr-sort) (vector-ref *tests-sort-options* *tests-sort-reverse*)) | | | 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | (if t-sort (cadr t-sort) 3))) (define (get-curr-sort) (vector-ref *tests-sort-options* *tests-sort-reverse*)) (common:debug-setup) ;; (define uidat #f) (define-inline (dboard:uidat-get-keycol vec)(vector-ref vec 0)) (define-inline (dboard:uidat-get-lftcol vec)(vector-ref vec 1)) (define-inline (dboard:uidat-get-header vec)(vector-ref vec 2)) (define-inline (dboard:uidat-get-runsvec vec)(vector-ref vec 3)) |
︙ | ︙ |
Modified db.scm from [f2d817bbad] to [403e3c3554].
︙ | ︙ | |||
31 32 33 34 35 36 37 38 39 40 41 42 43 44 | (declare (unit db)) (declare (uses common)) (declare (uses keys)) (declare (uses ods)) (declare (uses client)) (declare (uses mt)) (include "common_records.scm") (include "db_records.scm") (include "key_records.scm") (include "run_records.scm") (define *number-of-writes* 0) | > > > | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | (declare (unit db)) (declare (uses common)) (declare (uses keys)) (declare (uses ods)) (declare (uses client)) (declare (uses mt)) (declare (uses commonmod)) (import commonmod) (include "common_records.scm") (include "db_records.scm") (include "key_records.scm") (include "run_records.scm") (define *number-of-writes* 0) |
︙ | ︙ |
Modified dcommon.scm from [dbcf309f44] to [030a8b692a].
︙ | ︙ | |||
25 26 27 28 29 30 31 32 33 34 35 36 37 38 | (import canvas-draw-iup) (use regex typed-records matchable) (declare (unit dcommon)) (declare (uses gutils)) (declare (uses db)) ;; (declare (uses synchash)) (include "megatest-version.scm") (include "common_records.scm") (include "db_records.scm") (include "key_records.scm") (include "run_records.scm") | > > > > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | (import canvas-draw-iup) (use regex typed-records matchable) (declare (unit dcommon)) (declare (uses gutils)) (declare (uses db)) (declare (uses commonmod)) (import commonmod) ;; (declare (uses synchash)) (include "megatest-version.scm") (include "common_records.scm") (include "db_records.scm") (include "key_records.scm") (include "run_records.scm") |
︙ | ︙ |
Modified diff-report.scm from [722e4fdcd5] to [03502cd2bf].
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ;; along with Megatest. If not, see <http://www.gnu.org/licenses/>. ;; (declare (unit diff-report)) (declare (uses common)) (declare (uses rmt)) (include "common_records.scm") (use matchable) (use fmt) (use ducttape-lib) (define css "") (define (diff:tests-mindat->hash tests-mindat) | > > > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ;; along with Megatest. If not, see <http://www.gnu.org/licenses/>. ;; (declare (unit diff-report)) (declare (uses common)) (declare (uses rmt)) (declare (uses commonmod)) (import commonmod) (include "common_records.scm") (use matchable) (use fmt) (use ducttape-lib) (define css "") (define (diff:tests-mindat->hash tests-mindat) |
︙ | ︙ |
Modified docs/manual/Makefile from [ec9633c3d9] to [43d7d87a44].
︙ | ︙ | |||
32 33 34 35 36 37 38 | all : server.ps megatest_manual.html client.ps complex-itemmap.png megatest_manual.pdf megatest_manual.html : megatest_manual.txt *.txt installation.txt *png asciidoc -b html5 -a icons -a iconsdir=$(DISPATH)/images/icons -a toc2 megatest_manual.txt # dos2unix megatest_manual.html | | > > > | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | all : server.ps megatest_manual.html client.ps complex-itemmap.png megatest_manual.pdf megatest_manual.html : megatest_manual.txt *.txt installation.txt *png asciidoc -b html5 -a icons -a iconsdir=$(DISPATH)/images/icons -a toc2 megatest_manual.txt # dos2unix megatest_manual.html megatest_manual.pdf : megatest_manual.txt *.txt *png *.ps a2x -a toc -f pdf megatest_manual.txt server.pdf : server.dot dot -Tpdf server.dot > server.pdf server.ps : server.dot dot -Tps server.dot > server.ps client.ps : client.dot dot -Tps client.dot > client.ps complex-itemmap.png : complex-itemmap.dot |
︙ | ︙ |
Modified docs/manual/megatest_manual.html from [a02a70016f] to [fdd645b09f].
1 2 3 4 | <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | | | 1 2 3 4 5 6 7 8 9 10 11 12 | <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="generator" content="AsciiDoc 8.6.10"> <title>The Megatest Users Manual</title> <style type="text/css"> /* Shared CSS for AsciiDoc xhtml11 and html5 backends */ /* Default font. */ body { font-family: Georgia,serif; |
︙ | ︙ | |||
82 83 84 85 86 87 88 | ul, ol, li > p { margin-top: 0; } ul > li { color: #aaa; } ul > li > * { color: black; } | | > > > > > > | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | ul, ol, li > p { margin-top: 0; } ul > li { color: #aaa; } ul > li > * { color: black; } .monospaced, code, pre { font-family: "Courier New", Courier, monospace; font-size: inherit; color: navy; padding: 0; margin: 0; } pre { white-space: pre-wrap; } #author { color: #527bbd; font-weight: bold; font-size: 1.1em; } #email { |
︙ | ︙ | |||
214 215 216 217 218 219 220 | div.exampleblock > div.content { border-left: 3px solid #dddddd; padding-left: 0.5em; } div.imageblock div.content { padding-left: 0; } | | | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | div.exampleblock > div.content { border-left: 3px solid #dddddd; padding-left: 0.5em; } div.imageblock div.content { padding-left: 0; } span.image img { border-style: none; vertical-align: text-bottom; } a.image:visited { color: white; } dl { margin-top: 0.8em; margin-bottom: 0.8em; } dt { |
︙ | ︙ | |||
410 411 412 413 414 415 416 | /* * xhtml11 specific * * */ | < < < < < < | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | /* * xhtml11 specific * * */ div.tableblock { margin-top: 1.0em; margin-bottom: 1.5em; } div.tableblock > table { border: 3px solid #527bbd; } |
︙ | ︙ | |||
449 450 451 452 453 454 455 | /* * html5 specific * * */ | < < < < < < | 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | /* * html5 specific * * */ table.tableblock { margin-top: 1.0em; margin-bottom: 1.5em; } thead, p.tableblock.header { font-weight: bold; color: #527bbd; |
︙ | ︙ | |||
534 535 536 537 538 539 540 541 542 543 544 545 546 547 | body.manpage div.sectionbody { margin-left: 3em; } @media print { body.manpage div#toc { display: none; } } @media screen { body { max-width: 50em; /* approximately 80 characters wide */ margin-left: 16em; } #toc { | > > | 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | body.manpage div.sectionbody { margin-left: 3em; } @media print { body.manpage div#toc { display: none; } } @media screen { body { max-width: 50em; /* approximately 80 characters wide */ margin-left: 16em; } #toc { |
︙ | ︙ | |||
2338 2339 2340 2341 2342 2343 2344 | </div></div> </div> <div class="sect2"> <h3 id="_trim_trailing_spaces">Trim trailing spaces</h3> <div class="admonitionblock"> <table><tr> <td class="icon"> | | | 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 | </div></div> </div> <div class="sect2"> <h3 id="_trim_trailing_spaces">Trim trailing spaces</h3> <div class="admonitionblock"> <table><tr> <td class="icon"> <img src="/usr/images/icons/note.png" alt="Note"> </td> <td class="content">As of Megatest version v1.6548 trim-trailing-spaces defaults to yes.</td> </tr></table> </div> <div class="listingblock"> <div class="content monospaced"> <pre>[configf:settings trim-trailing-spaces no] |
︙ | ︙ | |||
2640 2641 2642 2643 2644 2645 2646 | <pre># A normal waiton waits for the prior tests to be COMPLETED # and PASS, CHECK or WAIVED waiton test1 test2</pre> </div></div> <div class="admonitionblock"> <table><tr> <td class="icon"> | | | 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 | <pre># A normal waiton waits for the prior tests to be COMPLETED # and PASS, CHECK or WAIVED waiton test1 test2</pre> </div></div> <div class="admonitionblock"> <table><tr> <td class="icon"> <img src="/usr/images/icons/note.png" alt="Note"> </td> <td class="content">Dynamic waiton lists must be capable of being calculated at the beginning of a run. This is because Megatest walks the tree of waitons to create the list of tests to execute.</td> </tr></table> </div> <div class="listingblock"> |
︙ | ︙ | |||
3145 3146 3147 3148 3149 3150 3151 | <div class="content monospaced"> <pre>[triggers] COMPLETED/ xterm -e bash -s --</pre> </div></div> <div class="admonitionblock"> <table><tr> <td class="icon"> | | | 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 | <div class="content monospaced"> <pre>[triggers] COMPLETED/ xterm -e bash -s --</pre> </div></div> <div class="admonitionblock"> <table><tr> <td class="icon"> <img src="/usr/images/icons/note.png" alt="Note"> </td> <td class="content">There is a trailing space after the double-dash</td> </tr></table> </div> <div class="paragraph"><p>There are a number of environment variables available to the trigger script but since triggers can be called in various contexts not all variables are available at all times. The trigger script should check for the variable and |
︙ | ︙ | |||
3482 3483 3484 3485 3486 3487 3488 | </div> </div> </div> <div id="footnotes"><hr></div> <div id="footer"> <div id="footer-text"> Version 1.5<br> | | > | 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 | </div> </div> </div> <div id="footnotes"><hr></div> <div id="footer"> <div id="footer-text"> Version 1.5<br> Last updated 2021-01-25 11:33:16 MST </div> </div> </body> </html> |
Modified docs/manual/server.dot from [3e029f5fe5] to [922bb8feb0].
︙ | ︙ | |||
12 13 14 15 16 17 18 | // 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/>. digraph G { | > | > > | > > > > > > > > > > | < | > | > > > > > > | | > < < | < < > | > | | > > > > > > | < | | > > | | | > > > > > > > > > > > > | > > > > | > > | | > | < | > | | > > > > > > > > | | > | > > > > > > > > > > > > | | | | | | | | | | | | | | | < > | 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 | // 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/>. digraph G { // connecting to server subgraph cluster_1 { label="Connect"; node [style=filled,shape=box]; dotserver [label="Have .server file?"]; connect [label="Connect to server"]; // startserver [label="Start Server"]; connected [label="Connection Successful"]; anylive [label="Any live servers?"]; askstart [label="Ask existing server to start a new server"]; anydboard [label="Any live dashboards"]; askdboard [label="Ask dashboard to start server"]; serverlaunch [label="User server launch to start server process"]; wait5sec [label="Wait 5 seconds"]; dotserver -> connect [label="yes"]; connect -> connected [label="yes"]; connect -> anylive [label="no"]; // startserver -> anylive; anylive -> askstart [label="yes"]; anylive -> anydboard [label="no"]; anydboard -> askdboard [label="yes"]; anydboard -> serverlaunch [label="no"]; serverlaunch -> wait5sec; askdboard -> wait5sec; askstart -> wait5sec; wait5sec -> dotserver; } // server bootstrap subgraph cluster_2 { label="Startup"; node [style=filled,shape=box]; getlock [label="Get file lock"]; starthttpcpdb [label="Start http server/copy db to /tmp"]; createsrvfile [label="Create .nnn.server file containing host:port"]; releaselock [label="Release file lock"]; chksrv [label="Check if server already exists"]; exitstartup [label="exit/stop"]; sleep1 [label="Sleep few seconds"]; getlock -> starthttpcpdb [label="yes"]; getlock -> chksrv [label="no"]; starthttpcpdb -> createsrvfile -> releaselock; chksrv -> exitstartup [label="yes"]; chksrv -> sleep1 [label="no"]; sleep1 -> getlock; } // shutting down server subgraph cluster_3 { label="Shutdown"; node [style=filled,shape=box]; shutdown [label="Start Shutdown"]; rejectmode [label="Put http server into reject requests mode"]; syncback [label="Sync db back"]; removesrvfile [label="Remove server file containing host:port"]; exit [label="Exit process"]; shutdown -> rejectmode -> syncback -> removesrvfile -> exit; } // subgraph cluster_1 { // node [style=filled,shape=box]; // // check_available_queue -> remove_entries_over_10s_old; // remove_entries_over_10s_old -> set_available [label="num_avail < 3"]; // remove_entries_over_10s_old -> exit [label="num_avail > 2"]; // // set_available -> delay_2s; // delay_2s -> check_place_in_queue; // // check_place_in_queue -> "http:transport-launch" [label="at head"]; // check_place_in_queue -> exit [label="not at head"]; // // "client:login" -> "server:shutdown" [label="login failed"]; // "server:shutdown" -> exit; // // subgraph cluster_2 { // "http:transport-launch" -> "http:transport-run"; // "http:transport-launch" -> "http:transport-keep-running"; // // "http:transport-keep-running" -> "tests running?"; // "tests running?" -> "client:login" [label=yes]; // "tests running?" -> "server:shutdown" [label=no]; // "client:login" -> delay_5s [label="login ok"]; // delay_5s -> "http:transport-keep-running"; // } // // // start_server -> "server_running?"; // // "server_running?" -> set_available [label="no"]; // // "server_running?" -> delay_2s [label="yes"]; // // delay_2s -> "still_running?"; // // "still_running?" -> ping_server [label=yes]; // // "still_running?" -> set_available [label=no]; // // ping_server -> exit [label=alive]; // // ping_server -> remove_server_record [label=dead]; // // remove_server_record -> set_available; // // set_available -> avail_delay [label="delay 3s"]; // // avail_delay -> "first_in_queue?"; // // // // "first_in_queue?" -> set_running [label=yes]; // // set_running -> get_next_port -> handle_requests; // // "first_in_queue?" -> "dead_entry_in_queue?" [label=no]; // // "dead_entry_in_queue?" -> "server_running?" [label=no]; // // "dead_entry_in_queue?" -> "remove_dead_entries" [label=yes]; // // remove_dead_entries -> "server_running?"; // // // // handle_requests -> start_shutdown [label="no traffic\nno running tests"]; // // handle_requests -> shutdown_request; // // start_shutdown -> shutdown_delay; // // shutdown_request -> shutdown_delay; // // shutdown_delay -> exit; // // label = "server:launch"; // color=brown; // } // client_start_server -> start_server; // handle_requests -> read_write; // read_write -> handle_requests; } |
Modified docs/manual/server.png from [ae7d7ee58e] to [76af712a05].
cannot compute difference between binary files
Modified env.scm from [028e47144f] to [dfbf91100a].
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ;; ;; 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 env)) (use sql-de-lite) ;; srfi-1 posix regex regex-case srfi-69 srfi-18 call-with-environment-variables) (define (env:open-db fname) (let* ((db-exists (common:file-exists? fname)) (db (open-database fname))) (if (not db-exists) | > > > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ;; ;; 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 env)) (declare (uses commonmod)) (import commonmod) (use sql-de-lite) ;; srfi-1 posix regex regex-case srfi-69 srfi-18 call-with-environment-variables) (define (env:open-db fname) (let* ((db-exists (common:file-exists? fname)) (db (open-database fname))) (if (not db-exists) |
︙ | ︙ |
Modified ezsteps.scm from [5de5d166c7] to [c020b83da0].
︙ | ︙ | |||
25 26 27 28 29 30 31 32 33 34 35 36 37 38 | (declare (unit ezsteps)) (declare (uses db)) (declare (uses common)) (declare (uses items)) (declare (uses runconfig)) ;; (declare (uses sdb)) ;; (declare (uses filedb)) (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") (include "run_records.scm") | > > > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | (declare (unit ezsteps)) (declare (uses db)) (declare (uses common)) (declare (uses items)) (declare (uses runconfig)) ;; (declare (uses sdb)) ;; (declare (uses filedb)) (declare (uses commonmod)) (import commonmod) (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") (include "run_records.scm") |
︙ | ︙ |
Modified fs-transport.scm from [d1050dcefe] to [77f9528c25].
︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | (declare (unit fs-transport)) (declare (uses common)) (declare (uses db)) (declare (uses tests)) (declare (uses tasks)) ;; tasks are where stuff is maintained about what is running. (include "common_records.scm") (include "db_records.scm") ;;====================================================================== ;; F S T R A N S P O R T S E R V E R | > > > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | (declare (unit fs-transport)) (declare (uses common)) (declare (uses db)) (declare (uses tests)) (declare (uses tasks)) ;; tasks are where stuff is maintained about what is running. (declare (uses commonmod)) (import commonmod) (include "common_records.scm") (include "db_records.scm") ;;====================================================================== ;; F S T R A N S P O R T S E R V E R |
︙ | ︙ |
Modified genexample.scm from [c6a2ab2853] to [25924e53ee].
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ;; 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 genexample)) (use posix regex matchable) (include "db_records.scm") (define genexample:example-logpro #<<EOF ;; You should have at least one expect:required. This ensures that your process ran ;; comment out the line below and replace "put pattern here" with a pattern that will | > > > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ;; 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 genexample)) (use posix regex matchable) (declare (uses commonmod)) (import commonmod) (include "db_records.scm") (define genexample:example-logpro #<<EOF ;; You should have at least one expect:required. This ensures that your process ran ;; comment out the line below and replace "put pattern here" with a pattern that will |
︙ | ︙ |
Modified http-transport.scm from [2202b22e9f] to [e3908cc7e2].
︙ | ︙ | |||
33 34 35 36 37 38 39 40 41 42 43 44 45 46 | (declare (uses db)) (declare (uses tests)) (declare (uses tasks)) ;; tasks are where stuff is maintained about what is running. (declare (uses server)) ;; (declare (uses daemon)) (declare (uses portlogger)) (declare (uses rmt)) (include "common_records.scm") (include "db_records.scm") (include "js-path.scm") (require-library stml) (define (http-transport:make-server-url hostport) | > > > | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | (declare (uses db)) (declare (uses tests)) (declare (uses tasks)) ;; tasks are where stuff is maintained about what is running. (declare (uses server)) ;; (declare (uses daemon)) (declare (uses portlogger)) (declare (uses rmt)) (declare (uses commonmod)) (import commonmod) (include "common_records.scm") (include "db_records.scm") (include "js-path.scm") (require-library stml) (define (http-transport:make-server-url hostport) |
︙ | ︙ |
Modified index-tree.scm from [10c620fbfc] to [e2f065e1c8].
︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | (declare (unit tests)) (declare (uses lock-queue)) (declare (uses db)) (declare (uses common)) (declare (uses items)) (declare (uses runconfig)) (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") (include "run_records.scm") (include "test_records.scm") | > > > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | (declare (unit tests)) (declare (uses lock-queue)) (declare (uses db)) (declare (uses common)) (declare (uses items)) (declare (uses runconfig)) (declare (uses commonmod)) (import commonmod) (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") (include "run_records.scm") (include "test_records.scm") |
︙ | ︙ |
Modified items.scm from [16328a4b96] to [07a121ab4e].
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ;; (define itemdat '((ripeness "green ripe overripe") ;; (temperature "cool medium hot") ;; (season "summer winter fall spring"))) (declare (unit items)) (declare (uses common)) (include "common_records.scm") ;; Puts out all combinations (define (process-itemlist hierdepth curritemkey itemlist) (let ((res '())) (if (not hierdepth) | > > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ;; (define itemdat '((ripeness "green ripe overripe") ;; (temperature "cool medium hot") ;; (season "summer winter fall spring"))) (declare (unit items)) (declare (uses common)) (declare (uses commonmod)) (import commonmod) (include "common_records.scm") ;; Puts out all combinations (define (process-itemlist hierdepth curritemkey itemlist) (let ((res '())) (if (not hierdepth) |
︙ | ︙ |
Modified keys.scm from [9fa2c0cfa5] to [cc8cc0e6ea].
︙ | ︙ | |||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ;;====================================================================== (use sqlite3 srfi-1 posix regex regex-case srfi-69) (import (prefix sqlite3 sqlite3:)) (declare (unit keys)) (declare (uses common)) (include "key_records.scm") (include "common_records.scm") (define (keys->keystr keys) ;; => key1,key2,key3,additiona1, ... (string-intersperse keys ",")) | > > > | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | ;;====================================================================== (use sqlite3 srfi-1 posix regex regex-case srfi-69) (import (prefix sqlite3 sqlite3:)) (declare (unit keys)) (declare (uses common)) (declare (uses commonmod)) (import commonmod) (include "key_records.scm") (include "common_records.scm") (define (keys->keystr keys) ;; => key1,key2,key3,additiona1, ... (string-intersperse keys ",")) |
︙ | ︙ |
Modified launch.scm from [e8093b3e63] to [e660975911].
︙ | ︙ | |||
30 31 32 33 34 35 36 37 38 39 40 41 42 43 | (declare (unit launch)) (declare (uses subrun)) (declare (uses common)) (declare (uses configf)) (declare (uses db)) (declare (uses ezsteps)) (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") (include "megatest-fossil-hash.scm") ;;====================================================================== | > > > | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | (declare (unit launch)) (declare (uses subrun)) (declare (uses common)) (declare (uses configf)) (declare (uses db)) (declare (uses ezsteps)) (declare (uses commonmod)) (import commonmod) (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") (include "megatest-fossil-hash.scm") ;;====================================================================== |
︙ | ︙ |
Modified lock-queue.scm from [21543b63ce] to [e12825ce7c].
︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 | (use (prefix sqlite3 sqlite3:) srfi-18) (declare (unit lock-queue)) (declare (uses common)) (declare (uses tasks)) ;;====================================================================== ;; attempt to prevent overlapping updates of rollup files by queueing ;; update requests in an sqlite db ;;====================================================================== ;;====================================================================== ;; db record, <vector db path-to-db> | > > | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | (use (prefix sqlite3 sqlite3:) srfi-18) (declare (unit lock-queue)) (declare (uses common)) (declare (uses tasks)) (declare (uses commonmod)) (import commonmod) ;;====================================================================== ;; attempt to prevent overlapping updates of rollup files by queueing ;; update requests in an sqlite db ;;====================================================================== ;;====================================================================== ;; db record, <vector db path-to-db> |
︙ | ︙ |
Modified megatest.scm from [e69eff1234] to [267351f3b9].
︙ | ︙ | |||
39 40 41 42 43 44 45 46 47 48 49 50 51 52 | (declare (uses mt)) (declare (uses api)) (declare (uses tasks)) ;; only used for debugging. (declare (uses env)) (declare (uses diff-report)) ;; (declare (uses ftail)) ;; (import ftail) (define *db* #f) ;; this is only for the repl, do not use in general!!!! (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") (include "run_records.scm") | > > > > > > > > > > > > > > > > > | 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 | (declare (uses mt)) (declare (uses api)) (declare (uses tasks)) ;; only used for debugging. (declare (uses env)) (declare (uses diff-report)) ;; (declare (uses ftail)) ;; (import ftail) ;; Needed for repl even if not used here in megatest.scm (declare (uses commonmod)) (import commonmod) (declare (uses commonmod.import)) (declare (uses dbmod)) (import dbmod) (declare (uses dbmod.import)) (declare (uses servermod)) (import servermod) (declare (uses servermod.import)) (declare (uses apimod)) (import apimod) (declare (uses apimod.import)) (define *db* #f) ;; this is only for the repl, do not use in general!!!! (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") (include "run_records.scm") |
︙ | ︙ | |||
446 447 448 449 450 451 452 | "-mark-incompletes" "-convert-to-norm" "-convert-to-old" "-import-megatest.db" "-sync-to-megatest.db" "-sync-brute-force" | | | 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | "-mark-incompletes" "-convert-to-norm" "-convert-to-old" "-import-megatest.db" "-sync-to-megatest.db" "-sync-brute-force" ;; "-logging" "-v" ;; verbose 2, more than normal (normal is 1) "-q" ;; quiet 0, errors/warnings only "-diff-rep" "-syscheck" "-obfuscate" |
︙ | ︙ | |||
638 639 640 641 642 643 644 | (exit 1)))) homehost-required)))) ;;====================================================================== ;; Misc setup stuff ;;====================================================================== | | | | 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 | (exit 1)))) homehost-required)))) ;;====================================================================== ;; Misc setup stuff ;;====================================================================== (common:debug-setup) ;; (if (args:get-arg "-logging")(set! *logging* #t)) ;;(if (debug:debug-mode 3) ;; we are obviously debugging ;; (set! open-run-close open-run-close-no-exception-handling)) (if (args:get-arg "-itempatt") (let ((newval (conc (args:get-arg "-testpatt") "/" (args:get-arg "-itempatt")))) (debug:print 0 *default-log-port* "WARNING: -itempatt has been deprecated, please use -testpatt testpatt/itempatt method, new testpatt is "newval) |
︙ | ︙ |
Added mofiles/README version [9c3858647c].
> | 1 | Built modules go here - an attempt to minimize clutter. |
Modified mt.scm from [e9055c2687] to [ab3fd4d8a3].
︙ | ︙ | |||
26 27 28 29 30 31 32 33 34 35 36 37 38 39 | (declare (uses items)) (declare (uses runconfig)) (declare (uses tests)) (declare (uses server)) (declare (uses runs)) (declare (uses rmt)) ;; (declare (uses filedb)) (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") (include "run_records.scm") (include "test_records.scm") | > > > | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | (declare (uses items)) (declare (uses runconfig)) (declare (uses tests)) (declare (uses server)) (declare (uses runs)) (declare (uses rmt)) ;; (declare (uses filedb)) (declare (uses commonmod)) (import commonmod) (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") (include "run_records.scm") (include "test_records.scm") |
︙ | ︙ |
Added mtconfigf.scm version [dd571ebac6].
> > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ;;====================================================================== ;; Copyright 2019, 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 mtconfigf)) (include "mtconfigf/mtconfigf.scm") |
Added mtconfigf/Makefile version [b67298756b].
> > | 1 2 | test: env CHICKEN_REPOSITORY=../../../megatest/tmpinstall/eggs/lib/chicken/7 csi -s tests/run.scm |
Added mtconfigf/mtconfigf.meta version [9fb56292e9].
> > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ( ; Your egg's license: (license "LGPL") ; Pick one from the list of categories (see below) for your egg and enter it ; here. (category misc) ; A list of eggs mpeg3 depends on. If none, you can omit this declaration ; altogether. If you are making an egg for chicken 3 and you need to use ; procedures from the `files' unit, be sure to include the `files' egg in the ; `needs' section (chicken versions < 3.4.0 don't provide the `files' unit). ; `depends' is an alias to `needs'. (needs srfi-1 srfi-69 regex regex-case directory-utils extras srfi-13 posix typed-records) ; A list of eggs required for TESTING ONLY. See the `Tests' section. (test-depends test) (author "Matt Welland") (synopsis "Megatest config file (ini-space format) with many enhancements.")) |
Added mtconfigf/mtconfigf.scm version [1f14c46c82].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 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 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 | ;;====================================================================== ;; Copyright 2006-2018, 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/>. ;; ;;====================================================================== ;; NOTE: This is the configf module, long term it will replace configf.scm. (module mtconfigf ( set-debug-printers lazy-convert assoc-safe-add section-var-set! safe-file-exists? read-link-f nice-path eval-string-in-environment safe-setenv with-env-vars cmd-run->list port->list configf:system process-line shell configf:read-line cfgdat->env-alist calc-allow-system apply-wildcards val->alist section->val-alist read-config find-config find-and-read-config lookup var-is? lookup-number section-vars get-section set-section-var compress-multi-lines expand-multi-lines file->list write-config write-merge-config read-refdb map-all-hier-alist config->alist alist->config read-alist write-alist config->ini ;;set-verbosity add-eval-string get-eval-string squelch-debug-prints ;; misc realpath find-chicken-lib ) (import scheme (chicken base) (chicken string) (chicken file) (chicken port)) (import typed-records srfi-18 pathname-expand) (import regex regex-case srfi-69 srfi-1 directory-utils srfi-13 ) (import (chicken io) (chicken condition) (chicken process-context)) (import (chicken process) (chicken pathname) (chicken pretty-print) (chicken time)) (import srfi-69 (chicken platform) (chicken sort)) ;; stub debug printers overridden by set-debug-printers (define (debug:print n e . args) (apply print args)) (define (debug:print-info n e . args) (apply print "INFO: " args)) (define (debug:print-error n e . args) (apply print "ERROR: " args)) ;;(import (prefix mtdebug debug:)) ;;(define args:any? args:any-defined?) ;; cannot name it any? in mtargs module ;; FROM common.scm ;; ;; this plugs a hole in posix-extras in recent chicken versions > 4.9) ;;;(let-values (( (chicken-release-number chicken-major-version) ;;; (apply values ;;; (map string->number ;;; (take ;;; (string-split (chicken-version) ".") ;;; 2))))) ;;; (if (or (> chicken-release-number 4) ;;; (and (eq? 4 chicken-release-number) (> chicken-major-version 9))) ;;; (define ##sys#expand-home-path pathname-expand))) ;;(define (set-verbosity v)(debug:set-verbosity v)) (define *default-log-port* (current-error-port)) (define (debug:print-error n . args) ;;; n available to end-users but ignored for ;; default provided function (with-output-to-port (current-error-port) (lambda () (apply print "ERROR: "args)))) (define (set-debug-printers normal-fn info-fn error-fn default-port) (if error-fn (set! debug:print-error error-fn)) (if info-fn (set! debug:print-info info-fn)) (if normal-fn (set! debug:print normal-fn)) (if default-port (set! *default-log-port* default-port))) (define (squelch-debug-prints) (let ((noop (lambda x #f))) (set! debug:print noop) (set! debug:print-info noop))) ;; 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))) (define *eval-string* "") (define (add-eval-string str) (if (not (string-contains *eval-string* str)) (set! *eval-string* (conc *eval-string* " " str)))) (define (get-eval-string) *eval-string*) ;; Moved to common ;; ;; return list (path fullpath configname) (define (find-config configname #!key (toppath #f)) (if toppath (let ((cfname (conc toppath "/" configname))) (if (safe-file-exists? cfname) (list toppath cfname configname) (list #f #f #f))) (let* ((cwd (string-split (current-directory) "/"))) (let loop ((dir cwd)) (let* ((path (conc "/" (string-intersperse dir "/"))) (fullpath (conc path "/" configname))) (if (safe-file-exists? fullpath) (list path fullpath configname) (let ((remcwd (take dir (- (length dir) 1)))) (if (null? remcwd) (list #f #f #f) ;; #f #f) (loop remcwd))))))))) (define (assoc-safe-add alist key val #!key (metadata #f)) (let ((newalist (filter (lambda (x)(not (equal? key (car x)))) alist))) (append newalist (list (if metadata (list key val metadata) (list key val)))))) (define (section-var-set! cfgdat section-name var value #!key (metadata #f)) (hash-table-set! cfgdat section-name (assoc-safe-add (hash-table-ref/default cfgdat section-name '()) var value metadata: metadata))) ;;====================================================================== ;; Environment handling stuff ;;====================================================================== (define (safe-file-exists? path) (handle-exceptions exn #f (file-exists? path))) (define (read-link-f path) (handle-exceptions exn (begin (debug:print-error 0 *default-log-port* "command \"/bin/readlink -f " path "\" failed.") path) ;; just give up (with-input-from-pipe (conc "/bin/readlink -f " path) (lambda () (read-line))))) ;; return a nice clean pathname made absolute (define (nice-path dir) (let ((match (string-match "^(~[^\\/]*)(\\/.*|)$" dir))) (if match ;; using ~ for home? (nice-path (conc #;(read-link-f (cadr match)) (realpath (cadr match)) "/" (caddr match))) (normalize-pathname (if (absolute-pathname? dir) dir (conc (current-directory) "/" dir)))))) (define (eval-string-in-environment str) (handle-exceptions exn (begin (debug:print-error 0 *default-log-port* "problem evaluating \"" str "\" in the shell environment") #f) (let ((cmdres (cmd-run->list (conc "echo " str)))) (if (null? cmdres) "" (caar cmdres))))) (define (safe-setenv key val) (if (substring-index ":" key) ;; variables containing : are for internal use and cannot be environment variables. (debug:print-error 4 *default-log-port* "skip setting internal use only variables containing \":\"") (if (and (string? val) (string? key)) (handle-exceptions exn (debug:print-error 0 *default-log-port* "bad value for setenv, key=" key ", value=" val) (set-environment-variable! key val)) (debug:print-error 0 *default-log-port* "bad value for setenv, key=" key ", value=" val)))) ;; accept an alist or hash table containing envvar/env value pairs (value of #f causes unset) ;; execute thunk in context of environment modified as per this list ;; restore env to prior state then return value of eval'd thunk. ;; ** this is not thread safe ** (define (with-env-vars delta-env-alist-or-hash-table thunk) (let* ((delta-env-alist (if (hash-table? delta-env-alist-or-hash-table) (hash-table->alist delta-env-alist-or-hash-table) delta-env-alist-or-hash-table)) (restore-thunks (filter identity (map (lambda (env-pair) (let* ((env-var (car env-pair)) (new-val (let ((tmp (cdr env-pair))) (if (list? tmp) (car tmp) tmp))) (current-val (get-environment-variable env-var)) (restore-thunk (cond ((not current-val) (lambda () (unset-environment-variable! env-var))) ((not (string? new-val)) #f) ((eq? current-val new-val) #f) (else (lambda () (set-environment-variable! env-var current-val)))))) ;;(when (not (string? new-val)) ;; (debug:print 0 *default-log-port* " PROBLEM: not a string: "new-val"\n from env-alist:\n"delta-env-alist) ;; (pp delta-env-alist) ;; (exit 1)) (cond ((not new-val) ;; modify env here (unset-environment-variable! env-var)) ((string? new-val) (set-environment-variable! env-var new-val))) restore-thunk)) delta-env-alist)))) (let ((rv (thunk))) (for-each (lambda (x) (x)) restore-thunks) ;; restore env to original state rv))) (define (cmd-run->list cmd #!key (delta-env-alist-or-hash-table '())) (with-env-vars delta-env-alist-or-hash-table (lambda () (let* ((fh (open-input-pipe cmd)) (res (port->list fh)) (status (close-input-pipe fh))) (list res status))))) (define (port->list fh) (if (eof-object? fh) #f (let loop ((curr (read-line fh)) (result '())) (if (not (eof-object? curr)) (loop (read-line fh) (append result (list curr))) result)))) ;;====================================================================== ;; Make the regexp's needed globally available ;;====================================================================== (define configf:include-rx (regexp "^\\[include\\s+(.*)\\]\\s*$")) (define configf:script-rx (regexp "^\\[scriptinc\\s+(\\S+)([^\\]]*)\\]\\s*$")) ;; include output from a script (define configf:section-rx (regexp "^\\[(.*)\\]\\s*$")) (define configf:blank-l-rx (regexp "^\\s*$")) (define configf:key-sys-pr (regexp "^(\\S+)\\s+\\[system\\s+(\\S+.*)\\]\\s*$")) (define configf:key-val-pr (regexp "^(\\S+)(\\s+(.*)|())$")) (define configf:key-no-val (regexp "^(\\S+)(\\s*)$")) (define configf:comment-rx (regexp "^\\s*#.*")) (define configf:cont-ln-rx (regexp "^(\\s+)(\\S+.*)$")) (define configf:settings (regexp "^\\[configf:settings\\s+(\\S+)\\s+(\\S+)]\\s*$")) (define configf:initstr-rx (regexp "^\\[configf:initstr\\s+(.*)\\]\\s*$")) ;; read a line and process any #{ ... } constructs (define configf:var-expand-regex (regexp "^(.*)#\\{(scheme|system|shell|getenv|get|runconfigs-get|rget|scm|sh|rp|gv|g|mtrah)\\s+([^\\}\\{]*)\\}(.*)")) (define (configf:system ht cmd) (system cmd) ) ;; Lookup a value in runconfigs based on -reqtarg or -target ;; (define (runconfigs-get config var) ;; .dvars is a special bin for storing metadata such as target (let ((targ (lookup config ".dvars" "target"))) ;; (common:args-get-target))) ;; (or (args:get-arg "-reqtarg")(args:get-arg "-target")(getenv "MT_TARGET")))) (if targ (or (lookup config targ var) (lookup config "default" var)) (lookup config "default" var)))) (define (realpath x) (let ((currdir (current-directory))) (handle-exceptions exn (begin (change-directory currdir) x) ;; anything goes wrong - return given path (change-directory x) (let ((result (current-directory))) (change-directory currdir) result)))) ;; (resolve-pathname (pathname-expand (or x "/dev/null")) )) (define (common:get-this-exe-fullpath #!key (argv (argv))) (let* ((this-script (cond ((and (> (length argv) 2) (string-match "^(.*/csi|csi)$" (car argv)) (string-match "^-(s|ss|sx|script)$" (cadr argv))) (caddr argv)) (else (car argv)))) (fullpath (realpath this-script))) fullpath)) ;; (use trace) ;; (trace-call-sites #t) ;; (trace realpath common:get-this-exe-fullpath) (define *common:this-exe-fullpath* (common:get-this-exe-fullpath)) (define *common:this-exe-dir* (pathname-directory *common:this-exe-fullpath*)) (define *common:this-exe-name* (pathname-strip-directory *common:this-exe-fullpath*)) (define (find-chicken-lib) (let* ((ckhome (chicken-home)) (libpath-number (car (reverse (string-split (repository-path) "/")))) (libpath (conc *common:this-exe-dir* "/../../eggs/lib/chicken/" libpath-number))) (if (and (not (get-environment-variable "CHICKEN_REPOSITORY")) (directory-exists? libpath)) (conc "(repository-path \""libpath"\") ") ""))) (define (process-line l ht allow-system #!key (linenum #f)(extend-eval "")) (let loop ((res l)) (if (string? res) (let ((matchdat (string-search configf:var-expand-regex res))) (if matchdat (let* ((prestr (list-ref matchdat 1)) (cmdtype (list-ref matchdat 2)) ;; eval, system, shell, getenv (cmd (list-ref matchdat 3)) (poststr (list-ref matchdat 4)) (result #f) (start-time (current-milliseconds)) (cmdsym (string->symbol cmdtype)) (presnip (conc "(import posix)(import directory-utils)" "(set! getenv get-environment-variable)" )) (allsnip (conc "(import posix)(import directory-utils)" "(set! getenv get-environment-variable)" (find-chicken-lib) "(import (prefix mtconfigf configf:))" "(import mtconfigf)" *eval-string*)) (fullcmd (case cmdsym ((scheme scm) (conc "(lambda (ht)" allsnip "" cmd "))")) ((system) (conc "(lambda (ht)" allsnip "(configf:system ht \"" cmd "\"))")) ((shell sh) (conc "(lambda (ht)" allsnip "(string-translate (shell \"" cmd "\") \"\n\" \" \"))")) ((realpath rp)(conc "(lambda (ht)" allsnip "(configf:nice-path \"" cmd "\"))")) ((getenv gv) (conc "(lambda (ht)(get-environment-variable \"" cmd "\"))")) ((mtrah) (conc "(lambda (ht)" allsnip " (let ((extra \"" cmd "\"))" " (conc (or *toppath* (get-environment-variable \"MT_RUN_AREA_HOME\"))" " (if (string-null? extra) \"\" \"/\")" " extra)))")) ((get g) (let* ((parts (string-split cmd)) (sect (car parts)) (var (cadr parts))) (conc "(lambda (ht)(configf:lookup ht \"" sect "\" \"" var "\"))"))) ;;((runconfigs-get rget) (conc "(lambda (ht)" allsnip "(configf:runconfigs-get ht \"" cmd "\"))")) ((runconfigs-get rget) (runconfigs-get ht cmd)) (else "(lambda (ht)(print \"ERROR\") \"ERROR\")")))) (handle-exceptions exn (let ((arguments ((condition-property-accessor 'exn 'arguments) exn)) (message ((condition-property-accessor 'exn 'message) exn)) (allstr (conc "#{( " cmdtype ") " cmd "}, full expansion: " fullcmd))) (debug:print 0 *default-log-port* "WARNING: failed to process config input \"" l "\"") (debug:print 0 *default-log-port* " message: " message (if arguments (conc "; " (string-intersperse (map conc arguments) ", ")) "")) (debug:print 0 *default-log-port* "INFO: allstr is\n" allstr) ;; (debug:print 0 *default-log-port* "exn=" (condition->list exn)) (set! result allstr)) (if (or allow-system (not (member cmdtype '("system" "shell" "sh")))) (if (member cmdsym '(runconfigs-get rget)) (begin (set! result fullcmd) fullcmd) (with-input-from-string fullcmd (lambda () (set! result ((eval (read) ;;(module-environment 'mtconfigf) ) ht))))) (set! result (conc "#{(" cmdtype ") " cmd "}")))) (case cmdsym ((system shell scheme scm sh) (let ((delta (- (current-milliseconds) start-time))) (if (> delta 2000) (debug:print-info 0 *default-log-port* "for line \"" l "\"\n command: " cmd " took " (/ delta 1000) " seconds to run with output:\n " result) (debug:print-info 9 *default-log-port* "for line \"" l "\"\n command: " cmd " took " (/ delta 1000) " seconds to run with output:\n " result))))) (loop (conc prestr result poststr))) res)) res))) ;; Run a shell command and return the output as a string (define (shell cmd) (let* ((output (cmd-run->list cmd)) (res (car output)) (status (cadr output))) (if (equal? status 0) (let ((outres (string-intersperse res "\n"))) (debug:print-info 4 *default-log-port* "shell result:\n" outres) outres) (begin (with-output-to-port (current-error-port) (lambda () (print "ERROR: " cmd " returned bad exit code " status))) "")))) ;; this was inline but I'm pretty sure that is a hold over from when it was *very* simple ... ;; (define (configf:read-line p ht allow-processing settings #!key ....) (let loop ((inl (read-line p))) (let ((cont-line (and (string? inl) (not (string-null? inl)) (equal? "\\" (string-take-right inl 1))))) (if cont-line ;; last character is \ (let ((nextl (read-line p))) (if (not (eof-object? nextl)) (loop (string-append (if cont-line (string-take inl (- (string-length inl) 1)) inl) nextl)))) (let ((res (case allow-processing ;; if (and allow-processing ;; (not (eq? allow-processing 'return-string))) ((#t #f) (process-line inl ht allow-processing)) ((return-string) inl) (else (process-line inl ht allow-processing))))) (if (string? res) (let* ((r1 (if (not (equal? (hash-table-ref/default settings "trim-trailing-spaces" "no") "no")) (string-substitute "\\s+$" "" res) res)) (r2 (if (not (equal? (hash-table-ref/default settings "line-end-comments" "no") "no")) (string-substitute "\\s*#+[^\\{]*.*$" "" r1) r1))) r2) res)))))) (define (cfgdat->env-alist section cfgdat-ht allow-system) (filter (lambda (pair) (let* ((var (car pair)) (val (cdr pair))) (cons var (cond ((and allow-system (procedure? val)) ;; if we decided to use something other than #t or #f for allow-system ('return-procs or 'return-string) , this may become problematic (val)) ((procedure? val) #f) ((string? val) val) (else "#f"))))) (append (hash-table-ref/default cfgdat-ht "default" '()) (if (equal? section "default") '() (hash-table-ref/default cfgdat-ht section '()))))) (define (calc-allow-system allow-system section sections) (if sections (and (or (equal? "default" section) (member section sections)) allow-system) ;; account for sections and return allow-system as it might be a symbol such as return-strings allow-system)) ;; given a config hash and a section name, apply that section to all matching sections (using wildcard % or regex if /..../) ;; remove the section when done so that there is no downstream clobbering ;; (define (apply-wildcards ht section-name) (if (hash-table-exists? ht section-name) (let* ((vars (hash-table-ref ht section-name)) (rxstr (if (string-contains section-name "%") (string-substitute (regexp "%") ".*" section-name) (string-substitute (regexp "^/(.*)/$") "\\1" section-name))) (rx (regexp rxstr))) ;; (print "\nsection-name: " section-name " rxstr: " rxstr) (for-each (lambda (section) (if section (let ((same-section (string=? section-name section)) (rx-match (string-match rx section))) ;; (print "section: " section " vars: " vars " same-section: " same-section " rx-match: " rx-match) (if (and (not same-section) rx-match) (for-each (lambda (bundle) ;; (print "bundle: " bundle) (let ((key (car bundle)) (val (cadr bundle)) (meta (if (> (length bundle) 2)(caddr bundle) #f))) (hash-table-set! ht section (assoc-safe-add (hash-table-ref ht section) key val metadata: meta)))) vars))))) (hash-table-keys ht)))) ht) ;;====================================================================== ;; Extended config lines, allows storing more hierarchial data in the config lines ;; ABC a=1; b=hello world; c=a ;; ;; NOTE: implementation is quite limited. You currently cannot have ;; semicolons in your string values. ;;====================================================================== ;; convert string a=1; b=2; c=a silly thing; d= ;; 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)))) val-list) '()))) ;; I don't want configf to turn into a weak yaml format but this extention is really useful ;; (define (section->val-alist cfgdat section-name #!key (convert #f)) (let ((section (get-section cfgdat section-name))) (map (lambda (item) (let ((key (car item)) (val (cadr item))) ;; BUG IN WAIT. sections are not returned as proper alists, should fix this. (cons key (val->alist val convert: convert)))) section))) ;; read a config file, returns hash table of alists ;; read a config file, returns hash table of alists ;; adds to ht if given (must be #f otherwise) ;; allow-system: ;; #f - do not evaluate [system ;; #t - immediately evaluate [system and store result as string ;; 'return-procs -- return a proc taking ht as an argument that may be evaulated at some future time ;; 'return-string -- return a string representing a proc taking ht as an argument that may be evaulated at some future time ;; envion-patt is a regex spec that identifies sections that will be eval'd ;; in the environment on the fly ;; sections: #f => get all, else list of sections to gather ;; post-section-procs alist of section-pattern => proc, where: (proc section-name next-section-name ht curr-path) ;; apply-wildcards: #t/#f - apply vars from targets with % wildcards to all matching sections ;; ;; NOTE: apply-wild variable is intentional (but a better name would be good) ;; (define (read-config path ht allow-system #!key (environ-patt #f) (curr-section #f) (sections #f) (settings (make-hash-table)) (keep-filenames #f) (post-section-procs '()) (apply-wild #t) ) (debug:print 9 *default-log-port* "BB> read-config > keep-filenames: " keep-filenames) (debug:print 9 *default-log-port* "START: " path) ;; (if *configdat* ;; (common:save-pkt `((action . read-config) ;; (f . ,(cond ((string? path) path) ;; ((port? path) "port") ;; (else (conc path)))) ;; (T . configf)) ;; *configdat* #t add-only: #t)) (if (and (not (port? path)) (not (safe-file-exists? path))) ;; for case where we are handed a port (begin (debug:print-info 1 *default-log-port* "read-config - file not found " path " current path: " (current-directory)) ;; WARNING: This is a risky change but really, we should not return an empty hash table if no file read? #f) ;; (if (not ht)(make-hash-table) ht)) (let* ((have-file (string? path)) (inp (if have-file (open-input-file path) path)) ;; we can be handed a port (res (if (not ht)(make-hash-table) ht)) (metapath (if keep-filenames path #f)) (process-wildcards (lambda (res curr-section-name) (if (and apply-wild (or (string-contains curr-section-name "%") ;; wildcard (string-match "/.*/" curr-section-name))) ;; regex (begin (apply-wildcards res curr-section-name) (hash-table-delete! res curr-section-name)))))) ;; NOTE: if the section is a wild card it will be REMOVED from res (let loop ((inl (configf:read-line inp res (calc-allow-system allow-system curr-section sections) settings)) ;; (read-line inp)) (curr-section-name (if curr-section curr-section "default")) (var-flag #f);; turn on for key-var-pr and cont-ln-rx, turn off elsewhere (lead #f)) (debug:print-info 8 *default-log-port* "curr-section-name: " curr-section-name " var-flag: " var-flag "\n inl: \"" inl "\"") (if (eof-object? inl) (begin ;; process last section for wildcards (process-wildcards res curr-section-name) (if have-file ;; we received a path, not a port, thus we are responsible for closing it. (close-input-port inp)) (if (list? sections) ;; delete all sections except given when sections is provided (for-each (lambda (section) (if (not (member section sections)) (hash-table-delete! res section))) ;; we are using "" as a dumping ground and must remove it before returning the ht (hash-table-keys res))) (debug:print 9 *default-log-port* "END: " path) res ) ;; retval (regex-case inl (configf:comment-rx _ (loop (configf:read-line inp res (calc-allow-system allow-system curr-section-name sections) settings) curr-section-name #f #f)) (configf:blank-l-rx _ (loop (configf:read-line inp res (calc-allow-system allow-system curr-section-name sections) settings) curr-section-name #f #f)) (configf:settings ( x setting val ) (begin (hash-table-set! settings setting val) (loop (configf:read-line inp res (calc-allow-system allow-system curr-section-name sections) settings) curr-section-name #f #f))) (configf:initstr-rx ( x initstr ) (begin (add-eval-string initstr) (loop (configf:read-line inp res (calc-allow-system allow-system curr-section-name sections) settings) curr-section-name #f #f))) (configf:include-rx ( x include-file ) (let* ((curr-conf-dir (pathname-directory path)) (full-conf (if (and (absolute-pathname? include-file) (file-exists? include-file)) include-file (nice-path (conc (if curr-conf-dir curr-conf-dir ".") "/" include-file)))) (all-matches (sort (handle-exceptions exn (list) (glob full-conf)) string<=?))) (if (null? all-matches) (begin (debug:print '(2 9) #f "INFO: include file(s) matching " include-file " not found (called from " path ")") (debug:print 2 *default-log-port* " " full-conf)) (for-each (lambda (fpath) ;; (push-directory conf-dir) (debug:print 9 *default-log-port* "Including: " full-conf) (read-config fpath res allow-system environ-patt: environ-patt curr-section: curr-section-name sections: sections settings: settings keep-filenames: keep-filenames)) all-matches)) (loop (configf:read-line inp res (calc-allow-system allow-system curr-section-name sections) settings) curr-section-name #f #f))) (configf:script-rx ( x include-script params);; handle-exceptions ;; exn ;; (begin ;; (debug:print '(0 2 9) #f "INFO: include from script " include-script " failed.") ;; (loop (configf:read-line inp res (calc-allow-system allow-system curr-section-name sections) settings) curr-section-name #f #f)) (if (and (safe-file-exists? include-script)(file-executable? include-script)) (let* ((local-allow-system (calc-allow-system allow-system curr-section-name sections)) (env-delta (cfgdat->env-alist curr-section-name res local-allow-system)) (new-inp-port (with-env-vars env-delta (lambda () (open-input-pipe (conc include-script " " params)))))) (debug:print '(2 9) *default-log-port* "Including from script output: " include-script) ;; (print "We got here, calling read-config next. Port is: " new-inp-port) (read-config new-inp-port res allow-system environ-patt: environ-patt curr-section: curr-section-name sections: sections settings: settings keep-filenames: keep-filenames) (close-input-port new-inp-port) (loop (configf:read-line inp res (calc-allow-system allow-system curr-section-name sections) settings) curr-section-name #f #f)) (begin (debug:print 0 *default-log-port* "Script not found or not exectutable: " include-script) (loop (configf:read-line inp res (calc-allow-system allow-system curr-section-name sections) settings) curr-section-name #f #f))) ) ;; ) (configf:section-rx ( x section-name ) (begin ;; call post-section-procs (for-each (lambda (dat) (let ((patt (car dat)) (proc (cdr dat))) (if (string-match patt curr-section-name) (proc curr-section-name section-name res path)))) post-section-procs) ;; after gathering the vars for a section and if apply-wildcards is true and if there is a wildcard in the section name process wildcards ;; NOTE: we are processing the curr-section-name, NOT section-name. (process-wildcards res curr-section-name) (if (not (hash-table-ref/default res section-name #f))(hash-table-set! res section-name '())) ;; ensure that mere mention of a section is not lost (loop (configf:read-line inp res (calc-allow-system allow-system curr-section-name sections) settings) ;; if we have the sections list then force all settings into "" and delete it later? ;; (if (or (not sections) ;; (member section-name sections)) ;; section-name "") ;; stick everything into "". NOPE: We need new strategy. Put stuff in correct sections and then delete all sections later. section-name #f #f))) (configf:key-sys-pr ( x key cmd ) (if (calc-allow-system allow-system curr-section-name sections) (let ((alist (hash-table-ref/default res curr-section-name '())) (val-proc (lambda () (let* ((start-time (current-seconds)) (local-allow-system (calc-allow-system allow-system curr-section-name sections)) (env-delta (cfgdat->env-alist curr-section-name res local-allow-system)) (cmdres (cmd-run->list cmd delta-env-alist-or-hash-table: env-delta)) ;; BB: here is where [system is exec'd. needs to have env from other vars! (delta (- (current-seconds) start-time)) (status (cadr cmdres)) (res (car cmdres))) (debug:print-info 4 *default-log-port* "" inl "\n => " (string-intersperse res "\n")) (if (not (eq? status 0)) (begin (debug:print-error 0 *default-log-port* "problem with " inl ", return code " status " output: " cmdres))) (if (> delta 2) (debug:print-info 0 *default-log-port* "for line \"" inl "\"\n command: " cmd " took " delta " seconds to run with output:\n " res) (debug:print-info 9 *default-log-port* "for line \"" inl "\"\n command: " cmd " took " delta " seconds to run with output:\n " res)) (if (null? res) "" (string-intersperse res " ")))))) (hash-table-set! res curr-section-name (assoc-safe-add alist key (case (calc-allow-system allow-system curr-section-name sections) ((return-procs) val-proc) ((return-string) cmd) (else (val-proc))) metadata: metapath)) (loop (configf:read-line inp res (calc-allow-system allow-system curr-section-name sections) settings) curr-section-name #f #f)) (loop (configf:read-line inp res (calc-allow-system allow-system curr-section-name sections) settings) curr-section-name #f #f))) (configf:key-no-val ( x key val) (let* ((alist (hash-table-ref/default res curr-section-name '())) (fval (or (if (string? val) val #f) ""))) ;; fval should be either "" or " " (one or more spaces) (debug:print 10 *default-log-port* " setting: [" curr-section-name "] " key " = #t") (safe-setenv key fval) (hash-table-set! res curr-section-name (assoc-safe-add alist key fval metadata: metapath)) (loop (configf:read-line inp res (calc-allow-system allow-system curr-section-name sections) settings) curr-section-name key #f))) (configf:key-val-pr ( x key unk1 val unk2 ) (let* ((alist (hash-table-ref/default res curr-section-name '())) (envar (and environ-patt (string-search (regexp environ-patt) curr-section-name) (and (not (string-null? key)) (not (equal? "!" (substring key 0 1)))) ;; ! as leading character is a signature to NOT export to the environment ;; (string-match "^.*:.*:.*$" key) ;; ;; something:something:something reserved for triggers in runconfigs )) (realval (if envar (eval-string-in-environment val) val))) (debug:print-info 6 *default-log-port* "read-config env setting, envar: " envar " realval: " realval " val: " val " key: " key " curr-section-name: " curr-section-name) (if envar (safe-setenv key realval)) (debug:print 10 *default-log-port* " setting: [" curr-section-name "] " key " = " val) (hash-table-set! res curr-section-name (assoc-safe-add alist key realval metadata: metapath)) (loop (configf:read-line inp res (calc-allow-system allow-system curr-section-name sections) settings) curr-section-name key #f))) ;; if a continued line (configf:cont-ln-rx ( x whsp val ) (let ((alist (hash-table-ref/default res curr-section-name '()))) (if var-flag ;; if set to a string then we have a continued var (let ((newval (conc (lookup res curr-section-name var-flag) "\n" ;; trim lead from the incoming whsp to support some indenting. (if lead (string-substitute (regexp lead) "" whsp) "") val))) ;; (print "val: " val "\nnewval: \"" newval "\"\nvarflag: " var-flag) (hash-table-set! res curr-section-name (assoc-safe-add alist var-flag newval metadata: metapath)) (loop (configf:read-line inp res (calc-allow-system allow-system curr-section-name sections) settings) curr-section-name var-flag (if lead lead whsp))) (loop (configf:read-line inp res (calc-allow-system allow-system curr-section-name sections) settings) curr-section-name #f #f)))) (else (debug:print-error 0 *default-log-port* "problem parsing " path ",\n \"" inl "\"") (set! var-flag #f) (loop (configf:read-line inp res (calc-allow-system allow-system curr-section-name sections) settings) curr-section-name #f #f)))) ) ;; end loop ))) ;; look at common:set-fields for an example of how to use the set-fields proc ;; pathenvvar will set the named var to the path of the config ;; (define (find-and-read-config fname #!key (environ-patt #f)(given-toppath #f)(pathenvvar #f)(set-fields #f)(keep-filenames #f)) (let* ((curr-dir (current-directory)) (configinfo (find-config fname toppath: given-toppath)) (toppath (car configinfo)) (configfile (cadr configinfo))) (if toppath (change-directory toppath)) (if (and toppath pathenvvar)(set-environment-variable! pathenvvar toppath)) (let ((configdat (if configfile (read-config configfile #f #t environ-patt: environ-patt post-section-procs: (if set-fields (list (cons "^fields$" set-fields) ) '()) #f keep-filenames: keep-filenames)))) (if toppath (change-directory curr-dir)) (list configdat toppath configfile fname)))) (define (lookup cfgdat section var) (if (hash-table? cfgdat) (let ((sectdat (hash-table-ref/default cfgdat section '()))) (if (null? sectdat) #f (let ((match (assoc var sectdat))) (if match ;; (and match (list? match)(> (length match) 1)) (cadr match) #f)) )) #f)) ;; use to have definitive setting: ;; [foo] ;; var yes ;; ;; (var-is? cfgdat "foo" "var" "yes") => #t ;; (define (var-is? cfgdat section var expected-val) (equal? (lookup cfgdat section var) expected-val)) ;; safely look up a value that is expected to be a number, return ;; a default (#f unless provided) ;; (define (lookup-number cfgdat section varname #!key (default #f)) (let* ((val (lookup cfgdat section varname)) (res (if val (string->number (string-substitute "\\s+" "" val #t)) #f))) (cond (res res) (val (debug:print 0 *default-log-port* "ERROR: no number found for [" section "], " varname ", got: " val)) (else default)))) (define (section-vars cfgdat section) (let ((sectdat (hash-table-ref/default cfgdat section '()))) (if (null? sectdat) '() (map car sectdat)))) (define (get-section cfgdat section) (hash-table-ref/default cfgdat section '())) (define (set-section-var cfgdat section var val) (let ((sectdat (get-section cfgdat section))) (hash-table-set! cfgdat section (assoc-safe-add sectdat var val)))) ;;(append (filter (lambda (x)(not (assoc var sectdat))) sectdat) ;; (list var val)))) ;; moved to common ;; (define (setup) ;; (let* ((configf (find-config "megatest.config")) ;; (config (if configf (read-config configf #f #t) #f))) ;; (if config ;; (setenv "RUN_AREA_HOME" (pathname-directory configf))) ;; config)) ;;====================================================================== ;; Non destructive writing of config file ;;====================================================================== (define (compress-multi-lines fdat) ;; step 1.5 - compress any continued lines (if (null? fdat) fdat (let loop ((hed (car fdat)) (tal (cdr fdat)) (cur "") (led #f) (res '())) ;; ALL WHITESPACE LEADING LINES ARE TACKED ON!! ;; 1. remove led whitespace ;; 2. tack on to hed with "\n" (let ((match (string-match configf:cont-ln-rx hed))) (if match ;; blast! have to deal with a multiline (let* ((lead (cadr match)) (lval (caddr match)) (newl (conc cur "\n" lval))) (if (not led)(set! led lead)) (if (null? tal) (set! fdat (append fdat (list newl))) (loop (car tal)(cdr tal) newl led res))) ;; NB// not tacking newl onto res (let ((newres (if led (append res (list cur hed)) (append res (list hed))))) ;; prev was a multiline (if (null? tal) newres (loop (car tal)(cdr tal) "" #f newres)))))))) ;; note: I'm cheating a little here. I merely replace "\n" with "\n " (define (expand-multi-lines fdat) ;; step 1.5 - compress any continued lines (if (null? fdat) fdat (let loop ((hed (car fdat)) (tal (cdr fdat)) (res '())) (let ((newres (append res (list (string-substitute (regexp "\n") "\n " hed #t))))) (if (null? tal) newres (loop (car tal)(cdr tal) newres)))))) (define (file->list fname) (if (safe-file-exists? fname) (let ((inp (open-input-file fname))) (let loop ((inl (read-line inp)) (res '())) (if (eof-object? inl) (begin (close-input-port inp) (reverse res)) (loop (read-line inp)(cons inl res))))) '())) ;; raw basic write config in ini format ;; (define (write-config cfgdat fname) (with-output-to-file fname (lambda () (config->ini cfgdat)))) ;; (for-each ;; (lambda (section) ;; (let ((sec-dat (hash-table-ref cfgdat section))) ;; (for-each (lambda (entry)(print (car entry) " " (cadr entry))) sec-dat))) ;; (sort (hash-table-keys cfgdat) (lambda (a b)(string<= a b))))))) ;;====================================================================== ;; Write a config ;; 0. Given a refererence data structure "indat" ;; 1. Open the output file and read it into a list ;; 2. Flatten any multiline entries ;; 3. Modify values per contents of "indat" and remove absent values ;; 4. Append new values to the section (immediately after last legit entry) ;; 5. Write out the new list ;;====================================================================== (define (write-merge-config indat fname #!key (required-sections '())) (let* (;; step 1: Open the output file and read it into a list (fdat (file->list fname)) (refdat (make-hash-table)) (sechash (make-hash-table)) ;; current section hash, init with hash for "default" section (new #f) ;; put the line to be used in new, if it is to be deleted the set new to #f (secname #f)) ;; step 2: Flatten multiline entries (if (not (null? fdat))(set! fdat (compress-multi-lines fdat))) ;; step 3: Modify values per contents of "indat" and remove absent values (if (not (null? fdat)) (let loop ((hed (car fdat)) (tal (cadr fdat)) (res '()) (lnum 0)) (regex-case hed (configf:comment-rx _ (set! res (append res (list hed)))) ;; (loop (read-line inp) curr-section-name #f #f)) (configf:blank-l-rx _ (set! res (append res (list hed)))) ;; (loop (read-line inp) curr-section-name #f #f)) (configf:section-rx ( x section-name ) (let ((section-hash (hash-table-ref/default refdat section-name #f))) (if (not section-hash) (let ((newhash (make-hash-table))) (hash-table-set! refdat section-name newhash) (set! sechash newhash)) (set! sechash section-hash)) (set! new hed) ;; will append this at the bottom of the loop (set! secname section-name) )) ;; No need to process key cmd, let it fall though to key val (configf:key-val-pr ( x key val ) (let ((newval (lookup indat secname key))) ;; secname was sec. I think that was a bug ;; can handle newval == #f here => that means key is removed (cond ((equal? newval val) (set! res (append res (list hed)))) ((not newval) ;; key has been removed (set! new #f)) ((not (equal? newval val)) (hash-table-set! sechash key newval) (set! new (conc key " " newval))) (else (debug:print-error 0 *default-log-port* "problem parsing line number " lnum "\"" hed "\""))))) (else (debug:print-error 0 *default-log-port* "Problem parsing line num " lnum " :\n " hed ))) (if (not (null? tal)) (loop (car tal)(cdr tal)(if new (append res (list new)) res)(+ lnum 1))) ;; drop to here when done processing, res contains modified list of lines (set! fdat res))) ;; step 4: Append new values to the section (for-each (lambda (section) (let ((sdat '()) ;; append needed bits here (svars (section-vars indat section))) (for-each (lambda (var) (let ((val (lookup refdat section var))) (if (not val) ;; this one is new (begin (if (null? sdat)(set! sdat (list (conc "[" section "]")))) (set! sdat (append sdat (list (conc var " " val)))))))) svars) (set! fdat (append fdat sdat)))) (delete-duplicates (append required-sections (hash-table-keys indat)))) ;; step 5: Write out new file (with-output-to-file fname (lambda () (for-each (lambda (line) (print line)) (expand-multi-lines fdat)))))) ;;====================================================================== ;; refdb ;;====================================================================== ;; reads a refdb into an assoc array of assoc arrays ;; returns (list dat msg) (define (read-refdb refdb-path) (let ((sheets-file (conc refdb-path "/sheet-names.cfg"))) (if (not (safe-file-exists? sheets-file)) (list #f (conc "ERROR: no refdb found at " refdb-path)) (if (not (file-readable? sheets-file)) (list #f (conc "ERROR: refdb file not readable at " refdb-path)) (let* ((sheets (with-input-from-file sheets-file (lambda () (let loop ((inl (read-line)) (res '())) (if (eof-object? inl) (reverse res) (loop (read-line)(cons inl res))))))) (data '())) (for-each (lambda (sheet-name) (let* ((dat-path (conc refdb-path "/" sheet-name ".dat")) (ref-dat (read-config dat-path #f #t)) (ref-assoc (map (lambda (key) (list key (hash-table-ref ref-dat key))) (hash-table-keys ref-dat)))) ;; (hash-table->alist ref-dat))) ;; (set! data (append data (list (list sheet-name ref-assoc)))))) (set! data (cons (list sheet-name ref-assoc) data)))) sheets) (list data "NO ERRORS")))))) ;; map over all pairs in a three level hierarchial alist and apply a function to the keys/val ;; (define (map-all-hier-alist data proc #!key (initproc1 #f)(initproc2 #f)(initproc3 #f)) (for-each (lambda (sheetname) (let* ((sheettmp (assoc sheetname data)) (sheetdat (if sheettmp (cadr sheettmp) '()))) (if initproc1 (initproc1 sheetname)) (for-each (lambda (sectionname) (let* ((sectiontmp (assoc sectionname sheetdat)) (sectiondat (if sectiontmp (cadr sectiontmp) '()))) (if initproc2 (initproc2 sheetname sectionname)) (for-each (lambda (varname) (let* ((valtmp (assoc varname sectiondat)) (val (if valtmp (cadr valtmp) ""))) (proc sheetname sectionname varname val))) (map car sectiondat)))) (map car sheetdat)))) (map car data)) data) ;;====================================================================== ;; C O N F I G T O / F R O M A L I S T ;;====================================================================== (define (config->alist cfgdat) (hash-table->alist cfgdat)) (define (alist->config adat) (let ((ht (make-hash-table))) (for-each (lambda (section) (hash-table-set! ht (car section)(cdr section))) adat) ht)) ;; if (define (read-alist fname) (handle-exceptions exn #f (alist->config (with-input-from-file fname read)))) (define (write-alist cdat fname #!key (locker #f)(unlocker #f)) (if (and locker (not (locker fname))) (debug:print 0 *default-log-port* "INFO: Could not get lock on " fname)) (let* ((dat (config->alist cdat)) (res (begin (with-output-to-file fname ;; first write out the file (lambda () (pp dat))) (if (file-exists? fname) ;; now verify it is readable (if (read-alist fname) #t ;; data is good. (begin (handle-exceptions exn #f (debug:print 0 *default-log-port* "WARNING: content " dat " for cache " fname " is not readable. Deleting generated file.") (delete-file fname)) #f)) #f)))) (if unlocker (unlocker fname)) res)) ;; convert config hash-table/list data to ini format ;; (define (config->ini data) (map (lambda (section) (let ((section-name (car section)) (section-dat (cdr section))) (print "\n[" section-name "]") (map (lambda (dat-pair) (let* ((var (car dat-pair)) (val (cadr dat-pair)) (fname (if (> (length dat-pair) 2)(caddr dat-pair) #f))) (if fname (print "# " var "=>" fname)) (print var " " val))) section-dat))) ;; (print "section-dat: " section-dat)) (hash-table->alist data))) ;(use trace) ;(trace-call-sites #t) ;(trace read-config) ) |
Added mtconfigf/mtconfigf.setup version [14a686d751].
> > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ;; Copyright 2007-2010, Matthew Welland. ;; ;; This program is made available under the GNU GPL version 2.0 or ;; greater. See the accompanying file COPYING for details. ;; ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. ;;;; mtconfig.setup ;; compile the code into dynamically loadable shared objects ;; and install as modules (compile -s mtconfigf.scm) (standard-extension 'mtconfigf "mtconfigf.so") |
Added mtconfigf/tests/run.scm version [f0fc4f2f77].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | (load "../mtdebug/mtdebug.scm") (import mtdebug) (load "mtconfigf.scm") (import (prefix mtconfigf config:)) (use mtdebug) ;; configure mtconfigf (let* ((normal-fn debug:print) (info-fn debug:print-info) (error-fn debug:print-error) (default-port (current-output-port))) (config:set-debug-printers normal-fn info-fn error-fn default-port)) (use test) (let* ((cfgdat (config:read-config "tests/test.config" #f #f))) (test #f "value" (config:lookup cfgdat "basic" "key")) (test #f 2 (config:lookup-number cfgdat "basic" "two")) ) (config:add-eval-string "(define (customfunc) \"hello\")") (let* ((cfgdat (config:read-config "tests/test2.config" #f #f))) (test #f "bar" (config:lookup cfgdat "schemy" "rgetreftarget")) (test #f "baz" (config:lookup cfgdat "schemy" "rgetrefdefault")) (test #f "2" (config:lookup cfgdat "schemy" "addup")) (test #f 2 (config:lookup-number cfgdat "schemy" "addup")) (test #f "hello" (config:lookup cfgdat "schemy" "custom")) ) (test #f (conc "hello " (get-environment-variable "USER")) (config:eval-string-in-environment "hello $USER")) (let* ((cfgdat (config:read-config "tests/test3.config" #f #t))) (test #f "hello" (config:lookup cfgdat "systemic" "hello")) (test #f (conc "hello " (get-environment-variable "USER")) (config:lookup cfgdat "systemic" "hellouser")) ) |
Added mtconfigf/tests/test.config version [3d5375a8d9].
> > > | 1 2 3 | [basic] key value two 2 |
Added mtconfigf/tests/test2.config version [18058f78ed].
> > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | [default] deffoo baz [a-target] foo bar [.dvars] target a-target [schemy] addup #{scheme (+ 1 1)} custom #{scheme (customfunc)} rgetreftarget #{rget foo} rgetrefdefault #{rget deffoo} |
Added mtconfigf/tests/test3.config version [3f1e49e30c].
> > > | 1 2 3 | [systemic] hello [system echo hello] hellouser [system echo hello $USER] |
Modified mtut.scm from [2855879998] to [3ab8528d8b].
︙ | ︙ | |||
28 29 30 31 32 33 34 35 36 37 38 39 40 41 | (prefix sqlite3 sqlite3:) nanomsg) (declare (uses common)) (declare (uses margs)) (declare (uses configf)) ;; (declare (uses rmt)) (use ducttape-lib) (include "megatest-fossil-hash.scm") (require-library stml) | > > > | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | (prefix sqlite3 sqlite3:) nanomsg) (declare (uses common)) (declare (uses margs)) (declare (uses configf)) ;; (declare (uses rmt)) (declare (uses commonmod)) (import commonmod) (use ducttape-lib) (include "megatest-fossil-hash.scm") (require-library stml) |
︙ | ︙ |
Modified newdashboard.scm from [3cc17ecae4] to [2d92665a75].
︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | (use sql-de-lite srfi-1 posix regex regex-case srfi-69 typed-records sparse-vectors ;; defstruct (prefix dbi dbi:)) (declare (uses common)) (declare (uses megatest-version)) (declare (uses margs)) ;; (declare (uses launch)) ;; (declare (uses gutils)) ;; (declare (uses db)) ;; (declare (uses server)) ;; (declare (uses synchash)) (declare (uses dcommon)) | > > > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | (use sql-de-lite srfi-1 posix regex regex-case srfi-69 typed-records sparse-vectors ;; defstruct (prefix dbi dbi:)) (declare (uses common)) (declare (uses megatest-version)) (declare (uses margs)) (declare (uses commonmod)) (import commonmod) ;; (declare (uses launch)) ;; (declare (uses gutils)) ;; (declare (uses db)) ;; (declare (uses server)) ;; (declare (uses synchash)) (declare (uses dcommon)) |
︙ | ︙ |
Modified ods.scm from [42e94b826f] to [1b93bc9256].
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ;; You should have received a copy of the GNU General Public License ;; along with Megatest. If not, see <http://www.gnu.org/licenses/>. ;; (use csv-xml regex) (declare (unit ods)) (declare (uses common)) (define ods:dirs '("Configurations2" "Configurations2/toolpanel" "Configurations2/menubar" "Configurations2/toolbar" "Configurations2/progressbar" | > > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ;; You should have received a copy of the GNU General Public License ;; along with Megatest. If not, see <http://www.gnu.org/licenses/>. ;; (use csv-xml regex) (declare (unit ods)) (declare (uses common)) (declare (uses commonmod)) (import commonmod) (define ods:dirs '("Configurations2" "Configurations2/toolpanel" "Configurations2/menubar" "Configurations2/toolbar" "Configurations2/progressbar" |
︙ | ︙ |
Modified portlogger.scm from [36a4964f50] to [51459afd2c].
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 | (require-extension (srfi 18) extras tcp s11n) (use sqlite3 srfi-1 posix srfi-69 hostinfo dot-locking z3) (import (prefix sqlite3 sqlite3:)) (declare (unit portlogger)) (declare (uses db)) ;; lsof -i (define (portlogger:open-db fname) (let* ((avail (tasks:wait-on-journal fname 5 remove: #t)) ;; wait up to about 10 seconds for the journal to go away (exists (common:file-exists? fname)) (db (if avail | > > > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | (require-extension (srfi 18) extras tcp s11n) (use sqlite3 srfi-1 posix srfi-69 hostinfo dot-locking z3) (import (prefix sqlite3 sqlite3:)) (declare (unit portlogger)) (declare (uses db)) (declare (uses commonmod)) (import commonmod) ;; lsof -i (define (portlogger:open-db fname) (let* ((avail (tasks:wait-on-journal fname 5 remove: #t)) ;; wait up to about 10 seconds for the journal to go away (exists (common:file-exists? fname)) (db (if avail |
︙ | ︙ |
Modified process.scm from [f9dfbe5500] to [ebe55b45e0].
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ;;====================================================================== ;; Process convience utils ;;====================================================================== (use regex directory-utils) (declare (unit process)) (define (process:conservative-read port) (let loop ((res "")) (if (not (eof-object? (peek-char port))) (loop (conc res (read-char port))) res))) | > > > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ;;====================================================================== ;; Process convience utils ;;====================================================================== (use regex directory-utils) (declare (unit process)) (declare (uses commonmod)) (import commonmod) (define (process:conservative-read port) (let loop ((res "")) (if (not (eof-object? (peek-char port))) (loop (conc res (read-char port))) res))) |
︙ | ︙ |
Modified rmt.scm from [bcbb74efcc] to [5db24030e8].
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ;;====================================================================== (use format typed-records) ;; RADT => purpose of json format?? (declare (unit rmt)) (declare (uses api)) (declare (uses http-transport)) (include "common_records.scm") ;; (declare (uses rmtmod)) ;; (import rmtmod) ;; ;; THESE ARE ALL CALLED ON THE CLIENT SIDE!!! | > > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ;;====================================================================== (use format typed-records) ;; RADT => purpose of json format?? (declare (unit rmt)) (declare (uses api)) (declare (uses http-transport)) (declare (uses commonmod)) (import commonmod) (include "common_records.scm") ;; (declare (uses rmtmod)) ;; (import rmtmod) ;; ;; THESE ARE ALL CALLED ON THE CLIENT SIDE!!! |
︙ | ︙ |
Modified rmtmod.scm from [6b720dfd33] to [2c6cae7b17].
︙ | ︙ | |||
18 19 20 21 22 23 24 | ;;====================================================================== (declare (unit rmtmod)) (declare (uses commonmod)) (declare (uses apimod)) ;; (declare (uses apimod.import)) | | | | 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 | ;;====================================================================== (declare (unit rmtmod)) (declare (uses commonmod)) (declare (uses apimod)) ;; (declare (uses apimod.import)) ;; (declare (uses ulex)) ;; (include "ulex/ulex.scm") (module rmtmod * (import scheme chicken data-structures extras) (import (prefix sqlite3 sqlite3:) posix typed-records srfi-18) (import (prefix commonmod cmod:)) (import apimod) ;; (import (prefix ulex ulex:)) (defstruct alldat (areapath #f) (ulexdat #f) ) ;; return the handle struct for sending queries to a specific database |
︙ | ︙ |
Modified runconfig.scm from [66b9c38588] to [5fc8095c21].
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ;; to this run field1val/field2val/field3val ... ;;====================================================================== (use format directory-utils) (declare (unit runconfig)) (declare (uses common)) (include "common_records.scm") (define (runconfig:read fname target environ-patt) (let ((ht (make-hash-table))) (if target (hash-table-set! ht target '())) (read-config fname ht #t environ-patt: environ-patt sections: (if target (list "default" target) #f)))) | > > > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ;; to this run field1val/field2val/field3val ... ;;====================================================================== (use format directory-utils) (declare (unit runconfig)) (declare (uses common)) (declare (uses commonmod)) (import commonmod) (include "common_records.scm") (define (runconfig:read fname target environ-patt) (let ((ht (make-hash-table))) (if target (hash-table-set! ht target '())) (read-config fname ht #t environ-patt: environ-patt sections: (if target (list "default" target) #f)))) |
︙ | ︙ |
Modified runs.scm from [14564e4b78] to [359b1f9864].
︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | (declare (uses items)) (declare (uses runconfig)) (declare (uses tests)) (declare (uses server)) (declare (uses mt)) (declare (uses archive)) ;; (declare (uses filedb)) (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") (include "run_records.scm") (include "test_records.scm") | > > > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | (declare (uses items)) (declare (uses runconfig)) (declare (uses tests)) (declare (uses server)) (declare (uses mt)) (declare (uses archive)) ;; (declare (uses filedb)) (declare (uses commonmod)) (import commonmod) (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") (include "run_records.scm") (include "test_records.scm") |
︙ | ︙ |
Modified server.scm from [136e39e7ec] to [0ee16c0c31].
︙ | ︙ | |||
29 30 31 32 33 34 35 36 37 38 39 40 41 42 | (declare (uses db)) (declare (uses tasks)) ;; tasks are where stuff is maintained about what is running. ;; (declare (uses synchash)) (declare (uses http-transport)) ;;(declare (uses rpc-transport)) (declare (uses launch)) ;; (declare (uses daemon)) (include "common_records.scm") (include "db_records.scm") (define (server:make-server-url hostport) (if (not hostport) #f | > > > | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | (declare (uses db)) (declare (uses tasks)) ;; tasks are where stuff is maintained about what is running. ;; (declare (uses synchash)) (declare (uses http-transport)) ;;(declare (uses rpc-transport)) (declare (uses launch)) ;; (declare (uses daemon)) (declare (uses commonmod)) (import commonmod) (include "common_records.scm") (include "db_records.scm") (define (server:make-server-url hostport) (if (not hostport) #f |
︙ | ︙ |
Added servermod.scm version [2e7b887d59].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | ;;====================================================================== ;; Copyright 2017, 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 servermod)) (module servermod * (import scheme chicken data-structures extras) (import (prefix sqlite3 sqlite3:) posix typed-records srfi-18) (define (just-testing) (print "JUST TESTING")) ;; (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)) ) |
Modified subrun.scm from [bd1952a98c] to [bb2ab40abf].
︙ | ︙ | |||
29 30 31 32 33 34 35 | ;;(declare (uses runconfig)) ;;(declare (uses tests)) ;;(declare (uses server)) (declare (uses mt)) ;;(declare (uses archive)) ;; (declare (uses filedb)) | > > > | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | ;;(declare (uses runconfig)) ;;(declare (uses tests)) ;;(declare (uses server)) (declare (uses mt)) ;;(declare (uses archive)) ;; (declare (uses filedb)) (declare (uses commonmod)) (import commonmod) ;;(include "common_records.scm") ;;(include "key_records.scm") (include "db_records.scm") ;; provides db:test-get-id ;;(include "run_records.scm") ;;(include "test_records.scm") (define (subrun:subrun-test-initialized? test-run-dir) (if (and (common:file-exists? (conc test-run-dir "/subrun-area") ) |
︙ | ︙ |
Modified tasks.scm from [a73c5b318e] to [e69a6ec8c1].
︙ | ︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 | (declare (unit tasks)) (declare (uses db)) (declare (uses rmt)) (declare (uses common)) (declare (uses pgdb)) ;; (import pgdb) ;; pgdb is a module (include "task_records.scm") (include "db_records.scm") ;;====================================================================== ;; Tasks db ;;====================================================================== | > > > | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | (declare (unit tasks)) (declare (uses db)) (declare (uses rmt)) (declare (uses common)) (declare (uses pgdb)) ;; (import pgdb) ;; pgdb is a module (declare (uses commonmod)) (import commonmod) (include "task_records.scm") (include "db_records.scm") ;;====================================================================== ;; Tasks db ;;====================================================================== |
︙ | ︙ |
Modified tcmt.scm from [6658a745e5] to [d89fbc3238].
︙ | ︙ | |||
28 29 30 31 32 33 34 35 36 37 38 39 40 41 | (use trace) ;; (trace-call-sites #t) (declare (uses margs)) (declare (uses rmt)) (declare (uses common)) ;; (declare (uses megatest-version)) (include "megatest-version.scm") (include "megatest-fossil-hash.scm") (include "db_records.scm") (define origargs (cdr (argv))) (define remargs (args:get-args | > > > | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | (use trace) ;; (trace-call-sites #t) (declare (uses margs)) (declare (uses rmt)) (declare (uses common)) ;; (declare (uses megatest-version)) (declare (uses commonmod)) (import commonmod) (include "megatest-version.scm") (include "megatest-fossil-hash.scm") (include "db_records.scm") (define origargs (cdr (argv))) (define remargs (args:get-args |
︙ | ︙ |
Modified tdb.scm from [6edff6262d] to [a6ed93f3eb].
︙ | ︙ | |||
30 31 32 33 34 35 36 37 38 39 40 41 42 43 | (declare (unit tdb)) (declare (uses common)) (declare (uses keys)) (declare (uses ods)) (declare (uses client)) (declare (uses mt)) (declare (uses db)) (include "common_records.scm") (include "db_records.scm") (include "key_records.scm") (include "run_records.scm") ;;====================================================================== | > > > | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | (declare (unit tdb)) (declare (uses common)) (declare (uses keys)) (declare (uses ods)) (declare (uses client)) (declare (uses mt)) (declare (uses db)) (declare (uses commonmod)) (import commonmod) (include "common_records.scm") (include "db_records.scm") (include "key_records.scm") (include "run_records.scm") ;;====================================================================== |
︙ | ︙ |
Modified tests.scm from [0094b671e6] to [29e8e4ef66].
︙ | ︙ | |||
33 34 35 36 37 38 39 40 41 42 43 44 45 46 | ;; (declare (uses sdb)) (declare (uses server)) ;;(declare (uses stml2)) (use sqlite3 srfi-1 posix regex regex-case srfi-69 dot-locking tcp directory-utils) (import (prefix sqlite3 sqlite3:)) (require-library stml) (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") (include "run_records.scm") (include "test_records.scm") (include "js-path.scm") | > > > | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | ;; (declare (uses sdb)) (declare (uses server)) ;;(declare (uses stml2)) (use sqlite3 srfi-1 posix regex regex-case srfi-69 dot-locking tcp directory-utils) (import (prefix sqlite3 sqlite3:)) (require-library stml) (declare (uses commonmod)) (import commonmod) (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") (include "run_records.scm") (include "test_records.scm") (include "js-path.scm") |
︙ | ︙ |
Modified tree.scm from [5b84d6f782] to [fb1fa4db79].
︙ | ︙ | |||
31 32 33 34 35 36 37 38 39 40 41 42 43 44 | (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") ;;====================================================================== | > > > > | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | (declare (uses launch)) ;; (declare (uses megatest-version)) (declare (uses gutils)) (declare (uses db)) (declare (uses server)) ;; (declare (uses synchash)) (declare (uses dcommon)) (declare (uses commonmod)) (import commonmod) (include "megatest-version.scm") (include "common_records.scm") (include "db_records.scm") (include "key_records.scm") ;;====================================================================== |
︙ | ︙ |