@@ -352,14 +352,14 @@ #f)))))) (pop-directory) result))))) ;; Do not rpc this one, do the underlying calls!!! -(define (tests:test-set-status! run-id test-id state status comment dat #!key (work-area #f)) +(define (tests:test-set-status! area-dat run-id test-id state status comment dat #!key (work-area #f)) (let* ((real-status status) (otherdat (if dat dat (make-hash-table))) - (testdat (rmt:get-test-info-by-id run-id test-id)) + (testdat (rmt:get-test-info-by-id area-dat run-id test-id)) (test-name (db:test-get-testname testdat)) (item-path (db:test-get-item-path testdat)) ;; before proceeding we must find out if the previous test (where all keys matched except runname) ;; was WAIVED if this test is FAIL @@ -366,11 +366,11 @@ ;; NOTES: ;; 1. Is the call to test:get-previous-run-record remotified? ;; 2. Add test for testconfig waiver propagation control here ;; (prev-test (if (equal? status "FAIL") - (rmt:get-previous-test-run-record run-id test-name item-path) + (rmt:get-previous-test-run-record area-dat run-id test-name item-path) #f)) (waived (if prev-test (if prev-test ;; true if we found a previous test in this run series (let ((prev-status (db:test-get-status prev-test)) (prev-state (db:test-get-state prev-test)) @@ -391,18 +391,18 @@ (debug:print 4 *default-log-port* "real-status " real-status ", waived " waived ", status " status) ;; update the primary record IF state AND status are defined (if (and state status) (begin - (rmt:set-state-status-and-roll-up-items run-id test-id item-path state real-status (if waived waived comment)) + (rmt:set-state-status-and-roll-up-items area-dat run-id test-id item-path state real-status (if waived waived comment)) ;; (mt:process-triggers run-id test-id state real-status) ;; triggers are called in test-set-state-status )) ;; if status is "AUTO" then call rollup (note, this one modifies data in test ;; run area, it does remote calls under the hood. ;; (if (and test-id state status (equal? status "AUTO")) - ;; (rmt:test-data-rollup run-id test-id status)) + ;; (rmt:test-data-rollup area-dat run-id test-id status)) ;; add metadata (need to do this way to avoid SQL injection issues) ;; :first_err ;; (let ((val (hash-table-ref/default otherdat ":first_err" #f))) @@ -433,33 +433,33 @@ tol "," units "," dcomment ",," ;; extra comma for status type ))) ;; This was run remote, don't think that makes sense. Perhaps not, but that is the easiest path for the moment. - (rmt:csv->test-data run-id test-id + (rmt:csv->test-data area-dat run-id test-id dat)))) ;; need to update the top test record if PASS or FAIL and this is a subtest ;;;;;; (if (not (equal? item-path "")) - ;;;;;; (rmt:set-state-status-and-roll-up-items run-id test-name item-path state status #f) ;;;;;) + ;;;;;; (rmt:set-state-status-and-roll-up-items area-dat run-id test-name item-path state status #f) ;;;;;) (if (or (and (string? comment) (string-match (regexp "\\S+") comment)) waived) (let ((cmt (if waived waived comment))) - (rmt:general-call 'set-test-comment run-id cmt test-id))))) + (rmt:general-call area-dat 'set-test-comment run-id cmt test-id))))) -(define (tests:test-set-toplog! run-id test-name logf) - (rmt:general-call 'tests:test-set-toplog run-id logf run-id test-name)) +(define (tests:test-set-toplog! area-dat run-id test-name logf) + (rmt:general-call area-dat 'tests:test-set-toplog run-id logf run-id test-name)) -(define (tests:summarize-items run-id test-id test-name force) +(define (tests:summarize-items area-dat run-id test-id test-name force) ;; if not force then only update the record if one of these is true: ;; 1. logf is "log/final.log ;; 2. logf is same as outputfilename (let* ((outputfilename (conc "megatest-rollup-" test-name ".html")) (orig-dir (current-directory)) - (logf-info (rmt:test-get-logfile-info run-id test-name)) + (logf-info (rmt:test-get-logfile-info area-dat 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 (if (and (string? path) (directory? path)) ;; can get #f here under some wierd conditions. why, unknown ... @@ -476,33 +476,33 @@ (lockf (conc outputfilename ".lock"))) (let loop ((have-lock (common:simple-file-lock lockf))) (if have-lock (let ((script (configf:lookup *configdat* "testrollup" test-name))) (print "Obtained lock for " outputfilename) - (rmt:set-state-status-and-roll-up-items run-id test-name "" #f #f #f) + (rmt:set-state-status-and-roll-up-items area-dat run-id test-name "" #f #f #f) (if script (system (conc script " > " outputfilename " & ")) - (tests:generate-html-summary-for-iterated-test run-id test-id test-name outputfilename)) + (tests:generate-html-summary-for-iterated-test area-dat run-id test-id test-name outputfilename)) (common:simple-file-release-lock lockf) (change-directory orig-dir) ;; NB// tests:test-set-toplog! is remote internal... - (tests:test-set-toplog! run-id test-name outputfilename)) + (tests:test-set-toplog! area-dat run-id test-name outputfilename)) ;; didn't get the lock, check to see if current update started later than this ;; update, if so we can exit without doing any work (if (> my-start-time (file-modification-time lockf)) ;; we started since current re-gen in flight, delay a little and try again (begin (debug:print-info 1 *default-log-port* "Waiting to update " outputfilename ", another test currently updating it") (thread-sleep! (+ 5 (random 5))) ;; delay between 5 and 10 seconds (loop (common:simple-file-lock lockf)))))))))) -(define (tests:generate-html-summary-for-iterated-test run-id test-id test-name outputfilename) +(define (tests:generate-html-summary-for-iterated-test area-dat run-id test-id test-name outputfilename) (let ((counts (make-hash-table)) (statecounts (make-hash-table)) (outtxt "") (tot 0) - (testdat (rmt:test-get-records-for-index-file run-id test-name))) + (testdat (rmt:test-get-records-for-index-file area-dat run-id test-name))) (with-output-to-file outputfilename (lambda () (set! outtxt (conc outtxt "Summary: " test-name "

Summary for " test-name "

")) (for-each @@ -555,11 +555,11 @@ (print "" "" outtxt "
ItemStateStatusComment
") ;; (release-dot-lock outputfilename) - ;;(rmt:update-run-stats + ;;(rmt:update-run-stats area-dat ;; run-id ;; (hash-table-map ;; state-status-counts ;; (lambda (key val) ;; (append key (list val))))) @@ -666,17 +666,17 @@ (define (tests:run-record->test-path run numkeys) (append (take (vector->list run) numkeys) (list (vector-ref run (+ 1 numkeys))))) -(define (tests:get-rest-data runs header numkeys) +(define (tests:get-rest-data area-dat runs header numkeys) (let ((resh (make-hash-table))) (for-each (lambda (run) (let* ((run-id (db:get-value-by-header run header "id")) (run-dir (tests:run-record->test-path run numkeys)) - (test-data (rmt:get-tests-for-run + (test-data (rmt:get-tests-for-run area-dat run-id "%" ;; testnamepatt '() ;; states '() ;; statuses #f ;; offset @@ -703,30 +703,30 @@ runs) resh)) ;; (tests:create-html-tree "test-index.html") ;; -(define (tests:create-html-tree outf) +(define (tests:create-html-tree area-dat outf) (let* ((lockfile (conc outf ".lock")) (runs-to-process '()) (linktree (common:get-linktree)) (area-name (common:get-testsuite-name)) - (keys (rmt:get-keys)) + (keys (rmt:get-keys area-dat)) (numkeys (length keys)) - (total-runs (rmt:get-num-runs "%")) + (total-runs (rmt:get-num-runs area-dat "%")) (pg-size 10) ) (if (common:simple-file-lock lockfile) (begin (print total-runs) (let loop ((page 0)) (let* ((oup (open-output-file (or outf (conc linktree "/page" page ".html")))) (start (* page pg-size)) - (runsdat (rmt:get-runs "%" pg-size start (map (lambda (x)(list x "%")) keys))) + (runsdat (rmt:get-runs area-dat "%" pg-size start (map (lambda (x)(list x "%")) keys))) (header (vector-ref runsdat 0)) (runs (vector-ref runsdat 1)) (ctr 0) - (test-runs-hash (tests:get-rest-data runs header numkeys)) + (test-runs-hash (tests:get-rest-data area-dat runs header numkeys)) (test-list (hash-table-keys test-runs-hash)) (get-prev-links (lambda (page linktree ) (let* ((link (if (not (eq? page 0)) (s:a "<<prev" 'href (conc linktree "/page" (- page 1) ".html")) (s:a "" 'href (conc linktree "/page" page ".html"))))) @@ -798,20 +798,20 @@ -(define (tests:create-html-tree-old outf) +(define (tests:create-html-tree-old area-dat outf) (let* ((lockfile (conc outf ".lock")) (runs-to-process '())) (if (common:simple-file-lock lockfile) (let* ((linktree (common:get-linktree)) (oup (open-output-file (or outf (conc linktree "/runs-index.html")))) (area-name (common:get-testsuite-name)) - (keys (rmt:get-keys)) + (keys (rmt:get-keys area-dat)) (numkeys (length keys)) - (runsdat (rmt:get-runs "%" #f #f (map (lambda (x)(list x "%")) keys))) + (runsdat (rmt:get-runs area-dat "%" #f #f (map (lambda (x)(list x "%")) keys))) (header (vector-ref runsdat 0)) (runs (vector-ref runsdat 1)) (runtreedat (map (lambda (x) (tests:run-record->test-path x numkeys)) runs)) @@ -846,11 +846,11 @@ (for-each (lambda (run) (let* ((test-subpath (tests:run-record->test-path run numkeys)) (run-id (db:get-value-by-header run header "id")) (run-dir (tests:run-record->test-path run numkeys)) - (test-dats (rmt:get-tests-for-run + (test-dats (rmt:get-tests-for-run area-dat run-id "%/" ;; testnamepatt '() ;; states '() ;; statuses #f ;; offset @@ -905,13 +905,13 @@ std-file)) (run-name (car (reverse p)))) (if (and (not (file-exists? full-targ)) (directory? full-targ) (file-write-access? full-targ)) - (tests:summarize-test + (tests:summarize-test area-dat run-id - (rmt:get-test-id run-id test-name item-path))) + (rmt:get-test-id area-dat run-id test-name item-path))) (if (file-exists? full-targ) (s:a run-name 'href html-file) (begin (debug:print 0 *default-log-port* "ERROR: can't access " full-targ) (conc "No summary for " run-name))))) @@ -994,12 +994,12 @@ (else #f))))) res)) ;; ;; -(define (tests:get-compressed-steps run-id test-id) - (let* ((steps-data (rmt:get-steps-for-test run-id test-id)) +(define (tests:get-compressed-steps area-dat run-id test-id) + (let* ((steps-data (rmt:get-steps-for-test area-dat run-id test-id)) (comprsteps (tests:process-steps-table steps-data))) ;; (open-run-close db:get-steps-table #f test-id work-area: work-area))) (map (lambda (x) ;; take advantage of the \n on time->string (vector (vector-ref x 0) @@ -1025,21 +1025,21 @@ (stringlist exn))