Index: common.scm ================================================================== --- common.scm +++ common.scm @@ -643,13 +643,10 @@ ;; dot-locking egg seems not to work, using this for now ;; if lock is older than expire-time then remove it and try again ;; to get the lock ;; (define (common:simple-file-lock fname #!key (expire-time 300)) -; (handle-exceptions -; exn -; #f ;; don't really care what went wrong right now. NOTE: I have not seen this one actually fail. (if (common:file-exists? fname) (if (> (- (current-seconds)(file-modification-time fname)) expire-time) (begin (delete-file* fname) (common:simple-file-lock fname expire-time: expire-time)) @@ -658,16 +655,16 @@ (with-output-to-file fname (lambda () (print key-string))) (thread-sleep! 0.25) (if (common:file-exists? fname) - (with-input-from-file fname - (lambda () - (equal? key-string (read-line)))) - #f))) -; ) - ) + (handle-exceptions exn + #f + (with-input-from-file fname + (lambda () + (equal? key-string (read-line))))) + #f)))) (define (common:simple-file-lock-and-wait fname #!key (expire-time 300)) (let ((end-time (+ expire-time (current-seconds)))) (let loop ((got-lock (common:simple-file-lock fname expire-time: expire-time))) (if got-lock Index: megatest-version.scm ================================================================== --- megatest-version.scm +++ megatest-version.scm @@ -18,6 +18,6 @@ ;; Always use two or four digit decimal ;; 1.01, 1.02...1.10,1.11,1.1101 ... 1.99,2.00.. (declare (unit megatest-version)) -(define megatest-version 1.6533) +(define megatest-version 1.6534) Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -641,13 +641,11 @@ ;; handle a clean-cache request as early as possible ;; (if (args:get-arg "-clean-cache") (let ((toppath (launch:setup))) (set! *didsomething* #t) ;; suppress the help output. - (runs:clean-cache (or (getenv "MT_TARGET") - (args:get-arg "-target") - (args:get-arg "-remtarg")) + (runs:clean-cache (common:args-get-target) (args:get-arg "-runname") toppath))) (if (args:get-arg "-env2file") (begin @@ -1083,11 +1081,11 @@ (lambda (target runname keys keyvals) (operate-on 'kill-runs mode: #f) ))) (if (args:get-arg "-kill-rerun") - (let* ((target-patt (args:get-arg "-target")) + (let* ((target-patt (common:args-get-target)) (runname-patt (args:get-arg "-runname"))) (cond ((not target-patt) (debug:print-error 0 *default-log-port* "Missing target, must specify target for -kill-rerun with -target ") (exit 1)) ((not runname-patt) @@ -1826,11 +1824,12 @@ (db-host (assoc/default 'db-host cmdinfo)) (run-id (assoc/default 'run-id cmdinfo)) (itemdat (assoc/default 'itemdat cmdinfo)) (state (args:get-arg ":state")) (status (args:get-arg ":status")) - (target (args:get-arg "-target")) + ;;(target (args:get-arg "-target")) + (target (common:args-get-target)) (toppath (assoc/default 'toppath cmdinfo))) (change-directory toppath) (if (not target) (begin (debug:print-error 0 *default-log-port* "-target is required.") Index: tests/unittests/all-rmt.scm ================================================================== --- tests/unittests/all-rmt.scm +++ tests/unittests/all-rmt.scm @@ -59,12 +59,11 @@ (test #f #t (list? (rmt:get-changed-record-ids 0))) (test #f #f (begin (runs:update-all-test_meta #f) #f)) -(test #f '("test1" "test2")(sort (alist-ref "tagtwo" (hash-table->alist (rmt:get-tests-tags)) equal?) string<=)) - +(test #f '("test1" "test2")(sort (alist-ref "tagtwo" (rmt:get-tests-tags) equal?) string<=)) (test #f '() (rmt:get-key-val-pairs 0)) (test #f '("SYSTEM" "RELEASE") (rmt:get-keys)) (test #f '("SYSTEM" "RELEASE") (rmt:get-keys-write)) ;; dummy query to force server start (test #f '() (rmt:get-key-vals 1)) (test #f (vector '("SYSTEM" "RELEASE") '()) (rmt:get-targets)) @@ -129,10 +128,25 @@ ;; (print "rmt:get-runs-by-patt returned: " res) (and (vector? res) (let ((rows (vector-ref res 1))) (> (length rows) 0)))))) + +(test #f '(("Totals" "UNKNOWN" 1) ("bar" "UNKNOWN" 1)) (begin (rmt:get-run-stats))) +(test #f #t (begin (rmt:set-run-state-status 1 "COMPLETE" "PASS") #t)) +(test #f '"COMPLETE" (rmt:get-run-state 1)) +(test #f '"PASS" (rmt:get-run-status 1)) +(test #f #t (begin (rmt:set-var "foo" "bar")#t)) +(test #f "bar" (rmt:get-var "foo")) +(test #f #t (begin (rmt:print-db-stats) #t)) +(test #f #t (begin (rmt:del-var "foo") #t)) +(test #f #f (rmt:get-var "foo")) +(test #f (vector #f #f #f #f #f #f #f #f #f #f #f #f) (rmt:get-data-info-by-id 1)) +(test #f '() (rmt:get-key-vals 1)) +(test #f "ubuntu/v1.234" (rmt:get-target 1)) +(print (rmt:get-run-info 1)) +(test #f '((runs) (tests) (test_steps) (test_data)) (rmt:get-run-record-ids "ubuntu/v1.234" 1 '("fail_count") "bar")) ;; (rmt:find-and-mark-incomplete run-id ovr-deadtime) ;; (rmt:get-main-run-stats run-id) ;; (rmt:get-var varname) ;; (rmt:set-var varname value) ;; (rmt:find-and-mark-incomplete-all-runs #!key (ovr-deadtime #f))