Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -216,17 +216,20 @@ (sqlite3:execute db "DELETE FROM tests WHERE id=?;" test-id)) ;; set tests with state currstate and status currstatus to newstate and newstatus ;; use currstate = #f and or currstatus = #f to apply to any state or status respectively ;; WARNING: SQL injection risk -(define (db:set-tests-state-status db run-id tests currstate currstatus newstate newstatus) - (sqlite3:execute db (conc "UPDATE tests SET state=?,status=? WHERE " - (if currstate (conc "state='" currstate "' AND ") "") - (if currstatus (conc "status='" currstatus "' AND ") "") - " testname in " - "('" (string-intersperse tests "','") "')") - newstate newstatus)) +(define (db:set-tests-state-status db run-id testnames currstate currstatus newstate newstatus) + (for-each (lambda (testname) + (let ((qry (conc "UPDATE tests SET state=?,status=? WHERE " + (if currstate (conc "state='" currstate "' AND ") "") + (if currstatus (conc "status='" currstatus "' AND ") "") + " testname=? AND NOT (item_path='' AND testname in (SELECT DISTINCT testname FROM tests WHERE testname=? AND item_path != ''));"))) + ;;(print "QRY: " qry) + (sqlite3:execute db qry newstate newstatus testname testname))) + testnames)) + ;; "('" (string-intersperse tests "','") "')") (define (db:get-count-tests-running db) (let ((res 0)) (sqlite3:for-each-row (lambda (count) Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -50,11 +50,12 @@ -remove-runs : remove the data for a run, requires all fields be specified and :runname ,-testpatt and -itempatt and -testpatt -keepgoing : continue running until no jobs are \"LAUNCHED\" or \"NOT_STARTED\" - -rerun FAIL,WARN... : re-run if called on a test that previously ran + -rerun FAIL,WARN... : re-run if called on a test that previously ran (nullified + if -keepgoing is also specified) Helpers -runstep stepname ... : take remaining params as comand and execute as stepname log will be in stepname.log. Best to put command in quotes -logpro file : with -exec apply logpro file to stepname.log, creates Index: runs.scm ================================================================== --- runs.scm +++ runs.scm @@ -313,16 +313,18 @@ (if (args:get-arg "-m") (db:set-comment-for-run db run-id (args:get-arg "-m"))) (let loop ((itemdat (car allitems)) (tal (cdr allitems))) ;; (lambda (itemdat) ;;; ((ripeness "overripe") (temperature "cool") (season "summer")) + ;; Handle lists of items (let* ((item-path (item-list->path itemdat)) ;; (string-intersperse (map cadr itemdat) "/")) (new-test-path (string-intersperse (cons test-path (map cadr itemdat)) "/")) (new-test-name (if (equal? item-path "") test-name (conc test-name "/" item-path))) ;; just need it to be unique (testdat #f) (num-running (db:get-count-tests-running db)) - (max-concurrent-jobs (config-lookup *configdat* "setup" "max_concurrent_jobs"))) + (max-concurrent-jobs (config-lookup *configdat* "setup" "max_concurrent_jobs")) + (parent-test (and (null? items)(equal? item-path "")))) ;; (print "max-concurrent-jobs: " max-concurrent-jobs ", num-running: " num-running) (if (not (or (not max-concurrent-jobs) (and max-concurrent-jobs (string->number max-concurrent-jobs) (not (>= num-running (string->number max-concurrent-jobs)))))) @@ -356,13 +358,15 @@ (string->symbol (test:get-state testdat)) 'failed-to-insert)) ((failed-to-insert) (print "ERROR: Failed to insert the record into the db")) ((NOT_STARTED COMPLETED) - (print "Got here, " (test:get-state testdat)) + ;; (print "Got here, " (test:get-state testdat)) (let ((runflag #f)) (cond + (parent-test ;; i.e. this is the parent test to a suite of items + (set! runflag #f)) ;; -force, run no matter what ((args:get-arg "-force")(set! runflag #t)) ;; NOT_STARTED, run no matter what ((equal? (test:get-state testdat) "NOT_STARTED")(set! runflag #t)) ;; not -rerun and PASS, WARN or CHECK, do no run @@ -383,11 +387,12 @@ (member (test:get-status testdat) '("FAIL" "n/a"))) (set! runflag #t)) (else (set! runflag #f))) ;; (print "RUNNING => runflag: " runflag " STATE: " (test:get-state testdat) " STATUS: " (test:get-status testdat)) (if (not runflag) - (print "NOTE: Not starting test " new-test-name " as it is state \"COMPLETED\" and status \"" (test:get-status testdat) "\", use -force to override") + (if (not parent-test) + (print "NOTE: Not starting test " new-test-name " as it is state \"COMPLETED\" and status \"" (test:get-status testdat) "\", use -force to override")) (let* ((get-prereqs-cmd (lambda () (db-get-prereqs-not-met db run-id waiton))) ;; check before running .... (launch-cmd (lambda () (launch-test db run-id test-conf keyvallst test-name test-path itemdat))) (testrundat (list get-prereqs-cmd launch-cmd))) @@ -435,11 +440,11 @@ ((cadr testdat)) (hash-table-delete! *waiting-queue* testname))) (if (not db) (sqlite3:finalize! ldb)))) waiting-test-names) - (sleep 10) ;; no point in rushing things at this stage? + ;; (sleep 10) ;; no point in rushing things at this stage? (loop (hash-table-keys *waiting-queue*))))))) (define (get-dir-up-one dir) (let ((dparts (string-split dir "/"))) (conc "/" (string-intersperse