Changes In Branch v1.65-wip-fork Excluding Merge-Ins
This is equivalent to a diff from 9b6c3193e6 to 3dee8c9dd3
2019-10-04
| ||
10:22 | Fork in wip. Leaf check-in: 3dee8c9dd3 user: mrwellan tags: v1.65-wip-fork | |
00:50 | Closer - and further away than ever. check-in: f6d852ea54 user: matt tags: v1.65-wip | |
2019-10-03
| ||
00:02 | Removed some of the member:print debug stuff check-in: 9b6c3193e6 user: matt tags: v1.65-wip | |
2019-10-02
| ||
23:41 | Added funky debug stuff check-in: 99551309fa user: matt tags: v1.65-wip | |
Modified common.scm from [91c6910f87] to [b059fdcd91].
︙ | ︙ | |||
268 269 270 271 272 273 274 | ((abort) "ABORT") ((skip) "SKIP") (else "FAIL"))) (define (common:logpro-exit-code->test-status exit-code) (status-sym->string (common:logpro-exit-code->status-sym exit-code))) | < < < < < < < < < < < < < | 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | ((abort) "ABORT") ((skip) "SKIP") (else "FAIL"))) (define (common:logpro-exit-code->test-status exit-code) (status-sym->string (common:logpro-exit-code->status-sym exit-code))) ;; launching and hosts (defstruct host (reachable #f) (last-update 0) (last-used 0) (last-cpuload 1)) |
︙ | ︙ |
Modified common_records.scm from [72d272b34e] to [9a2860f58f].
︙ | ︙ | |||
48 49 50 51 52 53 54 55 56 57 58 59 60 61 | (begin body ...) (handle-exceptions exn errstmt body ...))))) (define-syntax common:handle-exceptions (syntax-rules () ((_ exn errstmt body ...) (begin body ...)))) ;; (define handle-exceptions common:handle-exceptions) ;; iup callbacks are not dumping the stack, this is a work-around ;; (define-simple-syntax (debug:catch-and-dump proc procname) (handle-exceptions | > > > > > > > > > > > > > > > > > | 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 | (begin body ...) (handle-exceptions exn errstmt body ...))))) (define-syntax common:handle-exceptions (syntax-rules () ((_ exn errstmt body ...) (begin body ...)))) ;;====================================================================== ;; records that are accessed or shared widely ;;====================================================================== (defstruct remote (hh-dat (common:get-homehost)) ;; homehost record ( addr . hhflag ) (server-url (if *toppath* (server:check-if-running *toppath*))) ;; (server:check-if-running *toppath*) #f)) (last-server-check 0) ;; last time we checked to see if the server was alive (conndat #f) (transport *transport-type*) (server-timeout (server:expiration-timeout)) (force-server #f) (ro-mode #f) (ro-mode-checked #f) ;; flag that indicates we have checked for ro-mode (ulex:conn #f) ;; ulex db conn is not exactly a db connector, more like a network connector ) ;; (define handle-exceptions common:handle-exceptions) ;; iup callbacks are not dumping the stack, this is a work-around ;; (define-simple-syntax (debug:catch-and-dump proc procname) (handle-exceptions |
︙ | ︙ | |||
73 74 75 76 77 78 79 80 81 82 83 84 85 86 | ;; or use (define-simple-syntax ?? ;; (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) | > > > > > > | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | ;; or use (define-simple-syntax ?? ;; (define-inline (with-mutex mtx accessor record . val) (mutex-lock! mtx) (let ((res (apply accessor record val))) (mutex-unlock! mtx) res)) ;;====================================================================== ;; debug print stuff ;;====================================================================== (define *verbosity* 1) ;; 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) |
︙ | ︙ | |||
119 120 121 122 123 124 125 | ((and (list? *verbosity*) ;; list list (list? n)) (not (null? (lset-intersection! eq? *verbosity* n)))) ((and (number? *verbosity*) (list? n)) (member *verbosity* n)))) | < | | > | | | | | | | | | | | | | > > > | | | | | | | | | | | | | > | | | | | | 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 | ((and (list? *verbosity*) ;; list list (list? n)) (not (null? (lset-intersection! eq? *verbosity* n)))) ((and (number? *verbosity*) (list? n)) (member *verbosity* n)))) ;; (or (args:get-arg "-debug") ;; (getenv "MT_DEBUG_MODE"))) (define (debug:setup debugstr) (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 (or debugstr (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) )))) ;; Brandon's debug printer shortcut (indulge me :) ;; Matt's note: This is good stuff - let's look at integrating it into the debug:print* routines ;; - for now I'm commenting out while trying to refactor. ;; #;(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 megatest.scm from [86d6f690da] to [eed44e505f].
︙ | ︙ | |||
606 607 608 609 610 611 612 | (exit 1)))) homehost-required)))) ;;====================================================================== ;; Misc setup stuff ;;====================================================================== | | > | 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | (exit 1)))) homehost-required)))) ;;====================================================================== ;; Misc setup stuff ;;====================================================================== (debug:setup (or (args:get-arg "-debug") (getenv "MT_DEBUG_MODE"))) (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") |
︙ | ︙ |
Modified rmtmod.scm from [34866aceda] to [dae017bb2e].
︙ | ︙ | |||
21 22 23 24 25 26 27 | (declare (unit rmtmod)) (declare (uses commonmod)) (module rmtmod * (import scheme chicken data-structures extras) | | | > > | < < < < < < < | < < < < < < < < | 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 | (declare (unit rmtmod)) (declare (uses commonmod)) (module rmtmod * (import scheme chicken data-structures extras) (import (prefix sqlite3 sqlite3:) posix typed-records srfi-18 srfi-1 srfi-69 format) (import commonmod ports) (use (prefix ulex ulex:)) (include "common_records.scm") ;; Hack to make these functions visible to the refactored code, goal is to eliminate these over time. (define (rmt:send-receive . params) #f) (define (http-transport:close-connections . params) #f) ;; from remote defstruct in common.scm (define (remote-conndat-set! . params) #f) (define (db:dbfile-path . params) #f) (define (db:setup . params) #f) (define (api:execute-requests . params) #f) (define (set-functions send-receive rsus close-connections rcs dbgp dbgpinfo dbgperr ro-mode ro-mode-set ro-mode-checked-set ro-mode-checked dbfile-path dbsetup exec-req read-only-queries ) (set! rmt:send-receive send-receive) (set! remote-server-url-set! rsus) (set! http-transport:close-connections close-connections) (set! remote-conndat-set! rcs) ;; db stuff for local db access (set! db:dbfile-path dbfile-path) (set! db:setup dbsetup) (set! apt:execute-requests exec-req) ) (define (rmt:open-qry-close-locally log-port multi-sync-mutex cmd run-id params #!key (ro-queries '())(remretries 5)) |
︙ | ︙ |