Index: common.scm ================================================================== --- common.scm +++ common.scm @@ -81,17 +81,17 @@ (define (any->number-if-possible val) (let ((num (any->number val))) (if num num val))) (define (patt-list-match item patts) - (debug:print 8 "INFO: patt-list-match item=" item " patts=" patts) + (debug:print-info 8 "patt-list-match item=" item " patts=" patts) (if (and item patts) ;; here we are filtering for matches with -itempatt (let ((res #f)) ;; look through all the item-patts if defined, format is patt1,patt2,patt3 ... wildcard is % (for-each (lambda (patt) (let ((modpatt (string-substitute "%" ".*" patt #t))) - (debug:print 10 "INFO: patt " patt " modpatt " modpatt) + (debug:print-info 10 "patt " patt " modpatt " modpatt) (if (string-match (regexp modpatt) item) (set! res #t)))) (string-split patts ",")) res) #t)) Index: common_records.scm ================================================================== --- common_records.scm +++ common_records.scm @@ -7,16 +7,49 @@ ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. ;;====================================================================== +(use format) + +(define (debug:calc-verbosity vstr) + (cond + (vstr + (let ((debugvals (string-split vstr ","))) + (if (> (length debugvals) 1) + (map string->number debugvals) + (string->number (car debugvals))))) + ((args:get-arg "-v") 2) + ((args:get-arg "-q") 0) + (else 1))) + +;; 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-inline (debug:debug-mode n) + (or (and (number? *verbosity*) + (<= n *verbosity*)) + (and (list? *verbosity*) + (member n *verbosity*)))) + (define-inline (debug:print n . params) - (begin - (if (<= n *verbosity*) - (apply print params)) - (if *logging* - (apply db:log-event params)))) + (if (debug:debug-mode n) + (begin + (apply print params) + (if *logging* (apply db:log-event params))))) + +(define-inline (debug:print-info n . params) + (if (debug:debug-mode n) + (let ((res (format#format #f "INFO:~2d ~a" n (apply conc params)))) + (print res) + (if *logging* (db:log-event 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 "")) Index: configf.scm ================================================================== --- configf.scm +++ configf.scm @@ -99,11 +99,11 @@ (status (cadr output))) (if (equal? status 0) (let ((outres (string-intersperse res "\n"))) - (debug:print 4 "INFO: shell result:\n" outres) + (debug:print-info 4 "shell result:\n" outres) outres) (begin (with-output-to-port (current-error-port) (print "ERROR: " cmd " returned bad exit code " status)) "")))) @@ -124,22 +124,22 @@ ;; adds to ht if given (must be #f otherwise) ;; 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 (define (read-config path ht allow-system #!key (environ-patt #f)(curr-section #f)(sections #f)) - (debug:print 4 "INFO: read-config " path " allow-system " allow-system " environ-patt " environ-patt " curr-section: " curr-section " sections: " sections) + (debug:print-info 4 "read-config " path " allow-system " allow-system " environ-patt " environ-patt " curr-section: " curr-section " sections: " sections) (if (not (file-exists? path)) (begin - (debug:print 4 "INFO: read-config - file not found " path " current path: " (current-directory)) + (debug:print-info 4 "read-config - file not found " path " current path: " (current-directory)) (if (not ht)(make-hash-table) ht)) (let ((inp (open-input-file path)) (res (if (not ht)(make-hash-table) ht))) (let loop ((inl (configf:read-line inp res)) ;; (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 8 "INFO: curr-section-name: " curr-section-name " var-flag: " var-flag "\n inl: \"" inl "\"") + (debug:print-info 8 "curr-section-name: " curr-section-name " var-flag: " var-flag "\n inl: \"" inl "\"") (if (eof-object? inl) (begin (close-input-port inp) (hash-table-delete! res "") ;; we are using "" as a dumping ground and must remove it before returning the ht res) @@ -163,11 +163,11 @@ (let ((alist (hash-table-ref/default res curr-section-name '())) (val-proc (lambda () (let* ((cmdres (cmd-run->list cmd)) (status (cadr cmdres)) (res (car cmdres))) - (debug:print 4 "INFO: " inl "\n => " (string-intersperse res "\n")) + (debug:print-info 4 "" inl "\n => " (string-intersperse res "\n")) (if (not (eq? status 0)) (begin (debug:print 0 "ERROR: problem with " inl ", return code " status " output: " cmdres) (exit 1))) @@ -186,14 +186,14 @@ (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))) (realval (if envar (config:eval-string-in-environment val) val))) - (debug:print 6 "INFO: read-config env setting, envar: " envar " realval: " realval " val: " val " key: " key " curr-section-name: " curr-section-name) + (debug:print-info 6 "read-config env setting, envar: " envar " realval: " realval " val: " val " key: " key " curr-section-name: " curr-section-name) (if envar (begin - ;; (debug:print 4 "INFO: read-config key=" key ", val=" val ", realval=" realval) + ;; (debug:print-info 4 "read-config key=" key ", val=" val ", realval=" realval) (setenv key realval))) (hash-table-set! res curr-section-name (config:assoc-safe-add alist key realval)) (loop (configf:read-line inp res) curr-section-name key #f))) ;; if a continued line Index: dashboard.scm ================================================================== --- dashboard.scm +++ dashboard.scm @@ -114,20 +114,12 @@ (define *db-file-path* (conc *toppath* "/megatest.db")) (define *tests-sort-reverse* #f) (define *hide-empty-runs* #f) -(define *verbosity* (cond - ((string? (args:get-arg "-debug"))(string->number (args:get-arg "-debug"))) - ((args:get-arg "-v") 2) - ((args:get-arg "-q") 0) - (else 1))) - -(if (not (number? *verbosity*)) - (begin - (print "ERROR: Invalid debug value " (args:get-arg "-debug")) - (exit))) +(set! *verbosity* (debug:calc-verbosity (args:get-arg "-debug"))) +(debug:check-verbosity *verbosity* (args:get-arg "-debug")) (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)) @@ -167,11 +159,11 @@ (let ((modtime (file-modification-time *db-file-path*))) (if (or (and (> modtime *last-db-update-time*) (> (current-seconds)(+ *last-db-update-time* 5))) (> *delayed-update* 0)) (begin - (debug:print 4 "INFO: update-rundat runnamepatt: " runnamepatt " numruns: " numruns " testnamepatt: " testnamepatt " keypatts: " keypatts) + (debug:print-info 4 "update-rundat runnamepatt: " runnamepatt " numruns: " numruns " testnamepatt: " testnamepatt " keypatts: " keypatts) (set! *please-update-buttons* #t) (set! *last-db-update-time* modtime) (set! *delayed-update* (- *delayed-update* 1)) (let* ((allruns (open-run-close db:get-runs *db* runnamepatt numruns ;; (+ numruns 1) ;; (/ numruns 2)) *start-run-offset* keypatts)) Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -49,21 +49,21 @@ (else (debug:print 0 "ERROR: synchronous must be 0,1,2,OFF,NORMAL or FULL, you provided: " syncval) #f)))) (if val (begin - (debug:print 4 "INFO: Setting pragma synchronous to " val) + (debug:print-info 4 "Setting pragma synchronous to " val) (sqlite3:execute db (conc "PRAGMA synchronous = '" val "';")))))) (define (open-db) ;; (conc *toppath* "/megatest.db") (car *configinfo*))) (let* ((dbpath (conc *toppath* "/megatest.db")) ;; fname) (dbexists (file-exists? dbpath)) (db (sqlite3:open-database dbpath)) ;; (never-give-up-open-db dbpath)) (handler (make-busy-timeout (if (args:get-arg "-override-timeout") (string->number (args:get-arg "-override-timeout")) 136000)))) ;; 136000))) ;; 136000 = 2.2 minutes - (debug:print 4 "INFO: dbpath=" dbpath) + (debug:print-info 4 "dbpath=" dbpath) (sqlite3:set-busy-handler! db handler) (if (not dbexists) (db:initialize db)) (db:set-sync db) db)) @@ -111,11 +111,11 @@ (set! *global-delta* (/ (+ *global-delta* (* (- (current-milliseconds) start-ms) (if throttle throttle 0.01))) 2)) (if (> (abs (- *last-global-delta-printed* *global-delta*)) 0.08) ;; don't print all the time, only if it changes a bit (begin - (debug:print 1 "INFO: launch throttle factor=" *global-delta*) + (debug:print-info 1 "launch throttle factor=" *global-delta*) (set! *last-global-delta-printed* *global-delta*))) res)) (define (db:initialize db) (let* ((configdat (car *configinfo*)) ;; tut tut, global warning... @@ -232,11 +232,11 @@ (dbexists (file-exists? dbpath)) (db (sqlite3:open-database dbpath)) ;; (never-give-up-open-db dbpath)) (handler (make-busy-timeout (if (args:get-arg "-override-timeout") (string->number (args:get-arg "-override-timeout")) 36000)))) - (debug:print 4 "INFO: test dbpath=" dbpath) + (debug:print-info 4 "test dbpath=" dbpath) (sqlite3:set-busy-handler! db handler) (if (not dbexists) (begin (sqlite3:execute db "PRAGMA synchronous = FULL;") (debug:print 0 "Initialized test database " dbpath) @@ -427,11 +427,11 @@ (set! *global-delta* (/ (+ *global-delta* (* (- (current-milliseconds) start-ms) (if throttle throttle 0.01))) 2)) (if (> (abs (- *last-global-delta-printed* *global-delta*)) 0.08) ;; don't print all the time, only if it changes a bit (begin - (debug:print 4 "INFO: launch throttle factor=" *global-delta*) + (debug:print-info 4 "launch throttle factor=" *global-delta*) (set! *last-global-delta-printed* *global-delta*))) res)) (define (db:set-var db var val) (sqlite3:execute db "INSERT OR REPLACE INTO metadat (var,val) VALUES (?,?);" var val)) @@ -449,11 +449,11 @@ "SELECT fieldname,fieldtype FROM keys ORDER BY id DESC;") (set! *db-keys* res) res))) (define (db:get-value-by-header row header field) - (debug:print 4 "INFO: db:get-value-by-header row: " row " header: " header " field: " field) + (debug:print-info 4 "db:get-value-by-header row: " row " header: " header " field: " field) (if (null? header) #f (let loop ((hed (car header)) (tal (cdr header)) (n 0)) (if (equal? hed field) @@ -514,11 +514,11 @@ (conc " LIMIT " count) "") (if (number? offset) (conc " OFFSET " offset) "")))) - (debug:print 8 "INFO: db:get-runs qrystr: " qrystr "\nkeypatts: " keypatts "\n offset: " offset " limit: " count) + (debug:print-info 8 "db:get-runs qrystr: " qrystr "\nkeypatts: " keypatts "\n offset: " offset " limit: " count) (sqlite3:for-each-row (lambda (a . x) (set! res (cons (apply vector a x) res))) db qrystr @@ -573,11 +573,11 @@ "unlocked" "locked")))) ;; semi-failsafe (sqlite3:execute db "UPDATE runs SET state=? WHERE id=?;" newlockval run-id) (sqlite3:execute db "INSERT INTO access_log (user,accessed,args) VALUES(?,strftime('%s','now'),?);" user (conc newlockval " " run-id)) - (debug:print 1 "INFO: " newlockval " run number " run-id))) + (debug:print-info 1 "" newlockval " run number " run-id))) ;;====================================================================== ;; K E Y S ;;====================================================================== @@ -632,11 +632,11 @@ ;;====================================================================== ;; T E S T S ;;====================================================================== (define (db:tests-register-test db run-id test-name item-path) - (debug:print 4 "INFO: db:tests-register-test db=" db ", run-id=" run-id ", test-name=" test-name ", item-path=\"" item-path "\"") + (debug:print-info 4 "db:tests-register-test db=" db ", run-id=" run-id ", test-name=" test-name ", item-path=\"" item-path "\"") (let ((item-paths (if (equal? item-path "") (list item-path) (list item-path "")))) (for-each (lambda (pth) @@ -681,11 +681,11 @@ (case sort-by ((rundir) " ORDER BY length(rundir) DESC;") ((event_time) " ORDER BY event_time ASC;") (else ";")) ))) - (debug:print 8 "INFO: db:get-tests-for-run qry=" qry) + (debug:print-info 8 "db:get-tests-for-run qry=" qry) (sqlite3:for-each-row (lambda (a . b) ;; id run-id testname state status event-time host cpuload diskfree uname rundir item-path run-duration final-logf comment) (set! res (cons (apply vector a b) res))) ;; id run-id testname state status event-time host cpuload diskfree uname rundir item-path run-duration final-logf comment) res))) db qry @@ -870,14 +870,14 @@ (if (and last-delete (> last-delete *last-test-cache-delete*)) (begin (set! *test-info* (make-hash-table)) (set! *test-id-cache* (make-hash-table)) (set! *last-test-cache-delete* last-delete) - (debug:print 4 "INFO: Clearing test data cache")))) + (debug:print-info 4 "Clearing test data cache")))) (if (not test-id) (begin - (debug:print 4 "INFO: db:get-test-info-by-id called with test-id=" test-id) + (debug:print-info 4 "db:get-test-info-by-id called with test-id=" test-id) #f) (let* ((res (hash-table-ref/default *test-info* test-id #f))) (if (and res (member (db:test-get-state res) '("RUNNING" "COMPLETED"))) (db:patch-tdb-data-into-test-info db test-id res) @@ -895,11 +895,11 @@ ;; Get test data using test_id (define (db:get-test-info-not-cached-by-id db test-id) (if (not test-id) (begin - (debug:print 4 "INFO: db:get-test-info-by-id called with test-id=" test-id) + (debug:print-info 4 "db:get-test-info-by-id called with test-id=" test-id) #f) (let ((res #f)) (sqlite3:for-each-row (lambda (id run-id testname state status event-time host cpuload diskfree uname rundir item-path run_duration final_logf comment) ;; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 @@ -997,11 +997,11 @@ (if (not (null? res)) (car res) ;; return first found (if path (let* ((db (open-db path: (cadr pathdat))) (newres (db:test-get-paths-matching db keynames target fname))) - (debug:print 4 "INFO: Trying " (car pathdat) " at " (cadr pathdat)) + (debug:print-info 4 "Trying " (car pathdat) " at " (cadr pathdat)) (sqlite3:finalize! db) (if (not (null? newres)) (car newres) (if (null? tal) #f @@ -1061,18 +1061,18 @@ ;;====================================================================== ;; QUEUE UP META, TEST STATUS AND STEPS ;;====================================================================== (define (db:updater) - (debug:print 4 "INFO: Starting cache processing") + (debug:print-info 4 "Starting cache processing") (let loop ((start-time (current-time))) (thread-sleep! 10) ;; move save time around to minimize regular collisions? (db:write-cached-data) (loop start-time))) (define (cdb:test-set-status-state test-id status state msg) - (debug:print 4 "INFO: cdb:test-set-status-state test-id=" test-id ", status=" status ", state=" state ", msg=" msg) + (debug:print-info 4 "cdb:test-set-status-state test-id=" test-id ", status=" status ", state=" state ", msg=" msg) (mutex-lock! *incoming-mutex*) (set! *last-db-access* (current-seconds)) (if msg (set! *incoming-data* (cons (vector 'state-status-msg (current-milliseconds) @@ -1082,53 +1082,53 @@ (current-milliseconds) (list state status test-id)) ;; run-id test-name item-path minutes cpuload diskfree tmpfree) *incoming-data*))) (mutex-unlock! *incoming-mutex*) (if *cache-on* - (debug:print 6 "INFO: *cache-on* is " *cache-on* ", skipping cache write") + (debug:print-info 6 "*cache-on* is " *cache-on* ", skipping cache write") (db:write-cached-data))) (define (cdb:test-rollup-test_data-pass-fail test-id) - (debug:print 4 "INFO: Adding " test-id " for test_data rollup to the queue") + (debug:print-info 4 "Adding " test-id " for test_data rollup to the queue") (mutex-lock! *incoming-mutex*) (set! *last-db-access* (current-seconds)) (set! *incoming-data* (cons (vector 'test_data-pf-rollup (current-milliseconds) (list test-id test-id test-id test-id)) *incoming-data*)) (mutex-unlock! *incoming-mutex*) (if *cache-on* - (debug:print 6 "INFO: *cache-on* is " *cache-on* ", skipping cache write") + (debug:print-info 6 "*cache-on* is " *cache-on* ", skipping cache write") (db:write-cached-data))) (define (cdb:pass-fail-counts test-id fail-count pass-count) - (debug:print 4 "INFO: Adding " test-id " for setting pass/fail counts to the queue") + (debug:print-info 4 "Adding " test-id " for setting pass/fail counts to the queue") (mutex-lock! *incoming-mutex*) (set! *last-db-access* (current-seconds)) (set! *incoming-data* (cons (vector 'pass-fail-counts (current-milliseconds) (list fail-count pass-count test-id)) *incoming-data*)) (mutex-unlock! *incoming-mutex*) (if *cache-on* - (debug:print 6 "INFO: *cache-on* is " *cache-on* ", skipping cache write") + (debug:print-info 6 "*cache-on* is " *cache-on* ", skipping cache write") (db:write-cached-data))) (define (cdb:tests-register-test db run-id test-name item-path #!key (force-write #f)) (let ((item-paths (if (equal? item-path "") (list item-path) (list item-path "")))) - (debug:print 4 "INFO: Adding " run-id ", " test-name "/" item-path " for setting pass/fail counts to the queue") + (debug:print-info 4 "Adding " run-id ", " test-name "/" item-path " for setting pass/fail counts to the queue") (mutex-lock! *incoming-mutex*) (set! *last-db-access* (current-seconds)) (set! *incoming-data* (cons (vector 'register-test (current-milliseconds) (list run-id test-name item-path)) ;; fail-count pass-count test-id)) *incoming-data*)) (mutex-unlock! *incoming-mutex*) (if (and (not force-write) *cache-on*) - (debug:print 6 "INFO: *cache-on* is " *cache-on* ", skipping cache write") + (debug:print-info 6 "*cache-on* is " *cache-on* ", skipping cache write") (db:write-cached-data)))) ;; The queue is a list of vectors where the zeroth slot indicates the type of query to ;; apply and the second slot is the time of the query and the third entry is a list of ;; values to be applied @@ -1153,18 +1153,18 @@ (mutex-lock! *incoming-mutex*) (set! data (sort *incoming-data* (lambda (a b)(< (vector-ref a 1)(vector-ref b 1))))) (set! *incoming-data* '()) (mutex-unlock! *incoming-mutex*) (if (> (length data) 0) - (debug:print 4 "INFO: Writing cached data " data)) + (debug:print-info 4 "Writing cached data " data)) (sqlite3:with-transaction db (lambda () - (debug:print 4 "INFO: flushing " data " to db") + (debug:print-info 4 "flushing " data " to db") (for-each (lambda (entry) (let ((params (vector-ref entry 2))) - (debug:print 4 "INFO: Applying " entry " to params " params) + (debug:print-info 4 "Applying " entry " to params " params) (case (vector-ref entry 0) ((state-status) (apply sqlite3:execute state-status-stmt params)) ((state-status-msg) (apply sqlite3:execute state-status-msg-stmt params)) @@ -1620,11 +1620,11 @@ (if (string=? item-path "") "" (conc "/" item-path)) final-log))) ;; for now throw away newpath and use the log-fpath conc'd with pathmod (set! newpath (conc pathmod log-fpath)) (if windows (string-translate newpath "/" "\\") newpath)) - (if (> *verbosity* 1) + (if (debug:debug-mode 1) (conc final-log " not-found") ""))) (vector->list vb)) b))))) db Index: items.scm ================================================================== --- items.scm +++ items.scm @@ -75,11 +75,11 @@ (items (cadr x))) (list name (string-split items))))) itemsdat)))) (let ((debuglevel 5)) (debug:print 5 "item-assoc->item-list: itemsdat => itemlst ") - (if (>= *verbosity* 5) + (if (debug:debug-mode 5) (begin (pp itemsdat) (print " => ") (pp itemlst)))) (if (> (length itemlst) 0) Index: launch.scm ================================================================== --- launch.scm +++ launch.scm @@ -439,21 +439,21 @@ (hash-table-set! *toptest-paths* testname curr-test-path) (db:test-set-rundir! db run-id testname "" lnkpath) ;; toptest-path) (if (or (not curr-test-path) (not (directory-exists? toptest-path))) (begin - (debug:print 2 "INFO: Creating " toptest-path " and link " lnkpath) + (debug:print-info 2 "Creating " toptest-path " and link " lnkpath) (create-directory toptest-path #t) (hash-table-set! *toptest-paths* testname toptest-path))))) ;; Now create the link from the test path to the link tree, however ;; if the test is iterated it is necessary to create the parent path ;; to the iteration. use pathname-directory to trim the path by one ;; level (if (not not-iterated) ;; i.e. iterated (let ((iterated-parent (pathname-directory (conc lnkpath "/" item-path)))) - (debug:print 2 "INFO: Creating iterated parent " iterated-parent) + (debug:print-info 2 "Creating iterated parent " iterated-parent) (create-directory iterated-parent #t))) (if (symbolic-link? lnkpath) (delete-file lnkpath)) (if (not (or (file-exists? lnkpath) (symbolic-link? lnkpath))) @@ -484,11 +484,11 @@ ;; (symbolic-link? testlink))) ;; (system (conc "rm -f " testlink))) ;; (system (conc "ln -sf " test-path " " testlink))) (if (directory? test-path) (begin - (let* ((cmd (conc "rsync -av" (if (> *verbosity* 1) "" "q") " " test-src-path "/ " test-path "/")) + (let* ((cmd (conc "rsync -av" (if (debug:debug-mode 1) "" "q") " " test-src-path "/ " test-path "/")) (status (system cmd))) (if (not (eq? status 0)) (debug:print 2 "ERROR: problem with running \"" cmd "\""))) (list lnkpathf lnkpath )) (list #f #f)))) @@ -553,11 +553,11 @@ (set! diskpath (get-best-disk *configdat*)) (if diskpath (let ((dat (open-run-close create-work-area db run-id test-id test-path diskpath test-name itemdat))) (set! work-area (car dat)) (set! toptest-work-area (cadr dat)) - (debug:print 2 "INFO: Using work area " work-area)) + (debug:print-info 2 "Using work area " work-area)) (begin (set! work-area (conc test-path "/tmp_run")) (create-directory work-area #t) (debug:print 0 "WARNING: No disk work area specified - running in the test directory under tmp_run"))) (set! cmdparms (base64:base64-encode (with-output-to-string @@ -576,11 +576,11 @@ (list 'env-ovrd (hash-table-ref/default *configdat* "env-override" '())) (list 'set-vars (if params (hash-table-ref/default params "-setvars" #f))) (list 'runname runname) (list 'mt-bindir-path mt-bindir-path))))))) ;; (string-intersperse keyvallst " ")))) ;; clean out step records from previous run if they exist - (debug:print 4 "INFO: FIXMEEEEE!!!! This can be removed some day, perhaps move all test records to the test db?") + (debug:print-info 4 "FIXMEEEEE!!!! This can be removed some day, perhaps move all test records to the test db?") (open-run-close db:delete-test-step-records db test-id) (change-directory work-area) ;; so that log files from the launch process don't clutter the test dir (tests:test-set-status! test-id "LAUNCHED" "n/a" #f #f) ;; (if launch-results launch-results "FAILED")) (cond ((and launcher hosts) ;; must be using ssh hostname Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -35,10 +35,11 @@ version " megatest-version " license GPL, Copyright Matt Welland 2006-2012 Usage: megatest [options] -h : this help + -version : print megatest version (currently " megatest-version ") Launching and managing runs -runall : run all tests that are not state COMPLETED and status PASS, CHECK or KILLED -runtests tst1,tst2 ... : run tests @@ -163,10 +164,11 @@ "-gen-megatest-test" "-override-timeout" "-test-files" ;; -test-paths is for listing all ) (list "-h" + "-version" "-force" "-xterm" "-showkeys" "-test-status" "-set-values" @@ -198,31 +200,28 @@ (if (args:get-arg "-h") (begin (print help) (exit))) + +(if (args:get-arg "-version") + (begin + (print megatest-version) + (exit))) (define *didsomething* #f) ;;====================================================================== ;; Misc setup stuff ;;====================================================================== -(set! *verbosity* (cond - ((string? (args:get-arg "-debug"))(string->number (args:get-arg "-debug"))) - ((args:get-arg "-v") 2) - ((args:get-arg "-q") 0) - (else 1))) - -(if (not (number? *verbosity*)) - (begin - (print "ERROR: Invalid debug value " (args:get-arg "-debug")) - (exit))) - +(set! *verbosity* (debug:calc-verbosity (args:get-arg "-debug"))) +(debug:check-verbosity *verbosity* (args:get-arg "-debug")) + (if (args:get-arg "-logging")(set! *logging* #t)) -(if (> *verbosity* 3) ;; we are obviously debugging +(if (debug:debug-mode 3) ;; we are obviously debugging (set! open-run-close open-run-close-no-exception-handling)) ;; a,b,c % => a/%,b/%,c/% (define (tack-on-patt srcstr patt) (let ((strlst (string-split srcstr ","))) @@ -368,11 +367,11 @@ ;; Start the server - can be done in conjunction with -runall or -runtests (one day...) ;;====================================================================== (if (args:get-arg "-server") (let* ((toppath (setup-for-run)) (db (if toppath (open-db) #f))) - (debug:print 0 "INFO: Starting the standalone server") + (debug:print-info 0 "Starting the standalone server") (if db (let* ((host:port (db:get-var db "SERVER")) ;; this doen't support multiple servers BUG!!!! (th2 (server:start db (args:get-arg "-server"))) (th3 (make-thread (lambda () (server:keep-running db host:port))))) @@ -699,21 +698,21 @@ (cons cmd params) " ") ") " redir " " logfile))) ;; mark the start of the test (open-run-close db:teststep-set-status! db test-id stepname "start" "n/a" (args:get-arg "-m") logfile) ;; run the test step - (debug:print 2 "INFO: Running \"" fullcmd "\"") + (debug:print-info 2 "Running \"" fullcmd "\"") (change-directory startingdir) (set! exitstat (system fullcmd)) ;; cmd params)) (set! *globalexitstatus* exitstat) (change-directory testpath) ;; run logpro if applicable ;; (process-run "ls" (list "/foo" "2>&1" "blah.log")) (if logprofile (let* ((htmllogfile (conc stepname ".html")) (oldexitstat exitstat) (cmd (string-intersperse (list "logpro" logprofile htmllogfile "<" logfile ">" (conc stepname "_logpro.log")) " "))) - (debug:print 2 "INFO: running \"" cmd "\"") + (debug:print-info 2 "running \"" cmd "\"") (change-directory startingdir) (set! exitstat (system cmd)) (set! *globalexitstatus* exitstat) ;; no necessary (change-directory testpath) (open-run-close db:test-set-log! db test-id htmllogfile))) Index: runs.scm ================================================================== --- runs.scm +++ runs.scm @@ -53,11 +53,11 @@ (begin (debug:print 0 "ERROR: searching for runs with no pattern set for " fulkey) (exit 6))))) keys) (set! qry-str (conc "SELECT " keystr " FROM runs WHERE runname " runwildtype " ? " key-patt ";")) - (debug:print 4 "INFO: runs:get-runs-by-patt qry=" qry-str " " runnamepatt) + (debug:print-info 4 "runs:get-runs-by-patt qry=" qry-str " " runnamepatt) (sqlite3:for-each-row (lambda (a . r) (set! res (cons (list->vector (cons a r)) res))) db qry-str @@ -212,11 +212,11 @@ ;; test-patts (using % as wildcard) (set! test-names (tests:get-valid-tests *toppath* test-patts test-names: test-names)) (set! test-names (delete-duplicates test-names)) - (debug:print 0 "INFO: test names " test-names) + (debug:print-info 0 "test names " test-names) ;; on the first pass or call to run-tests set FAILS to NOT_STARTED if ;; -keepgoing is specified (if (eq? *passnum* 0) (begin @@ -231,11 +231,11 @@ ;; (sqlite3:finalize! db) ;; now add non-directly referenced dependencies (i.e. waiton) (if (not (null? test-names)) (let loop ((hed (car test-names)) (tal (cdr test-names))) ;; 'return-procs tells the config reader to prep running system but return a proc - (debug:print 4 "INFO: hed=" hed " at top of loop") + (debug:print-info 4 "hed=" hed " at top of loop") (let* ((config (tests:get-testconfig hed 'return-procs)) (waitons (if config (string-split (let ((w (config-lookup config "requirements" "waiton"))) (if w w ""))) (begin (debug:print 0 "ERROR: non-existent required test \"" hed "\"") @@ -261,23 +261,23 @@ ;; process can know to call items:get-items-from-config ;; if either is a list and none is a proc go ahead and call get-items ;; otherwise return #f - this is not an iterated test (cond ((procedure? items) - (debug:print 4 "INFO: items is a procedure, will calc later") + (debug:print-info 4 "items is a procedure, will calc later") items) ;; calc later ((procedure? itemstable) - (debug:print 4 "INFO: itemstable is a procedure, will calc later") + (debug:print-info 4 "itemstable is a procedure, will calc later") itemstable) ;; calc later ((filter (lambda (x) (let ((val (car x))) (if (procedure? val) val #f))) (append (if (list? items) items '()) (if (list? itemstable) itemstable '()))) 'have-procedure) ((or (list? items)(list? itemstable)) ;; calc now - (debug:print 4 "INFO: items and itemstable are lists, calc now\n" + (debug:print-info 4 "items and itemstable are lists, calc now\n" " items: " items " itemstable: " itemstable) (items:get-items-from-config config)) (else #f))) ;; not iterated #f ;; itemsdat 5 #f ;; spare - used for item-path @@ -292,15 +292,15 @@ (let ((remtests (delete-duplicates (append waitons tal)))) (if (not (null? remtests)) (loop (car remtests)(cdr remtests))))))) (if (not (null? required-tests)) - (debug:print 1 "INFO: Adding " required-tests " to the run queue")) + (debug:print-info 1 "Adding " required-tests " to the run queue")) ;; NOTE: these are all parent tests, items are not expanded yet. - (debug:print 4 "INFO: test-records=" (hash-table->alist test-records)) + (debug:print-info 4 "test-records=" (hash-table->alist test-records)) (runs:run-tests-queue run-id runname test-records keyvallst flags test-patts) - (debug:print 4 "INFO: All done by here"))) + (debug:print-info 4 "All done by here"))) (define (runs:calc-fails prereqs-not-met) (filter (lambda (test) (and (vector? test) ;; not (string? test)) (equal? (db:test-get-state test) "COMPLETED") @@ -337,11 +337,11 @@ (set! max-retries (if (and max-retries (string->number max-retries))(string->number max-retries) 100)) (if (not (null? sorted-test-names)) (let loop ((hed (car sorted-test-names)) (tal (cdr sorted-test-names)) (reruns '())) - (if (not (null? reruns))(debug:print 4 "INFO: reruns=" reruns)) + (if (not (null? reruns))(debug:print-info 4 "reruns=" reruns)) ;; (print "Top of loop, hed=" hed ", tal=" tal " ,reruns=" reruns) (let* ((test-record (hash-table-ref test-records hed)) (test-name (tests:testqueue-get-testname test-record)) (tconfig (tests:testqueue-get-testconfig test-record)) (testmode (let ((m (config-lookup tconfig "requirements" "mode"))) @@ -380,40 +380,40 @@ (max-concurrent-jobs (list-ref run-limits-info 3)) (job-group-limit (list-ref run-limits-info 4)) (prereqs-not-met (open-run-close db:get-prereqs-not-met #f run-id waitons item-path mode: testmode)) (fails (runs:calc-fails prereqs-not-met)) (non-completed (runs:calc-not-completed prereqs-not-met))) - (debug:print 8 "INFO: have-resources: " have-resources " prereqs-not-met: " + (debug:print-info 8 "have-resources: " have-resources " prereqs-not-met: " (string-intersperse (map (lambda (t) (if (vector? t) (conc (db:test-get-state t) "/" (db:test-get-status t)) (conc " WARNING: t is not a vector=" t ))) prereqs-not-met) ", ") " fails: " fails) - (debug:print 4 "INFO: hed=" hed "\n test-record=" test-record "\n test-name: " test-name "\n item-path: " item-path "\n test-patts: " test-patts) + (debug:print-info 4 "hed=" hed "\n test-record=" test-record "\n test-name: " test-name "\n item-path: " item-path "\n test-patts: " test-patts) ;; Don't know at this time if the test have been launched at some time in the past ;; i.e. is this a re-launch? - (debug:print 4 "INFO: run-limits-info = " run-limits-info) + (debug:print-info 4 "run-limits-info = " run-limits-info) (cond ;; INNER COND #1 for a launchable test ;; Check item path against item-patts ((not (tests:match test-patts (tests:testqueue-get-testname test-record) item-path)) ;; This test/itempath is not to be run ;; else the run is stuck, temporarily or permanently ;; but should check if it is due to lack of resources vs. prerequisites - (debug:print 1 "INFO: Skipping " (tests:testqueue-get-testname test-record) " " item-path " as it doesn't match " test-patts) + (debug:print-info 1 "Skipping " (tests:testqueue-get-testname test-record) " " item-path " as it doesn't match " test-patts) (thread-sleep! *global-delta*) (if (not (null? tal)) (loop (car tal)(cdr tal) reruns))) ((and (not (hash-table-ref/default test-registery (runs:make-full-test-name test-name item-path) #f)) (and max-concurrent-jobs (> (- max-concurrent-jobs num-running) 5))) - (debug:print 4 "INFO: Pre-registering test " test-name "/" item-path " to create placeholder" ) + (debug:print-info 4 "Pre-registering test " test-name "/" item-path " to create placeholder" ) (open-run-close db:tests-register-test #f run-id test-name item-path) (hash-table-set! test-registery (runs:make-full-test-name test-name item-path) #t) (thread-sleep! *global-delta*) (loop (car newtal)(cdr newtal) reruns)) ((not have-resources) ;; simply try again after waiting a second - (debug:print 1 "INFO: no resources to run new tests, waiting ...") + (debug:print-info 1 "no resources to run new tests, waiting ...") (thread-sleep! (+ 0.01 *global-delta*)) ;; could have done hed tal here but doing car/cdr of newtal to rotate tests (loop (car newtal)(cdr newtal) reruns)) ((and have-resources (or (null? prereqs-not-met) @@ -428,11 +428,11 @@ ;; If one or more of the prereqs-not-met are FAIL then we can issue ;; a message and drop hed from the items to be processed. (if (null? fails) (begin ;; couldn't run, take a breather - (debug:print 4 "INFO: Shouldn't really get here, race condition? Unable to launch more tests at this moment, killing time ...") + (debug:print-info 4 "Shouldn't really get here, race condition? Unable to launch more tests at this moment, killing time ...") (thread-sleep! (+ 0.01 *global-delta*)) ;; long sleep here - no resources, may as well be patient ;; we made new tal by sticking hed at the back of the list (loop (car newtal)(cdr newtal) reruns)) ;; the waiton is FAIL so no point in trying to run hed ever again (if (not (null? tal)) @@ -447,11 +447,11 @@ (loop hed tal reruns))))))))) ;; END OF INNER COND ;; case where an items came in as a list been processed ((and (list? items) ;; thus we know our items are already calculated (not itemdat)) ;; and not yet expanded into the list of things to be done - (if (and (>= *verbosity* 1) + (if (and (debug:debug-mode 1) ;; (>= *verbosity* 1) (> (length items) 0) (> (length (car items)) 0)) (pp items)) (for-each (lambda (my-itemdat) @@ -467,11 +467,11 @@ (hash-table-set! test-records newtestname new-test-record) (set! tal (cons newtestname tal)))))) ;; since these are itemized create new test names testname/itempath items) (if (not (null? tal)) (begin - (debug:print 4 "INFO: End of items list, looping with next after short delay") + (debug:print-info 4 "End of items list, looping with next after short delay") (thread-sleep! (+ 0.01 *global-delta*)) (loop (car tal)(cdr tal) reruns)))) ;; if items is a proc then need to run items:get-items-from-config, get the list and loop ;; - but only do that if resources exist to kick off the job @@ -479,11 +479,11 @@ (let ((can-run-more (open-run-close runs:can-run-more-tests #f test-record))) (if can-run-more (let* ((prereqs-not-met (open-run-close db:get-prereqs-not-met #f run-id waitons item-path mode: testmode)) (fails (runs:calc-fails prereqs-not-met)) (non-completed (runs:calc-not-completed prereqs-not-met))) - (debug:print 8 "INFO: can-run-more: " can-run-more + (debug:print-info 8 "can-run-more: " can-run-more "\n testname: " hed "\n prereqs-not-met: " (runs:pretty-string prereqs-not-met) "\n non-completed: " (runs:pretty-string non-completed) "\n fails: " (runs:pretty-string fails) "\n testmode: " testmode @@ -511,11 +511,11 @@ (loop hed tal reruns)) (begin (debug:print 0 "ERROR: The proc from reading the setup did not yield a list - please report this") (exit 1)))))) ((null? fails) - (debug:print 4 "INFO: fails is null, moving on in the queue but keeping " hed " for now") + (debug:print-info 4 "fails is null, moving on in the queue but keeping " hed " for now") ;; only increment num-retries when there are no tests runing (if (eq? 0 (list-ref can-run-more 1)) (begin (if (> num-retries 100) ;; first 100 retries are low time cost (thread-sleep! (+ 2 *global-delta*)) @@ -524,11 +524,11 @@ (if (> num-retries max-retries) (if (not (null? tal)) (loop (car tal)(cdr tal) reruns)) (loop (car newtal)(cdr newtal) reruns))) ;; an issue with prereqs not yet met? ((and (not (null? fails))(eq? testmode 'normal)) - (debug:print 1 "INFO: test " hed " (mode=" testmode ") has failed prerequisite(s); " + (debug:print-info 1 "test " hed " (mode=" testmode ") has failed prerequisite(s); " (string-intersperse (map (lambda (t)(conc (db:test-get-testname t) ":" (db:test-get-state t)"/"(db:test-get-status t))) fails) ", ") ", removing it from to-do list") (if (not (null? tal)) (begin (thread-sleep! *global-delta*) @@ -538,11 +538,11 @@ (thread-sleep! (+ 1 *global-delta*)) (loop (car newtal)(cdr newtal) reruns)))) ;; END OF IF CAN RUN MORE ;; if can't run more just loop with next possible test (begin - (debug:print 4 "INFO: processing the case with a lambda for items or 'have-procedure. Moving through the queue without dropping " hed) + (debug:print-info 4 "processing the case with a lambda for items or 'have-procedure. Moving through the queue without dropping " hed) (thread-sleep! (+ 1 *global-delta*)) (loop (car newtal)(cdr newtal) reruns))))) ;; END OF (or (procedure? items)(eq? items 'have-procedure)) ;; this case should not happen, added to help catch any bugs ((and (list? items) itemdat) @@ -549,28 +549,28 @@ (debug:print 0 "ERROR: Should not have a list of items in a test and the itemspath set - please report this") (exit 1)) ((not (null? reruns)) (let* ((newlst (open-run-close tests:filter-non-runnable #f run-id tal test-records)) ;; i.e. not FAIL, WAIVED, INCOMPLETE, PASS, KILLED, (junked (lset-difference equal? tal newlst))) - (debug:print 4 "INFO: full drop through, if reruns is less than 100 we will force retry them, reruns=" reruns ", tal=" tal) + (debug:print-info 4 "full drop through, if reruns is less than 100 we will force retry them, reruns=" reruns ", tal=" tal) (if (< num-retries max-retries) (set! newlst (append reruns newlst))) (set! num-retries (+ num-retries 1)) (thread-sleep! (+ 1 *global-delta*)) (if (not (null? newlst)) ;; since reruns have been tacked on to newlst create new reruns from junked (loop (car newlst)(cdr newlst)(delete-duplicates junked))))) ((not (null? tal)) - (debug:print 4 "INFO: I'm pretty sure I shouldn't get here.")) + (debug:print-info 4 "I'm pretty sure I shouldn't get here.")) (else - (debug:print 4 "INFO: Exiting loop with...\n hed=" hed "\n tal=" tal "\n reruns=" reruns)) + (debug:print-info 4 "Exiting loop with...\n hed=" hed "\n tal=" tal "\n reruns=" reruns)) )))) ;; LET* ((test-record ;; we get here on "drop through" - loop for next test in queue ;; FIXME!!!! THIS SHOULD NOT REQUIRE AN EXIT!!!!!!! - (debug:print 1 "INFO: All tests launched") + (debug:print-info 1 "All tests launched") (thread-sleep! 0.5) ;; FIXME! This harsh exit should not be necessary.... ;; (if (not *runremote*)(exit)) ;; #f)) ;; return a #f as a hint that we are done ;; Here we need to check that all the tests remaining to be run are eligible to run @@ -629,11 +629,11 @@ (if (not test-id) (begin (debug:print 2 "WARN: Test not pre-created? test-name=" test-name ", item-path=" item-path ", run-id=" run-id) (open-run-close db:tests-register-test #f run-id test-name item-path) (set! test-id (open-run-close db:get-test-id db run-id test-name item-path)))) - (debug:print 4 "INFO: test-id=" test-id ", run-id=" run-id ", test-name=" test-name ", item-path=\"" item-path "\"") + (debug:print-info 4 "test-id=" test-id ", run-id=" run-id ", test-name=" test-name ", item-path=\"" item-path "\"") (set! testdat (open-run-close db:get-test-info-by-id db test-id)))) (set! test-id (db:test-get-id testdat)) (change-directory test-path) (case (if force ;; (args:get-arg "-force") 'NOT_STARTED @@ -653,19 +653,19 @@ ((and (or (not rerun) keepgoing) ;; Require to force re-run for COMPLETED or *anything* + PASS,WARN or CHECK (or (member (test:get-status testdat) '("PASS" "WARN" "CHECK")) (member (test:get-state testdat) '("COMPLETED")))) - (debug:print 2 "INFO: running test " test-name "/" item-path " suppressed as it is " (test:get-state testdat) " and " (test:get-status testdat)) + (debug:print-info 2 "running test " test-name "/" item-path " suppressed as it is " (test:get-state testdat) " and " (test:get-status testdat)) (set! runflag #f)) ;; -rerun and status is one of the specifed, run it ((and rerun (let* ((rerunlst (string-split rerun ",")) (must-rerun (member (test:get-status testdat) rerunlst))) - (debug:print 3 "INFO: -rerun list: " rerun ", test-status: " (test:get-status testdat)", must-rerun: " must-rerun) + (debug:print-info 3 "-rerun list: " rerun ", test-status: " (test:get-status testdat)", must-rerun: " must-rerun) must-rerun)) - (debug:print 2 "INFO: Rerun forced for test " test-name "/" item-path) + (debug:print-info 2 "Rerun forced for test " test-name "/" item-path) (set! runflag #t)) ;; -keepgoing, do not rerun FAIL ((and keepgoing (member (test:get-status testdat) '("FAIL"))) (set! runflag #f)) @@ -723,11 +723,11 @@ (header (vector-ref rundat 0)) (runs (vector-ref rundat 1)) (states (if state (string-split state ",") '())) (statuses (if status (string-split status ",") '())) (state-status (if (string? new-state-status) (string-split new-state-status ",") '(#f #f)))) - (debug:print 4 "INFO: runs:operate-on => Header: " header " action: " action " new-state-status: " new-state-status) + (debug:print-info 4 "runs:operate-on => Header: " header " action: " action " new-state-status: " new-state-status) (if (> 2 (length state-status)) (begin (debug:print 0 "ERROR: the parameter to -set-state-status is a comma delimited string. E.g. COMPLETED,FAIL") (exit))) (for-each @@ -744,11 +744,11 @@ sort-by: (case action ((remove-runs) 'rundir) (else 'event_time))) '())) (lasttpath "/does/not/exist/I/hope")) - (debug:print 4 "INFO: runs:operate-on run=" run ", header=" header) + (debug:print-info 4 "runs:operate-on run=" run ", header=" header) (if (not (null? tests)) (begin (case action ((remove-runs) (debug:print 1 "Removing tests for run: " runkey " " (db:get-value-by-header run header "runname"))) @@ -756,11 +756,11 @@ (debug:print 1 "Modifying state and staus for tests for run: " runkey " " (db:get-value-by-header run header "runname"))) ((print-run) (debug:print 1 "Printing info for run " runkey ", run=" run ", tests=" tests ", header=" header) action) (else - (print "INFO: action not recognised " action))) + (debug:print-info 0 "action not recognised " action))) (for-each (lambda (test) (let* ((item-path (db:test-get-item-path test)) (test-name (db:test-get-testname test)) (run-dir (db:test-get-rundir test)) ;; run dir is from the link tree @@ -767,37 +767,37 @@ (real-dir (if (file-exists? run-dir) (resolve-pathname run-dir) #f)) (test-id (db:test-get-id test))) ;; (tdb (db:open-test-db run-dir))) - (debug:print 4 "INFO: test=" test) ;; " (db:test-get-testname test) " id: " (db:test-get-id test) " " item-path " action: " action) + (debug:print-info 4 "test=" test) ;; " (db:test-get-testname test) " id: " (db:test-get-id test) " " item-path " action: " action) (case action ((remove-runs) ;; the tdb is for future possible. (open-run-close db:delete-test-records db #f (db:test-get-id test)) - (debug:print 1 "INFO: Attempting to remove dir " real-dir " and link " run-dir) + (debug:print-info 1 "Attempting to remove dir " real-dir " and link " run-dir) (if (and real-dir (> (string-length real-dir) 5) (file-exists? real-dir)) ;; bad heuristic but should prevent /tmp /home etc. (begin ;; let* ((realpath (resolve-pathname run-dir))) - (debug:print 1 "INFO: Recursively removing " real-dir) + (debug:print-info 1 "Recursively removing " real-dir) (if (file-exists? real-dir) (if (> (system (conc "rm -rf " real-dir)) 0) (debug:print 0 "ERROR: There was a problem removing " real-dir " with rm -f")) (debug:print 0 "WARNING: test run dir " real-dir " appears to not exist"))) (debug:print 0 "WARNING: directory " real-dir " does not exist")) (if (symbolic-link? run-dir) (begin - (debug:print 1 "INFO: Removing symlink " run-dir) + (debug:print-info 1 "Removing symlink " run-dir) (delete-file run-dir)) (if (directory? run-dir) (if (> (directory-fold (lambda (f x)(+ 1 x)) 0 run-dir) 0) (debug:print 0 "WARNING: refusing to remove " run-dir " as it is not empty") (delete-directory run-dir)) ;; it should be empty by here BUG BUG, add error catch (debug:print 0 "ERROR: refusing to remove " run-dir " as it either doesn't exist or is not a symlink or directory") ))) ((set-state-status) - (debug:print 2 "INFO: new state " (car state-status) ", new status " (cadr state-status)) + (debug:print-info 2 "new state " (car state-status) ", new status " (cadr state-status)) (open-run-close db:test-set-state-status-by-id db (db:test-get-id test) (car state-status)(cadr state-status) #f))))) (sort tests (lambda (a b)(let ((dira (db:test-get-rundir a)) (dirb (db:test-get-rundir b))) (if (and (string? dira)(string? dirb)) (> (string-length dira)(string-length dirb)) @@ -898,11 +898,11 @@ (and unlock (begin (print "Do you really wish to unlock run " run-id "?\n y/n: ") (equal? "y" (read-line))))) (open-run-close db:lock/unlock-run db run-id lock unlock user) - (debug:print 0 "INFO: Skipping lock/unlock on " run-id)))) + (debug:print-info 0 "Skipping lock/unlock on " run-id)))) runs))) ;;====================================================================== ;; Rollup runs ;;====================================================================== Index: server.scm ================================================================== --- server.scm +++ server.scm @@ -69,11 +69,11 @@ 'server:login (lambda (toppath) (set! *last-db-access* (current-seconds)) (if (equal? *toppath* toppath) (begin - (debug:print 2 "INFO: login successful") + (debug:print-info 2 "login successful") #t) #f))) ;;====================================================================== ;; db specials here @@ -80,42 +80,42 @@ ;;====================================================================== ;; remote call to open-run-close (rpc:publish-procedure! 'rdb:open-run-close (lambda (procname . remargs) - (debug:print 4 "INFO: Remote call of rdb:open-run-close " procname " " remargs) + (debug:print-info 4 "Remote call of rdb:open-run-close " procname " " remargs) (set! *last-db-access* (current-seconds)) (apply open-run-close (eval procname) remargs))) (rpc:publish-procedure! 'cdb:test-set-status-state (lambda (test-id status state msg) - (debug:print 4 "INFO: Remote call of cdb:test-set-status-state test-id=" test-id ", status=" status ", state=" state ", msg=" msg) + (debug:print-info 4 "Remote call of cdb:test-set-status-state test-id=" test-id ", status=" status ", state=" state ", msg=" msg) (cdb:test-set-status-state test-id status state msg))) (rpc:publish-procedure! 'cdb:test-rollup-test_data-pass-fail (lambda (test-id) - (debug:print 4 "INFO: Remote call of cdb:test-rollup-test_data-pass-fail " test-id) + (debug:print-info 4 "Remote call of cdb:test-rollup-test_data-pass-fail " test-id) (cdb:test-rollup-test_data-pass-fail test-id))) (rpc:publish-procedure! 'cdb:pass-fail-counts (lambda (test-id fail-count pass-count) - (debug:print 4 "INFO: Remote call of cdb:pass-fail-counts " test-id " passes: " pass-count " fails: " fail-count) + (debug:print-info 4 "Remote call of cdb:pass-fail-counts " test-id " passes: " pass-count " fails: " fail-count) (cdb:pass-fail-counts test-id fail-count pass-count))) (rpc:publish-procedure! 'cdb:tests-register-test (lambda (db run-id test-name item-path) - (debug:print 4 "INFO: Remote call of cdb:tests-register-test " run-id " testname: " test-name " item-path: " item-path) + (debug:print-info 4 "Remote call of cdb:tests-register-test " run-id " testname: " test-name " item-path: " item-path) (cdb:tests-register-test db run-id test-name item-path))) (rpc:publish-procedure! 'cdb:flush-queue (lambda () - (debug:print 4 "INFO: Remote call of cdb:flush-queue") + (debug:print-info 4 "Remote call of cdb:flush-queue") (cdb:flush-queue))) ;;====================================================================== ;; end of publish-procedure section ;;====================================================================== @@ -133,11 +133,11 @@ (mutex-lock! *incoming-mutex*) (set! queue-len (length *incoming-data*)) (mutex-unlock! *incoming-mutex*) (if (> queue-len 0) (begin - (debug:print 0 "INFO: Queue not flushed, waiting ...") + (debug:print-info 0 "Queue not flushed, waiting ...") (loop (+ n 1))))) ))) (thread-start! th1) ;; (debug:print 0 "Server started on port " (rpc:default-server-port) "...") (thread-start! th2) @@ -153,19 +153,19 @@ (thread-sleep! 20) ;; no need to do this very often (let ((numrunning (db:get-count-tests-running db))) (if (or (> numrunning 0) (> (+ *last-db-access* 60)(current-seconds))) (begin - (debug:print 0 "INFO: Server continuing, tests running: " numrunning ", seconds since last db access: " (- (current-seconds) *last-db-access*)) + (debug:print-info 0 "Server continuing, tests running: " numrunning ", seconds since last db access: " (- (current-seconds) *last-db-access*)) (loop (+ 1 count))) (begin - (debug:print 0 "INFO: Starting to shutdown the server side") + (debug:print-info 0 "Starting to shutdown the server side") ;; need to delete only *my* server entry (future use) (sqlite3:execute db "DELETE FROM metadat WHERE var='SERVER' AND val like ?;" host:port) (thread-sleep! 10) - (debug:print 0 "INFO: Max cached queries was " *max-cache-size*) - (debug:print 0 "INFO: Server shutdown complete. Exiting") + (debug:print-info 0 "Max cached queries was " *max-cache-size*) + (debug:print-info 0 "Server shutdown complete. Exiting") ;; (exit))) ))))) (define (server:find-free-port-and-open port) (handle-exceptions @@ -187,11 +187,11 @@ (host (if hostinfo (car hostdat) #f)) (port (if (and hostinfo (> (length hostdat) 1))(cadr hostdat) #f))) (if (and port (string->number port)) (let ((portn (string->number port))) - (debug:print 2 "INFO: Setting up to connect to host " host ":" port) + (debug:print-info 2 "Setting up to connect to host " host ":" port) (handle-exceptions exn (begin (debug:print 0 "ERROR: Failed to open a connection to the server at host: " host " port: " port) (debug:print 0 " EXCEPTION: " ((condition-property-accessor 'exn 'message) exn)) @@ -201,12 +201,12 @@ ;; #f) (set! *runremote* #f)) (if (and (not (args:get-arg "-server")) ;; no point in the server using the server using the server ((rpc:procedure 'server:login host portn) *toppath*)) (begin - (debug:print 2 "INFO: Logged in and connected to " host ":" port) + (debug:print-info 2 "Logged in and connected to " host ":" port) (set! *runremote* (vector host portn))) (begin - (debug:print 2 "INFO: Failed to login or connect to " host ":" port) + (debug:print-info 2 "Failed to login or connect to " host ":" port) (set! *runremote* #f))))) - (debug:print 2 "INFO: no server available"))))) + (debug:print-info 2 "no server available"))))) Index: tasks.scm ================================================================== --- tasks.scm +++ tasks.scm @@ -176,11 +176,11 @@ (sqlite3:execute tdb (conc "DELETE FROM tasks_queue WHERE id IN (" task-ids ");"))) ;; (define (tasks:start-monitor db tdb) (if (> (tasks:get-num-alive-monitors tdb) 2) ;; have two running, no need for more - (debug:print 1 "INFO: Not starting monitor, already have more than two running") + (debug:print-info 1 "Not starting monitor, already have more than two running") (let* ((megatestdb (conc *toppath* "/megatest.db")) (monitordbf (conc *toppath* "/monitor.db")) (last-db-update 0)) ;; (file-modification-time megatestdb))) (task:register-monitor tdb) (let loop ((count 0) Index: tests.scm ================================================================== --- tests.scm +++ tests.scm @@ -183,11 +183,11 @@ (map cdr (hash-table->alist tests-hash)) ;; return a list of the most recent tests (loop (car tal)(cdr tal)))))))))) ;; Do not rpc this one, do the underlying calls!!! (define (tests:test-set-status! test-id state status comment dat) - (debug:print 4 "INFO: tests:test-set-status! test-id=" test-id ", state=" state ", status=" status ", dat=" dat) + (debug:print-info 4 "tests:test-set-status! test-id=" test-id ", state=" state ", status=" status ", dat=" dat) (let* ((db #f) (real-status status) (otherdat (if dat dat (make-hash-table))) (testdat (open-run-close db:get-test-info-by-id db test-id)) (run-id (db:test-get-run_id testdat)) @@ -355,11 +355,11 @@ ))))) (define (get-all-legal-tests) (let* ((tests (glob (conc *toppath* "/tests/*"))) (res '())) - (debug:print 4 "INFO: Looking at tests " (string-intersperse tests ",")) + (debug:print-info 4 "Looking at tests " (string-intersperse tests ",")) (for-each (lambda (testpath) (if (file-exists? (conc testpath "/testconfig")) (set! res (cons (last (string-split testpath "/")) res)))) tests) res))