Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -20,20 +20,20 @@ MTESTHASH=$(shell fossil info|grep checkout:| awk '{print $$2}') CSIPATH=$(shell which csi) CKPATH=$(shell dirname $(shell dirname $(CSIPATH))) -all : mtest dboard newdashboard +all : mtest dboard newdboard mtest: $(OFILES) megatest.o csc $(CSCOPTS) $(OFILES) megatest.o -o mtest dboard : $(OFILES) $(GOFILES) dashboard.scm csc $(OFILES) dashboard.scm $(GOFILES) -o dboard -newdashboard : newdashboard.scm $(OFILES) - csc $(OFILES) newdashboard.scm -o newdashboard +newdboard : newdashboard.scm $(OFILES) $(GOFILES) + csc $(OFILES) $(GOFILES) newdashboard.scm -o newdboard deploytarg/libiupcd.so : $(CKPATH)/lib/libiupcd.so for i in iup im cd av call sqlite; do \ cp $(CKPATH)/lib/lib$$i* deploytarg/ ; \ done @@ -70,12 +70,14 @@ @echo Installing to PREFIX=$(PREFIX) $(INSTALL) mtest $(PREFIX)/bin/mtest utils/mk_wrapper $(PREFIX) mtest > $(PREFIX)/bin/megatest chmod a+x $(PREFIX)/bin/megatest -$(PREFIX)/bin/newdashboard : newdashboard - $(INSTALL) newdashboard $(PREFIX)/bin/newdashboard +$(PREFIX)/bin/newdboard : newdboard + $(INSTALL) newdboard $(PREFIX)/bin/newdboard + utils/mk_wrapper $(PREFIX) newdboard > $(PREFIX)/bin/newdashboard + chmod a+x $(PREFIX)/bin/newdashboard $(HELPERS) : utils/mt_* $(INSTALL) $< $@ chmod a+x $@ @@ -104,11 +106,11 @@ $(PREFIX)/bin/dboard : dboard $(FILES) $(INSTALL) dboard $(PREFIX)/bin/dboard utils/mk_wrapper $(PREFIX) dboard > $(PREFIX)/bin/dashboard chmod a+x $(PREFIX)/bin/dashboard -install : bin $(PREFIX)/bin/mtest $(PREFIX)/bin/megatest $(PREFIX)/bin/dboard $(PREFIX)/bin/dashboard $(HELPERS) $(PREFIX)/bin/nbfake $(PREFIX)/bin/nbfind $(PREFIX)/bin/newdashboard +install : bin $(PREFIX)/bin/mtest $(PREFIX)/bin/megatest $(PREFIX)/bin/dboard $(PREFIX)/bin/dashboard $(HELPERS) $(PREFIX)/bin/nbfake $(PREFIX)/bin/nbfind $(PREFIX)/bin/newdboard deploytarg/apropos.so : Makefile for i in apropos base64 canvas-draw csv-xml directory-utils dot-locking extras fmt format hostinfo http-client intarweb json md5 message-digest posix posix-extras readline regex regex-case s11n spiffy spiffy-request-vars sqlite3 srfi-1 srfi-18 srfi-69 tcp test uri-common zmq check-errors synch matchable sql-null tcp-server rpc blob-utils string-utils variable-item defstruct uri-generic sendfile opensll openssl lookup-table list-utils stack; do \ chicken-install -prefix deploytarg -deploy $$i;done Index: common.scm ================================================================== --- common.scm +++ common.scm @@ -147,10 +147,16 @@ ;;====================================================================== ;; System stuff ;;====================================================================== +;; return a nice clean pathname made absolute +(define (nice-path dir) + (normalize-pathname (if (absolute-pathname? dir) + dir + (conc (current-directory) "/" dir)))) + (define (get-df path) (let* ((df-results (cmd-run->list (conc "df " path))) (space-rx (regexp "([0-9]+)\\s+([0-9]+)%")) (freespc #f)) ;; (write df-results) @@ -243,24 +249,23 @@ ((red) "223 33 49") ((grey) "192 192 192") ((orange) "255 172 13") ((purple) "This is unfinished ..."))) -(define (common:get-color-for-state-status state status type) +(define (common:get-color-for-state-status state status) (case (string->symbol state) ((COMPLETED) - (if (equal? status "PASS") - "70 249 73" - (if (or (equal? status "WARN") - (equal? status "WAIVED")) - "255 172 13" - "223 33 49"))) ;; greenish orangeish redish + (case (string->symbol status) + ((PASS) "70 249 73") + ((WARN WAIVED) "255 172 13") + ((SKIP) "230 230 0") + (else "223 33 49"))) ((LAUNCHED) "101 123 142") ((CHECK) "255 100 50") - ((REMOTEHOSTSTART) "50 130 195") - ((RUNNING) "9 131 232") - ((KILLREQ) "39 82 206") + ((REMOTEHOSTSTART) "50 130 195") + ((RUNNING) "9 131 232") + ((KILLREQ) "39 82 206") ((KILLED) "234 101 17") ((NOT_STARTED) "240 240 240") (else "192 192 192"))) (define (common:get-color-from-status status) Index: configf.scm ================================================================== --- configf.scm +++ configf.scm @@ -11,11 +11,11 @@ ;;====================================================================== ;; Config file handling ;;====================================================================== -(use regex regex-case) +(use regex regex-case directory-utils) (declare (unit configf)) (declare (uses common)) (declare (uses process)) (include "common_records.scm") @@ -130,11 +130,11 @@ ;; 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-info 5 "read-config " path " allow-system " allow-system " environ-patt " environ-patt " curr-section: " curr-section " sections: " sections " pwd: " (current-directory)) (if (not (file-exists? path)) (begin - (debug:print-info 4 "read-config - file not found " path " current path: " (current-directory)) + (debug:print-info 1 "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 allow-system)) ;; (read-line inp)) (curr-section-name (if curr-section curr-section "default")) @@ -148,16 +148,28 @@ res) (regex-case inl (configf:comment-rx _ (loop (configf:read-line inp res allow-system) curr-section-name #f #f)) (configf:blank-l-rx _ (loop (configf:read-line inp res allow-system) curr-section-name #f #f)) - (configf:include-rx ( x include-file ) (let ((curr-dir (current-directory)) - (conf-dir (pathname-directory path))) - (if conf-dir (change-directory conf-dir)) - (read-config include-file res allow-system environ-patt: environ-patt curr-section: curr-section-name sections: sections) - (change-directory curr-dir) - (loop (configf:read-line inp res allow-system) curr-section-name #f #f))) + (configf:include-rx ( x include-file ) (let* ((curr-conf-dir (pathname-directory path)) + (full-conf (if (absolute-pathname? include-file) + include-file + (nice-path + (conc (if curr-conf-dir + curr-conf-dir + ".") + "/" include-file))))) + (if (file-exists? full-conf) + (begin + ;; (push-directory conf-dir) + (read-config full-conf res allow-system environ-patt: environ-patt curr-section: curr-section-name sections: sections) + ;; (pop-directory) + (loop (configf:read-line inp res allow-system) curr-section-name #f #f)) + (begin + (debug:print 2 "INFO: include file " include-file " not found (called from " path ")") + (debug:print 2 " " full-conf) + (loop (configf:read-line inp res allow-system) curr-section-name #f #f))))) (configf:section-rx ( x section-name ) (loop (configf:read-line inp res allow-system) ;; 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 "" Index: dashboard-tests.scm ================================================================== --- dashboard-tests.scm +++ dashboard-tests.scm @@ -62,11 +62,11 @@ (lambda (testdat) (let ((newstatus (db:test-get-status testdat)) (oldstatus (iup:attribute lbl "TITLE"))) (if (not (equal? oldstatus newstatus)) (begin - (iup:attribute-set! lbl "FGCOLOR" (get-color-for-state-status (db:test-get-state testdat) + (iup:attribute-set! lbl "FGCOLOR" (common:get-color-for-state-status (db:test-get-state testdat) (db:test-get-status testdat))) (iup:attribute-set! lbl "TITLE" (db:test-get-status testdat))))))) lbl) (store-label "testcomment" (iup:label "TestComment " @@ -188,11 +188,11 @@ ;; state status teststeps (define *state-status* (vector #f #f #f)) (define (update-state-status-buttons testdat) (let* ((state (db:test-get-state testdat)) (status (db:test-get-status testdat)) - (color (get-color-for-state-status state status))) + (color (common:get-color-for-state-status state status))) ((vector-ref *state-status* 0) state color) ((vector-ref *state-status* 1) status color))) ;;====================================================================== ;; Set fields @@ -237,11 +237,11 @@ #:expand "HORIZONTAL" #:size "50x" #:font "Courier New, -10" #:action (lambda (x) (open-run-close db:test-set-state-status-by-id #f test-id #f status #f) (db:test-set-status! testdat status))))) btn)) - (list "PASS" "WARN" "FAIL" "CHECK" "n/a" "WAIVED")))) + (list "PASS" "WARN" "FAIL" "CHECK" "n/a" "WAIVED" "SKIP")))) (vector-set! *state-status* 1 (lambda (status color) (for-each (lambda (btn) (let* ((name (iup:attribute btn "TITLE")) @@ -270,11 +270,11 @@ (keydat (if testdat (open-run-close db:get-key-val-pairs #f run-id) #f)) (rundat (if testdat (open-run-close db:get-run-info #f run-id) #f)) (runname (if testdat (db:get-value-by-header (db:get-row rundat) (db:get-header rundat) "runname") #f)) - ;(teststeps (if testdat (db:get-steps-for-test db test-id) #f)) + (teststeps (if testdat (db:get-compressed-steps test-id) '())) (logfile "/this/dir/better/not/exist") (rundir logfile) (testfullname (if testdat (db:test-get-fullname testdat) "Gathering data ...")) (testname (if testdat (db:test-get-testname testdat) "n/a")) (testmeta (if testdat @@ -309,14 +309,16 @@ request-update)) (newtestdat (if need-update (open-run-close db:get-test-info-by-id #f test-id)))) (cond ((and need-update newtestdat) (set! testdat newtestdat) - (set! teststeps (open-run-close db:get-steps-for-test db test-id)) + (set! teststeps (db:get-compressed-steps test-id)) (set! logfile (conc (db:test-get-rundir testdat) "/" (db:test-get-final_logf testdat))) (set! rundir (db:test-get-rundir testdat)) - (set! testfullname (db:test-get-fullname testdat))) + (set! testfullname (db:test-get-fullname testdat)) + ;; (debug:print 0 "INFO: teststeps=" (intersperse teststeps "\n ")) + ) (need-update ;; if this was true and yet there is no data .... (db:test-set-testname! testdat "DEAD OR DELETED TEST")))))) (widgets (make-hash-table)) (meta-widgets (make-hash-table)) (self #f) @@ -391,96 +393,96 @@ (iup:button "Close" #:action (lambda (x)(exit)) #:size "80x")) (apply iup:hbox (list command-text-box command-launch-button)))) (set-fields-panel test-id testdat) - (iup:hbox - (iup:frame - #:title "Test Steps" - (let ((stepsdat ;;(iup:label "Test steps ........................................." - ;; #:expand "YES" - ;; #:size "200x150" - ;; #:alignment "ALEFT:ATOP"))) - (iup:textbox ;; #:action (lambda (obj char val) - ;; #f) - #:expand "YES" - #:multiline "YES" - #:font "Courier New, -10" - #:size "60x100"))) - (hash-table-set! widgets "Test Steps" - (lambda (testdat) - (let* ((currval (iup:attribute stepsdat "VALUE")) ;; "TITLE")) - (fmtstr "~20a~10a~10a~12a~15a~20a") - (comprsteps (open-run-close db:get-steps-table db test-id)) - (newval (string-intersperse - (append - (list - (format #f fmtstr "Stepname" "Start" "End" "Status" "Time" "Logfile") - (format #f fmtstr "========" "=====" "===" "======" "====" "=======")) - (map (lambda (x) - ;; take advantage of the \n on time->string - (format #f fmtstr - (vector-ref x 0) - (let ((s (vector-ref x 1))) - (if (number? s)(seconds->time-string s) s)) - (let ((s (vector-ref x 2))) - (if (number? s)(seconds->time-string s) s)) - (vector-ref x 3) ;; status - (vector-ref x 4) - (vector-ref x 5))) ;; time delta - (sort (hash-table-values comprsteps) - (lambda (a b) - (let ((time-a (vector-ref a 1)) - (time-b (vector-ref b 1))) - (if (and (number? time-a)(number? time-b)) - (if (< time-a time-b) - #t - (if (eq? time-a time-b) - (stringsymbol state) - ((COMPLETED) - (if (equal? status "PASS") - "70 249 73" - (if (or (equal? status "WARN") - (equal? status "WAIVED")) - "255 172 13" - "223 33 49"))) ;; greenish orangeish redish - ((LAUNCHED) "101 123 142") - ((CHECK) "255 100 50") - ((REMOTEHOSTSTART) "50 130 195") - ((RUNNING) "9 131 232") - ((KILLREQ) "39 82 206") - ((KILLED) "234 101 17") - ((NOT_STARTED) "240 240 240") - (else "192 192 192"))) - (define (update-buttons uidat numruns numtests) (if *please-update-buttons* (let* ((runs (if (> (length *allruns*) numruns) (take-right *allruns* numruns) (pad-list *allruns* numruns))) @@ -414,11 +396,11 @@ (teststate (db:test-get-state test)) (teststart (db:test-get-event_time test)) (runtime (db:test-get-run_duration test)) (buttontxt (if (equal? teststate "COMPLETED") teststatus teststate)) (button (vector-ref columndat rown)) - (color (get-color-for-state-status teststate teststatus)) + (color (common:get-color-for-state-status teststate teststatus)) (curr-color (vector-ref buttondat 1)) ;; (iup:attribute button "BGCOLOR")) (curr-title (vector-ref buttondat 2))) ;; (iup:attribute button "TITLE"))) (if (not (equal? curr-color color)) (iup:attribute-set! button "BGCOLOR" color)) (if (not (equal? curr-title buttontxt)) @@ -502,11 +484,11 @@ (iup:toggle status #:action (lambda (obj val) (mark-for-update) (if (eq? val 1) (hash-table-set! *status-ignore-hash* status #t) (hash-table-delete! *status-ignore-hash* status))))) - '("PASS" "FAIL" "WARN" "CHECK" "WAIVED" "STUCK/DEAD" "n/a"))) + '("PASS" "FAIL" "WARN" "CHECK" "WAIVED" "STUCK/DEAD" "n/a" "SKIP"))) (apply iup:hbox (map (lambda (state) (iup:toggle state #:action (lambda (obj val) (mark-for-update) Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -248,14 +248,20 @@ (if (and testpath (directory? testpath) (file-read-access? testpath)) (let* ((dbpath (conc testpath "/testdat.db")) (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)))) + (handle-exceptions + exn + (begin + (debug:print 0 "ERROR: problem accessing test db " testpath ", you probably should clean and re-run this test" + ((condition-property-accessor 'exn 'message) exn)) + #f) + (set! db (sqlite3:open-database dbpath))) (sqlite3:set-busy-handler! db handler) (if (not dbexists) (begin (sqlite3:execute db "PRAGMA synchronous = FULL;") (debug:print-info 11 "Initialized test database " dbpath) @@ -1269,11 +1275,11 @@ (define (cdb:flush-queue serverdat) (cdb:client-call serverdat 'flush #f *default-numtries*)) (define (cdb:kill-server serverdat) - (cdb:client-call serverdat 'killserver #f *default-numtries*)) + (cdb:client-call serverdat 'killserver #t *default-numtries*)) (define (cdb:roll-up-pass-fail-counts serverdat run-id test-name item-path status) (cdb:client-call serverdat 'immediate #f *default-numtries* open-run-close db:roll-up-pass-fail-counts #f run-id test-name item-path status)) (define (cdb:get-test-info serverdat run-id test-name item-path) @@ -1327,11 +1333,12 @@ login immediate flush sync set-verbosity - killserver)) + killserver + )) ;; not used, intended to indicate to run in calling process (define db:run-local-queries '()) ;; rollup-tests-pass-fail)) (define (db:process-cached-writes db) @@ -1422,20 +1429,22 @@ ;; poll for the write to complete, timeout after 10 seconds ;; periodic flushing of the queue is taken care of by ;; db:flush-queue (let loop () - (thread-sleep! 0.1) + (thread-sleep! 0.001) (mutex-lock! *completed-mutex*) (if (hash-table-ref/default *completed-writes* qry-sig #f) (begin (hash-table-delete! *completed-writes* qry-sig) (set! got-it #t))) (mutex-unlock! *completed-mutex*) (if (and (not got-it) (< (current-seconds) timeout)) - (loop))) + (begin + (thread-sleep! 0.01) + (loop)))) (set! *number-of-writes* (+ *number-of-writes* 1)) (set! *writes-total-delay* (+ *writes-total-delay* 1)) got-it)) (define (db:process-queue-item db item) @@ -1460,11 +1469,11 @@ ;; otherwise if appropriate flush the queue (this is a read or complex query) (begin (cond ((member stmt-key db:special-queries) (let ((starttime (current-milliseconds))) - (debug:print-info 11 "Handling special statement " stmt-key) + (debug:print-info 9 "Handling special statement " stmt-key) (case stmt-key ((immediate) ;; This is a read or mixed read-write query, must clear the cache (case *transport-type* ((http) @@ -1523,17 +1532,17 @@ ;; Rollup the pass/fail counts from itemized tests into fail_count and pass_count (define (db:roll-up-pass-fail-counts db run-id test-name item-path status) ;; (cdb:flush-queue *runremote*) (if (and (not (equal? item-path "")) - (member status '("PASS" "WARN" "FAIL" "WAIVED" "RUNNING" "CHECK"))) + (member status '("PASS" "WARN" "FAIL" "WAIVED" "RUNNING" "CHECK" "SKIP"))) (begin (sqlite3:execute db "UPDATE tests SET fail_count=(SELECT count(id) FROM tests WHERE run_id=? AND testname=? AND item_path != '' AND status='FAIL'), - pass_count=(SELECT count(id) FROM tests WHERE run_id=? AND testname=? AND item_path != '' AND (status='PASS' OR status='WARN' OR status='WAIVED')) + pass_count=(SELECT count(id) FROM tests WHERE run_id=? AND testname=? AND item_path != '' AND status IN ('PASS','WARN','WAIVED')) WHERE run_id=? AND testname=? AND item_path='';" run-id test-name run-id test-name run-id test-name) ;; (thread-sleep! 0.1) ;; give other processes a chance here, no, better to be done ASAP? (if (equal? status "RUNNING") ;; running takes priority over all other states, force the test state to RUNNING (sqlite3:execute db "UPDATE tests SET state=? WHERE run_id=? AND testname=? AND item_path='';" "RUNNING" run-id test-name) @@ -1746,10 +1755,70 @@ (for-each (lambda (step) (debug:print 6 "step=" step) (let ((record (hash-table-ref/default res + (db:step-get-stepname step) + ;; stepname start end status Duration Logfile + (vector (db:step-get-stepname step) "" "" "" "" "")))) + (debug:print 6 "record(before) = " record + "\nid: " (db:step-get-id step) + "\nstepname: " (db:step-get-stepname step) + "\nstate: " (db:step-get-state step) + "\nstatus: " (db:step-get-status step) + "\ntime: " (db:step-get-event_time step)) + (case (string->symbol (db:step-get-state step)) + ((start)(vector-set! record 1 (db:step-get-event_time step)) + (vector-set! record 3 (if (equal? (vector-ref record 3) "") + (db:step-get-status step))) + (if (> (string-length (db:step-get-logfile step)) + 0) + (vector-set! record 5 (db:step-get-logfile step)))) + ((end) + (vector-set! record 2 (any->number (db:step-get-event_time step))) + (vector-set! record 3 (db:step-get-status step)) + (vector-set! record 4 (let ((startt (any->number (vector-ref record 1))) + (endt (any->number (vector-ref record 2)))) + (debug:print 4 "record[1]=" (vector-ref record 1) + ", startt=" startt ", endt=" endt + ", get-status: " (db:step-get-status step)) + (if (and (number? startt)(number? endt)) + (seconds->hr-min-sec (- endt startt)) "-1"))) + (if (> (string-length (db:step-get-logfile step)) + 0) + (vector-set! record 5 (db:step-get-logfile step)))) + (else + (vector-set! record 2 (db:step-get-state step)) + (vector-set! record 3 (db:step-get-status step)) + (vector-set! record 4 (db:step-get-event_time step)))) + (hash-table-set! res (db:step-get-stepname step) record) + (debug:print 6 "record(after) = " record + "\nid: " (db:step-get-id step) + "\nstepname: " (db:step-get-stepname step) + "\nstate: " (db:step-get-state step) + "\nstatus: " (db:step-get-status step) + "\ntime: " (db:step-get-event_time step)))) + ;; (else (vector-set! record 1 (db:step-get-event_time step))) + (sort steps (lambda (a b) + (cond + ((< (db:step-get-event_time a)(db:step-get-event_time b)) #t) + ((eq? (db:step-get-event_time a)(db:step-get-event_time b)) + (< (db:step-get-id a) (db:step-get-id b))) + (else #f))))) + res))) + +;; get a pretty table to summarize steps +;; +(define (db:get-steps-table-list db test-id) + (let ((steps (db:get-steps-for-test db test-id))) + ;; organise the steps for better readability + (let ((res (make-hash-table))) + (for-each + (lambda (step) + (debug:print 6 "step=" step) + (let ((record (hash-table-ref/default + res (db:step-get-stepname step) ;; stepname start end status (vector (db:step-get-stepname step) "" "" "" "" "")))) (debug:print 6 "record(before) = " record "\nid: " (db:step-get-id step) @@ -1795,10 +1864,36 @@ ((eq? (db:step-get-event_time a)(db:step-get-event_time b)) (< (db:step-get-id a) (db:step-get-id b))) (else #f))))) res))) +(define (db:get-compressed-steps test-id) + (let* ((comprsteps (open-run-close db:get-steps-table #f test-id))) + (map (lambda (x) + ;; take advantage of the \n on time->string + (vector + (vector-ref x 0) + (let ((s (vector-ref x 1))) + (if (number? s)(seconds->time-string s) s)) + (let ((s (vector-ref x 2))) + (if (number? s)(seconds->time-string s) s)) + (vector-ref x 3) ;; status + (vector-ref x 4) + (vector-ref x 5))) ;; time delta + (sort (hash-table-values comprsteps) + (lambda (a b) + (let ((time-a (vector-ref a 1)) + (time-b (vector-ref b 1))) + (if (and (number? time-a)(number? time-b)) + (if (< time-a time-b) + #t + (if (eq? time-a time-b) + (string.logpro file # diff diff %file1% %file2% Index: docs/megatest-training.odp ================================================================== --- docs/megatest-training.odp +++ docs/megatest-training.odp cannot compute difference between binary files Index: http-transport.scm ================================================================== --- http-transport.scm +++ http-transport.scm @@ -121,21 +121,24 @@ (if (< portnum 9000) (begin (print "WARNING: failed to start on portnum: " portnum ", trying next port") (thread-sleep! 0.1) ;; (open-run-close tasks:remove-server-records tasks:open-db) + (open-run-close tasks:server-delete tasks:open-db ipaddrstr portnum) (http-transport:try-start-server ipaddrstr (+ portnum 1))) (print "ERROR: Tried and tried but could not start the server"))) + ;; any error in following steps will result in a retry (set! *runremote* (list ipaddrstr portnum)) ;; (open-run-close tasks:remove-server-records tasks:open-db) (open-run-close tasks:server-register tasks:open-db (current-process-id) ipaddrstr portnum 0 'live 'http) (print "INFO: Trying to start server on " ipaddrstr ":" portnum) ;; This starts the spiffy server (start-server port: portnum) + (open-run-close tasks:server-delete tasks:open-db ipaddrstr portnum) (print "INFO: server has been stopped"))) ;;====================================================================== ;; S E R V E R U T I L I T I E S ;;====================================================================== @@ -229,10 +232,22 @@ (let () ;; (queue-len (cdb:client-call server-info 'sync #t 1))) ;; (print "Server running, count is " count) (if (< count 1) ;; 3x3 = 9 secs aprox (loop (+ count 1))) + ;; Check that iface and port have not changed (can happen if server port collides) + (mutex-lock! *heartbeat-mutex*) + (set! sdat *runremote*) + (mutex-unlock! *heartbeat-mutex*) + + (if (not (equal? sdat (list iface port))) + (begin + (debug:print-info 1 "interface changed, refreshing iface and port info") + (set! iface (car sdat)) + (set! port (cadr sdat)) + (set! spid (tasks:server-get-server-id tdb #f iface port #f)))) + ;; NOTE: Get rid of this mechanism! It really is not needed... (tasks:server-update-heartbeat tdb spid) ;; (if ;; (or (> numrunning 0) ;; stay alive for two days after last access (mutex-lock! *heartbeat-mutex*) @@ -274,11 +289,12 @@ (if (not (setup-for-run)) (begin (debug:print 0 "ERROR: cannot find megatest.config, exiting") (exit)))) (debug:print-info 2 "Starting the standalone server") - (daemon:ize) + (if (args:get-arg "-daemonize") + (daemon:ize)) (let ((hostinfo (open-run-close tasks:get-best-server tasks:open-db))) (debug:print 11 "http-transport:launch hostinfo=" hostinfo) ;; #(1 "143.182.207.24" 5736 -1 "http" 22771 "hostname") (if hostinfo (debug:print-info 2 "NOT starting new server, one is already running on " (vector-ref hostinfo 1) ":" (vector-ref hostinfo 2)) Index: launch.scm ================================================================== --- launch.scm +++ launch.scm @@ -44,11 +44,11 @@ (and logpro (eq? exitcode 2)))) ;; if handed a string, process it, else look for MT_CMDINFO (define (launch:get-cmdinfo-assoc-list #!key (encoded-cmd #f)) (let ((enccmd (if encoded-cmd encoded-cmd (getenv "MT_CMDINFO")))) - (if enccdm + (if enccmd (read (open-input-string (base64:base64-decode enccmd))) '()))) (define (launch:execute encoded-cmd) (let* ((cmdinfo (read (open-input-string (base64:base64-decode encoded-cmd))))) Index: megatest-version.scm ================================================================== --- megatest-version.scm +++ megatest-version.scm @@ -1,7 +1,7 @@ ;; Always use two digit decimal ;; 1.01, 1.02...1.10,1.11 ... 1.99,2.00.. (declare (unit megatest-version)) -(define megatest-version 1.5405) +(define megatest-version 1.5415) Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -31,20 +31,35 @@ (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") (include "megatest-fossil-hash.scm") -;; (use trace) -;; (trace db:teststep-set-status! -;; tests:test-set-status! -;; cdb:test-set-status-state -;; cdb:client-call -;; tests:check-waiver-eligibility) +;; (use trace dot-locking) +;; (trace +;; cdb:client-call +;; cdb:remote-run +;; cdb:test-set-status-state +;; change-directory +;; db:process-queue-item +;; db:test-get-logfile-info +;; db:teststep-set-status! +;; nice-path +;; obtain-dot-lock +;; open-run-close +;; read-config +;; runs:can-run-more-tests +;; sqlite3:execute +;; sqlite3:for-each-row +;; tests:check-waiver-eligibility +;; tests:summarize-items +;; tests:test-set-status! +;; thread-sleep! +;;) (define help (conc " -Megatest, documentation at http://chiselapp.com/user/kiatoa/repository/megatest +Megatest, documentation at http://www.kiatoa.com/fossils/megatest version " megatest-version " license GPL, Copyright Matt Welland 2006-2012 Usage: megatest [options] -h : this help @@ -113,11 +128,13 @@ -setvars VAR1=val1,VAR2=val2 : Add environment variables to a run NB// these are overwritten by values set in config files. -server -|hostname : start the server (reduces contention on megatest.db), use - to automatically figure out hostname -transport http|zmq : use http or zmq for transport (default is http) + -daemonize : fork into background and disconnect from stdin/out -list-servers : list the servers + -stop-server id : stop server specified by id (see output of -list-servers) -repl : start a repl (useful for extending megatest) -load file.scm : load and run file.scm Spreadsheet generation -extract-ods fname.ods : extract an open document spreadsheet from the database @@ -137,11 +154,10 @@ Called as " (string-intersperse (argv) " ") " Version " megatest-version ", built from " megatest-fossil-hash )) ;; -gui : start a gui interface ;; -config fname : override the runconfig file with fname -;; -kill-server host:port|pid : kill server specified by host:port or pid ;; process args (define remargs (args:get-args (argv) (list "-runtests" ;; run a specific test @@ -177,11 +193,11 @@ ":tol" ":units" ;; misc "-server" "-transport" - "-kill-server" + "-stop-server" "-port" "-extract-ods" "-pathmod" "-env2file" "-setvars" @@ -201,10 +217,11 @@ "-test-status" "-set-values" "-load-test-data" "-summarize-items" "-gui" + "-daemonize" ;; misc "-archive" "-repl" "-lock" "-unlock" @@ -302,31 +319,31 @@ (if (or (not servers) (null? servers)) (begin (debug:print 0 "INFO: Starting server as none running ...") ;; (server:launch (string->symbol (args:get-arg "-transport" "http")))) - (system (conc (car (argv)) " -server - -transport " (args:get-arg "-transport" "http"))) + (system (conc (car (argv)) " -server - -daemonize -transport " (args:get-arg "-transport" "http"))) (thread-sleep! 3)) ;; give the server a few seconds to start (debug:print 0 "INFO: Servers already running " servers) ))))) -(if (args:get-arg "-list-servers") - ;; (args:get-arg "-kill-server")) +(if (or (args:get-arg "-list-servers") + (args:get-arg "-stop-server")) (let ((tl (setup-for-run))) (if tl - (let ((servers (open-run-close tasks:get-all-servers tasks:open-db)) - (fmtstr "~5a~8a~8a~20a~20a~10a~10a~10a~10a~10a\n") - (servers-to-kill '())) + (let* ((servers (open-run-close tasks:get-all-servers tasks:open-db)) + (fmtstr "~5a~8a~8a~20a~20a~10a~10a~10a~10a~10a\n") + (servers-to-kill '()) + (killinfo (args:get-arg "-stop-server")) + (khost-port (if killinfo (if (substring-index ":" killinfo)(string-split ":") #f) #f)) + (sid (if killinfo (if (substring-index ":" killinfo) #f (string->number killinfo)) #f))) (format #t fmtstr "Id" "MTver" "Pid" "Host" "Interface" "OutPort" "InPort" "LastBeat" "State" "Transport") (format #t fmtstr "==" "=====" "===" "====" "=========" "=======" "======" "========" "=====" "=========") (for-each (lambda (server) - (let* (;; (killinfo (args:get-arg "-kill-server")) - ;; (khost-port (if killinfo (if (substring-index ":" killinfo)(string-split ":") #f) #f)) - ;; (kpid (if killinfo (if (substring-index ":" killinfo) #f (string->number killinfo)) #f)) - (id (vector-ref server 0)) + (let* ((id (vector-ref server 0)) (pid (vector-ref server 1)) (hostname (vector-ref server 2)) (interface (vector-ref server 3)) (pullport (vector-ref server 4)) (pubport (vector-ref server 5)) @@ -344,13 +361,16 @@ (if (equal? state "dead") (if (> last-update (* 25 60 60)) ;; keep records around for slighly over a day. (open-run-close tasks:server-deregister tasks:open-db hostname pullport: pullport pid: pid action: 'delete)) (if (> last-update 20) ;; Mark as dead if not updated in last 20 seconds (open-run-close tasks:server-deregister tasks:open-db hostname pullport: pullport pid: pid))) - (format #t fmtstr id mt-ver pid hostname interface pullport pubport last-update - (if status "alive" "dead") transport))) + (if status "alive" "dead") transport) + (if (equal? id sid) + (begin + (debug:print-info 0 "Attempting to stop server with pid " pid) + (tasks:kill-server status hostname pullport pid transport))))) servers) (debug:print-info 1 "Done with listservers") (set! *didsomething* #t) (exit) ;; must do, would have to add checks to many/all calls below ) @@ -393,11 +413,11 @@ (else (debug:print 0 "ERROR: -dumpmode of " (args:get-arg "-dumpmode") " not recognised"))) (set! *didsomething* #t))) (if (args:get-arg "-show-config") - (let ((data (read-config "megatest.config" #f #t))) + (let ((data *configdat*)) ;; (read-config "megatest.config" #f #t))) ;; keep this one local (cond ((not (args:get-arg "-dumpmode")) (pp (hash-table->alist data))) ((string=? (args:get-arg "-dumpmode") "json") Index: runconfig.scm ================================================================== --- runconfig.scm +++ runconfig.scm @@ -1,11 +1,11 @@ ;;====================================================================== ;; read a config file, loading only the section pertinent ;; to this run field1val/field2val/field3val ... ;;====================================================================== -(use format) +(use format directory-utils) (declare (unit runconfig)) (declare (uses common)) (include "common_records.scm") @@ -60,17 +60,19 @@ (debug:print 2 "---") (set! *already-seen-runconfig-info* #t))) finaldat)) (define (set-run-config-vars db run-id keys keyvals) + (push-directory *toppath*) (let ((runconfigf (conc *toppath* "/runconfigs.config")) (targ (or (args:get-arg "-target") (args:get-arg "-reqtarg") (db:get-target db run-id)))) + (pop-directory) (if (file-exists? runconfigf) (setup-env-defaults runconfigf run-id #t keys keyvals environ-patt: (conc "(default" (if targ (conc "|" targ ")") ")"))) (debug:print 0 "WARNING: You do not have a run config file: " runconfigf)))) Index: runs.scm ================================================================== --- runs.scm +++ runs.scm @@ -138,13 +138,13 @@ (if (and mcj (string->number mcj)) (string->number mcj) 1))) (job-group-limit (config-lookup *configdat* "jobgroups" jobgroup))) (if (and (> (+ num-running num-running-in-jobgroup) 0) - (< *runs:can-run-more-tests-delay* 10)) + (< *runs:can-run-more-tests-delay* 1)) (begin - (set! *runs:can-run-more-tests-delay* (+ *runs:can-run-more-tests-delay* 1)) ;; 0.1)) + (set! *runs:can-run-more-tests-delay* (+ *runs:can-run-more-tests-delay* 0.009)) (debug:print-info 14 "can-run-more-tests-delay: " *runs:can-run-more-tests-delay*))) (if (not (eq? *last-num-running-tests* num-running)) (begin (debug:print 2 "max-concurrent-jobs: " max-concurrent-jobs ", num-running: " num-running) (set! *last-num-running-tests* num-running))) @@ -337,11 +337,11 @@ (define (runs:calc-fails prereqs-not-met) (filter (lambda (test) (and (vector? test) ;; not (string? test)) (equal? (db:test-get-state test) "COMPLETED") (not (member (db:test-get-status test) - '("PASS" "WARN" "CHECK" "WAIVED"))))) + '("PASS" "WARN" "CHECK" "WAIVED" "SKIP"))))) prereqs-not-met)) (define (runs:calc-not-completed prereqs-not-met) (filter (lambda (t) @@ -432,34 +432,34 @@ ;; 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-info 1 "Skipping " (tests:testqueue-get-testname test-record) " " item-path " as it doesn't match " test-patts) - (thread-sleep! *global-delta*) + ;; (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-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*) + ;; (thread-sleep! *global-delta*) (runs:shrink-can-run-more-tests-delay) (loop (car newtal)(cdr newtal) reruns)) ((not have-resources) ;; simply try again after waiting a second (debug:print-info 1 "no resources to run new tests, waiting ...") - (thread-sleep! (+ 2 *global-delta*)) + ;; (thread-sleep! (+ 2 *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) (and (eq? testmode 'toplevel) (null? non-completed)))) (run:test run-id runname keyvallst test-record flags #f) (runs:shrink-can-run-more-tests-delay) - (thread-sleep! *global-delta*) + ;; (thread-sleep! *global-delta*) (if (not (null? tal)) (loop (car tal)(cdr tal) reruns))) (else ;; must be we have unmet prerequisites (debug:print 4 "FAILS: " fails) ;; If one or more of the prereqs-not-met are FAIL then we can issue @@ -466,25 +466,25 @@ ;; a message and drop hed from the items to be processed. (if (null? fails) (begin ;; couldn't run, take a breather (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 + ;; (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)) (if (vector? hed) (begin (debug:print 1 "WARN: Dropping test " (db:test-get-testname hed) "/" (db:test-get-item-path hed) " from the launch list as it has prerequistes that are FAIL") (runs:shrink-can-run-more-tests-delay) - (thread-sleep! *global-delta*) + ;; (thread-sleep! *global-delta*) (loop (car tal)(cdr tal) (cons hed reruns))) (begin (debug:print 1 "WARN: Test not processed correctly. Could be a race condition in your test implementation? " hed) ;; " as it has prerequistes that are FAIL. (NOTE: hed is not a vector)") (runs:shrink-can-run-more-tests-delay) - (thread-sleep! (+ 0.01 *global-delta*)) + ;; (thread-sleep! (+ 0.01 *global-delta*)) (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 @@ -507,11 +507,11 @@ (set! tal (cons newtestname tal)))))) ;; since these are itemized create new test names testname/itempath items) (if (not (null? tal)) (begin (debug:print-info 4 "End of items list, looping with next after short delay") - (thread-sleep! (+ 0.01 *global-delta*)) + ;; (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 ((or (procedure? items)(eq? items 'have-procedure)) @@ -545,11 +545,11 @@ (set-megatest-env-vars run-id) ;; these may be needed by the launching process (let ((items-list (items:get-items-from-config tconfig))) (if (list? items-list) (begin (tests:testqueue-set-items! test-record items-list) - (thread-sleep! *global-delta*) + ;; (thread-sleep! *global-delta*) (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) @@ -569,21 +569,21 @@ (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*) + ;; (thread-sleep! *global-delta*) (loop (car tal)(cdr tal)(cons hed reruns))))) (else (debug:print 8 "ERROR: No handler for this condition.") (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-info 4 "processing the case with a lambda for items or 'have-procedure. Moving through the queue without dropping " hed) - (thread-sleep! (+ 2 *global-delta*)) + ;; (thread-sleep! (+ 2 *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) (debug:print 0 "ERROR: Should not have a list of items in a test and the itemspath set - please report this") @@ -593,11 +593,11 @@ (junked (lset-difference equal? tal newlst))) (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*)) + ;; (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-info 4 "I'm pretty sure I shouldn't get here.")) @@ -691,11 +691,11 @@ ((member (test:get-state testdat) '("DELETED" "NOT_STARTED"))(set! runflag #t)) ;; not -rerun and PASS, WARN or CHECK, do no run ((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")) + (or (member (test:get-status testdat) '("PASS" "WARN" "CHECK" "SKIP")) (member (test:get-state testdat) '("COMPLETED")))) (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 Index: server.scm ================================================================== --- server.scm +++ server.scm @@ -74,16 +74,16 @@ (let loop () (let ((last-write-flush-time #f)) (mutex-lock! *incoming-mutex*) (set! last-write-flush-time *server:last-write-flush*) (mutex-unlock! *incoming-mutex*) - (if (> (- (current-milliseconds) last-write-flush-time) 400) + (if (> (- (current-milliseconds) last-write-flush-time) 10) (begin (mutex-lock! *db:process-queue-mutex*) (db:process-cached-writes db) (mutex-unlock! *db:process-queue-mutex*) - (thread-sleep! 0.5)))) + (thread-sleep! 0.005)))) (loop))) (begin (debug:print 0 "ERROR: failed to setup for Megatest in server:write-queue-handler") (exit 1)))) Index: tasks.scm ================================================================== --- tasks.scm +++ tasks.scm @@ -23,18 +23,10 @@ ;;====================================================================== (define (tasks:open-db) (let* ((dbpath (conc *toppath* "/monitor.db")) (exists (file-exists? dbpath)) - ;; ;; BUGGISHNESS: Remove this code in six months. Today is 11/13/2012 - ;; (if (< (file-change-time dbpath) 1352851396.0) - ;; (begin - ;; (debug:print 0 "NOTE: removing old db file " dbpath) - ;; (delete-file dbpath) - ;; #f) - ;; #t) - ;; #f)) (mdb (sqlite3:open-database dbpath)) ;; (never-give-up-open-db dbpath)) (handler (make-busy-timeout 36000))) (sqlite3:set-busy-handler! mdb handler) (sqlite3:execute mdb (conc "PRAGMA synchronous = 0;")) (if (not exists) @@ -125,10 +117,14 @@ (else (sqlite3:execute mdb "UPDATE servers SET state='dead' WHERE hostname=? AND port=?;" hostname port))) (debug:print 0 "ERROR: tasks:server-deregister called with neither pid nor port specified")))) (define (tasks:server-deregister-self mdb hostname) (tasks:server-deregister mdb hostname pid: (current-process-id))) + +;; need a simple call for robustly removing records given host and port +(define (tasks:server-delete mdb hostname port) + (tasks:server-deregister mdb hostname port: port action: 'delete)) (define (tasks:server-get-server-id mdb hostname iface port pid) (debug:print-info 12 "tasks:server-get-server-id " mdb " " hostname " " iface " " port " " pid) (let ((res #f)) (sqlite3:for-each-row @@ -229,17 +225,17 @@ ;; (loop (car tal)(cdr tal)))))))))) (define (tasks:remove-server-records mdb) (sqlite3:execute mdb "DELETE FROM servers;")) -(define (tasks:mark-server hostname port pid state) +(define (tasks:mark-server hostname port pid state transport) (if port (open-run-close tasks:server-deregister tasks:open-db hostname port: port) (open-run-close tasks:server-deregister tasks:open-db hostname pid: pid))) -(define (tasks:kill-server status hostname port pid) +(define (tasks:kill-server status hostname port pid transport) (debug:print-info 1 "Removing defunct server record for " hostname ":" port) (if port (open-run-close tasks:server-deregister tasks:open-db hostname port: port) (open-run-close tasks:server-deregister tasks:open-db hostname pid: pid)) (if status ;; #t means alive @@ -250,14 +246,20 @@ (debug:print-info 0 "server may or may not be dead, check for megatest -server running as pid " pid "\n" " EXCEPTION: " ((condition-property-accessor 'exn 'message) exn)) (debug:print 1 "Sending signal/term to " pid " on " hostname) (process-signal pid signal/term) (thread-sleep! 5) ;; give it five seconds to die peacefully then do a brutal kill - (process-signal pid signal/kill)) ;; local machine, send sig term + ;;(process-signal pid signal/kill) + ) ;; local machine, send sig term (begin - (debug:print-info 1 "Telling alive server on " hostname ":" port " to commit servercide") - (cdb:kill-server zmq-socket)))) ;; remote machine, try telling server to commit suicide + (debug:print-info 1 "Stopping remote servers not yet supported.")))) + ;; (debug:print-info 1 "Telling alive server on " hostname ":" port " to commit servercide") + ;; (let ((serverdat (list hostname port))) + ;; (case (string->symbol transport) + ;; ((http)(http-transport:client-connect hostname port)) + ;; (else (debug:print "ERROR: remote stopping servers of type " transport " not supported yet"))) + ;; (cdb:kill-server serverdat))))) ;; remote machine, try telling server to commit suicide (begin (if status (if (equal? hostname (get-host-name)) (begin (debug:print-info 1 "Sending signal/term to " pid " on " hostname) Index: tests.scm ================================================================== --- tests.scm +++ tests.scm @@ -352,18 +352,17 @@ (orig-dir (current-directory)) (logf-info (cdb:remote-run db:test-get-logfile-info #f run-id test-name)) (logf (if logf-info (cadr logf-info) #f)) (path (if logf-info (car logf-info) #f))) ;; This query finds the path and changes the directory to it for the test - (set! logf (car logf-info)) (if (directory? path) (begin (debug:print 4 "Found path: " path) (change-directory path)) ;; (set! outputfilename (conc path "/" outputfilename))) (print "No such path: " path)) - (debug:print 1 "summarize-items with logf " logf) + (debug:print 4 "summarize-items with logf " logf ", outputfilename " outputfilename " and force " force) (if (or (equal? logf "logs/final.log") (equal? logf outputfilename) force) (begin (if (obtain-dot-lock outputfilename 1 20 30) ;; retry every second for 20 seconds, call it dead after 30 seconds and steal the lock @@ -510,11 +509,11 @@ (tdat (cdb:get-test-info-by-id *runremote* test-id))) (if tdat (begin ;; Look at the test state and status (if (or (member (db:test-get-status tdat) - '("PASS" "WARN" "WAIVED" "CHECK")) + '("PASS" "WARN" "WAIVED" "CHECK" "SKIP")) (member (db:test-get-state tdat) '("INCOMPLETE" "KILLED"))) (set! keep-test #f)) ;; examine waitons for any fails. If it is FAIL or INCOMPLETE then eliminate this test Index: tests/Makefile ================================================================== --- tests/Makefile +++ tests/Makefile @@ -13,12 +13,12 @@ OS = $(shell grep ID /etc/*-release|cut -d= -f2) FS = $(shell df -T .|tail -1|awk '{print $$2}') VER = $(shell fsl info|grep checkout|awk '{print $$2}'|cut -c 1-5) # The NEWTARGET causes some tests to fail. Do not use until this is fixed. -NEWTARGET = "-target $(OS)/$(FS)/$(VER)" -TARGET = "-target ubuntu/nfs/none" +NEWTARGET = "$(OS)/$(FS)/$(VER)" +TARGET = "ubuntu/nfs/none" all : test1 test2 test3 test4 test5 server : (cd ..;make;make install) && \ @@ -34,11 +34,11 @@ cd simplerun;cp ../../*_records.scm .;perl -pi.bak -e 's/define-inline/define/' *_records.scm cd simplerun;echo '(load "../tests.scm")' | $(MEGATEST) -repl -debug $(DEBUG) test2 : fullprep cd fullrun;$(MEGATEST) -runtests ez_pass,runfirst/a/% -reqtarg ubuntu/nfs/none :runname $(RUNNAME) -debug $(DEBUG) $(LOGGING) - cd fullrun;megatest -runall -target ubuntu/nfs/none :runname $(RUNNAME)_01 -testpatt %/,%/ai -debug $(DEBUG) + cd fullrun;megatest -runtests % -target ubuntu/nfs/none :runname $(RUNNAME)_01 -testpatt %/,%/ai -debug $(DEBUG) cd fullrun;megatest -runtests %/,%/ai -target ubuntu/nfs/none :runname $(RUNAME)_02 -debug $(DEBUG) cd fullrun;megatest -runtests runfirst/%,%/ai -target ubuntu/nfs/none :runname $(RUNNAME)_02 -debug $(DEBUG) cd fullrun;megatest -runtests %/,%/winter -target ubuntu/nfs/none :runname $(RUNNAME)_03 -debug $(DEBUG) sleep 40;cd fullrun;megatest -target ubuntu/nfs/none :runname $(RUNNAME) -set-state-status COMPLETED,FORCED :state COMPLETED :status PASS -testpatt ez_p%s,runfirst/ -debug $(DEBUG) $(LOGGING) @@ -49,16 +49,16 @@ test4 : fullprep cd fullrun;$(MEGATEST) -debug $(DEBUG) -runall -reqtarg ubuntu/nfs/none :runname $(RUNNAME)_b -m "This is a comment specific to a run" -v $(LOGGING) # NOTE: Only one instance can be a server test5 : fullprep - cd fullrun;sleep 0;$(MEGATEST) -runall $(TARGET) :runname $(RUNNAME)_aa -debug $(DEBUG) $(LOGGING) > aa.log 2> aa.log & - cd fullrun;sleep 10;$(MEGATEST) -runall $(TARGET) :runname $(RUNNAME)_ab -debug $(DEBUG) $(LOGGING) > ab.log 2> ab.log & - cd fullrun;sleep 10;$(MEGATEST) -runall $(TARGET) :runname $(RUNNAME)_ac -debug $(DEBUG) $(LOGGING) > ac.log 2> ac.log & - cd fullrun;sleep 10;$(MEGATEST) -runall $(TARGET) :runname $(RUNNAME)_ad -debug $(DEBUG) $(LOGGING) > ad.log 2> ad.log & - # cd fullrun;sleep 10;$(MEGATEST) -runall $(TARGET) :runname $(RUNNAME)_ae -debug $(DEBUG) $(LOGGING) > ae.log 2> ae.log & - # cd fullrun;sleep 10;$(MEGATEST) -runall $(TARGET) :runname $(RUNNAME)_af -debug $(DEBUG) $(LOGGING) > af.log 2> af.log & + cd fullrun;sleep 0;$(MEGATEST) -runtests % -target $(TARGET) :runname $(RUNNAME)_aa -debug $(DEBUG) $(LOGGING) > aa.log 2> aa.log & + cd fullrun;sleep 10;$(MEGATEST) -runtests % -target $(TARGET) :runname $(RUNNAME)_ab -debug $(DEBUG) $(LOGGING) > ab.log 2> ab.log & + cd fullrun;sleep 10;$(MEGATEST) -runtests % -target $(TARGET) :runname $(RUNNAME)_ac -debug $(DEBUG) $(LOGGING) > ac.log 2> ac.log & + cd fullrun;sleep 10;$(MEGATEST) -runtests % -target $(TARGET) :runname $(RUNNAME)_ad -debug $(DEBUG) $(LOGGING) > ad.log 2> ad.log & +# cd fullrun;sleep 10;$(MEGATEST) -runtests % -target $(TARGET) :runname $(RUNNAME)_ae -debug $(DEBUG) $(LOGGING) > ae.log 2> ae.log & +# cd fullrun;sleep 10;$(MEGATEST) -runtests % -target $(TARGET) :runname $(RUNNAME)_af -debug $(DEBUG) $(LOGGING) > af.log 2> af.log & test6: fullprep cd fullrun;$(MEGATEST) -runtests runfirst -testpatt %/1 -reqtarg ubuntu/nfs/none :runname $(RUNNAME)_itempatt -v cd fullrun;$(MEGATEST) -runtests runfirst -testpatt %blahha% -reqtarg ubuntu/nfs/none :runname $(RUNNAME)_itempatt -debug 10 cd fullrun;$(MEGATEST) -rollup :runname newrun -target ubuntu/nfs/none -debug 10 ADDED tests/fdktestqa/fdk.config Index: tests/fdktestqa/fdk.config ================================================================== --- /dev/null +++ tests/fdktestqa/fdk.config @@ -0,0 +1,12 @@ +[fields] +SYSTEM TEXT +RELEASE TEXT + +[setup] +# Adjust max_concurrent_jobs to limit how much you load your machines +max_concurrent_jobs 500 + +# This is your link path, you can move it but it is generally better to keep it stable +linktree #{shell readlink -f #{getenv PWD}/../simplelinks} + +[include testqa/configs/megatest.abc.config] ADDED tests/fdktestqa/testqa/configs/megatest.abc.config Index: tests/fdktestqa/testqa/configs/megatest.abc.config ================================================================== --- /dev/null +++ tests/fdktestqa/testqa/configs/megatest.abc.config @@ -0,0 +1,10 @@ +# Valid values for state and status for steps, NB// It is not recommended you use this +[validvalues] +state start end completed + +# Job tools are more advanced ways to control how your jobs are launched +[jobtools] +useshell yes +launcher nbfake + +[include megatest.def.config] ADDED tests/fdktestqa/testqa/configs/megatest.def.config Index: tests/fdktestqa/testqa/configs/megatest.def.config ================================================================== --- /dev/null +++ tests/fdktestqa/testqa/configs/megatest.def.config @@ -0,0 +1,8 @@ +# You can override environment variables for all your tests here +[env-override] +EXAMPLE_VAR example value + +# As you run more tests you may need to add additional disks, the names are arbitrary but must be unique +[disks] +disk0 #{scheme (nice-path "#{getenv PWD}/../simpleruns")} + ADDED tests/fdktestqa/testqa/megatest.config Index: tests/fdktestqa/testqa/megatest.config ================================================================== --- /dev/null +++ tests/fdktestqa/testqa/megatest.config @@ -0,0 +1,5 @@ +[setup] +testcopycmd cp --remove-destination -rlv TEST_SRC_PATH/. TEST_TARG_PATH/. + +[include ../fdk.config] + ADDED tests/fdktestqa/testqa/runconfigs.config Index: tests/fdktestqa/testqa/runconfigs.config ================================================================== --- /dev/null +++ tests/fdktestqa/testqa/runconfigs.config @@ -0,0 +1,6 @@ +[default] +ALLTESTS see this variable + +# Your variables here are grouped by targets [SYSTEM/RELEASE] +[SYSTEM_val/RELEASE_val] +ANOTHERVAR only defined if target is SYSTEM_val/RELEASE_val ADDED tests/fdktestqa/testqa/tests/bigrun/step1.sh Index: tests/fdktestqa/testqa/tests/bigrun/step1.sh ================================================================== --- /dev/null +++ tests/fdktestqa/testqa/tests/bigrun/step1.sh @@ -0,0 +1,3 @@ +#!/bin/sh +sleep 10 +exit 0 ADDED tests/fdktestqa/testqa/tests/bigrun/testconfig Index: tests/fdktestqa/testqa/tests/bigrun/testconfig ================================================================== --- /dev/null +++ tests/fdktestqa/testqa/tests/bigrun/testconfig @@ -0,0 +1,20 @@ +# Add additional steps here. Format is "stepname script" +[ezsteps] +step1 step1.sh + +# Test requirements are specified here +[requirements] +# waiton setup +priority 0 + +# Iteration for your tests are controlled by the items section +[items] +NUMBER #{scheme (string-intersperse (map number->string (sort (let loop ((a 0)(res '()))(if (< a 120)(loop (+ a 1)(cons a res)) res)) >)) " ")} + +# test_meta is a section for storing additional data on your test +[test_meta] +author matt +owner matt +description An example test +tags tagone,tagtwo +reviewed never Index: tests/fullrun/megatest.config ================================================================== --- tests/fullrun/megatest.config +++ tests/fullrun/megatest.config @@ -6,11 +6,11 @@ # refareas can be searched to find previous runs # the path points to where megatest.db exists [refareas] area1 /tmp/oldarea/megatest -[include #{getenv MT_RUN_AREA_HOME}/config/mt_include_1.config] +[include config/mt_include_1.config] [setup] # It is possible (but not recommended) to override the rsync command used # to populate the test directories. For test development the following @@ -18,11 +18,11 @@ # testcopycmd cp --remove-destination -rsv TEST_SRC_PATH/. TEST_TARG_PATH/. # or for hard links -# testcopycmd cp --remove-destination -rlv TEST_SRC_PATH/ TEST_TARG_PATH/ +# testcopycmd cp --remove-destination -rlv TEST_SRC_PATH/. TEST_TARG_PATH/. # FULL or 2, NORMAL or 1, OFF or 0 synchronous OFF # Throttle roughly scales the db access milliseconds to seconds delay throttle 0.2 @@ -57,11 +57,11 @@ [server] # If the server can't be started on this port it will try the next port until # it succeeds -port 8090 +port 8080 # This server will keep running this number of hours after last access. # Three minutes is 0.05 hours timeout 0.05