Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -230,10 +230,17 @@ db "SELECT id,run_id,testname,state,status,event_time,host,cpuload,diskfree,uname,rundir,item_path,run_duration,final_logf,comment FROM tests WHERE run_id=? AND testname=? AND item_path=?;" run-id testname item-path) res)) +;; +(define (db:test-set-comment db run-id testname item-path comment) + (sqlite3:execute + db + "UPDATE tests SET comment=? WHERE run_id=? AND testname=? AND item_path=?;" + comment run-id testname item-path)) + ;; Steps ;; Run steps ;; make-vector-record "Run steps" db step id test_id stepname step_complete step_pass event_time (define (make-db:step)(make-vector 6)) (define-inline (db:step-get-id vec) (vector-ref vec 0)) Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -107,10 +107,46 @@ (include "launch.scm") (include "runs.scm") ;; (include "gui.scm") (define *didsomething* #f) + +;;====================================================================== +;; Remove old run(s) +;;====================================================================== + +(define (remove-runs) + (cond + ((not (args:get-arg ":runname")) + (print "ERROR: Missing required parameter for -remove-runs, you must specify the run name pattern with :runname patt") + (exit 2)) + ((not (args:get-arg "-testpatt")) + (print "ERROR: Missing required parameter for -remove-runs, you must specify the test pattern with -testpatt") + (exit 3)) + ((not (args:get-arg "-itempatt")) + (print "ERROR: Missing required parameter for -remove-runs, you must specify the items with -itempatt") + (exit 4)) + ((let ((db #f)) + (if (not (setup-for-run)) + (begin + (print "Failed to setup, exiting") + (exit 1))) + (set! db (open-db)) + (if (not (car *configinfo*)) + (begin + (print "ERROR: Attempted to remove test(s) but run area config file not found") + (exit 1)) + ;; put test parameters into convenient variables + (runs:remove-runs db + (args:get-arg ":runname") + (args:get-arg "-testpatt") + (args:get-arg "-itempatt"))) + (sqlite3:finalize! db) + (set! *didsomething* #t))))) + +(if (args:get-arg "-remove-runs") + (remove-runs)) ;;====================================================================== ;; Query runs ;;====================================================================== @@ -262,46 +298,10 @@ (set! *didsomething* #t)))) (if (args:get-arg "-runtests") (runtests)) -;;====================================================================== -;; Remove old run(s) -;;====================================================================== - -(define (remove-runs) - (cond - ((not (args:get-arg ":runname")) - (print "ERROR: Missing required parameter for -remove-runs, you must specify the run name pattern with :runname patt") - (exit 2)) - ((not (args:get-arg "-testpatt")) - (print "ERROR: Missing required parameter for -remove-runs, you must specify the test pattern with -testpatt") - (exit 3)) - ((not (args:get-arg "-itempatt")) - (print "ERROR: Missing required parameter for -remove-runs, you must specify the items with -itempatt") - (exit 4)) - ((let ((db #f)) - (if (not (setup-for-run)) - (begin - (print "Failed to setup, exiting") - (exit 1))) - (set! db (open-db)) - (if (not (car *configinfo*)) - (begin - (print "ERROR: Attempted to remove test(s) but run area config file not found") - (exit 1)) - ;; put test parameters into convenient variables - (runs:remove-runs db - (args:get-arg ":runname") - (args:get-arg "-testpatt") - (args:get-arg "-itempatt"))) - (sqlite3:finalize! db) - (set! *didsomething* #t))))) - -(if (args:get-arg "-remove-runs") - (remove-runs)) - ;;====================================================================== ;; execute the test ;; - gets called on remote host ;; - receives info from the -execute param ;; - passes info to steps via MT_CMDINFO env var (future is to use a dot file) Index: runs.scm ================================================================== --- runs.scm +++ runs.scm @@ -48,11 +48,11 @@ ;; register a test run with the db ;; ;; Use: (db-get-value-by-header (db:get-header runinfo)(db:get-row runinfo)) ;; to extract info from the structure returned ;; -(define (runs:get-runs-by-patt db keys runnamepatt) ;; test-name) +(define (runs:get-runs-by-patt db keys runnamepatt . params) ;; test-name) (let* ((keyvallst (keys->vallist keys)) (tmp (runs:get-std-run-fields keys '("id" "runname" "state" "status" "owner" "event_time"))) (keystr (car tmp)) (header (cadr tmp)) (res '()) @@ -275,10 +275,13 @@ (ct 0)) (if (and (not ts) (< ct 10)) (begin (register-test db run-id test-name item-path) + (db:test-set-comment db run-id test-name item-path "") + ;; (test-set-status! db run-id test-name "NOT_STARTED" "n/a" itemdat "") + ;; (db:set-comment-for-test db run-id test-name item-path "") (db:delete-test-step-records db run-id test-name) ;; clean out if this is a re-run (loop2 (db:get-test-info db run-id test-name item-path) (+ ct 1))) (if ts (set! test-status ts) @@ -376,11 +379,11 @@ (lambda (run) (let ((runkey (string-intersperse (map (lambda (k) (db-get-value-by-header run header (vector-ref k 0))) keys) "/"))) (let* ((run-id (db-get-value-by-header run header "id") ) (tests (db-get-tests-for-run db (db-get-value-by-header run header "id") testpatt itempatt)) - (lasttpath #f)) + (lasttpath "/does/not/exist/I/hope")) (if (not (null? tests)) (begin (print "Removing tests for run: " runkey " " (db-get-value-by-header run header "runname")) (for-each (lambda (test)