Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -205,13 +205,13 @@ "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 like ? AND item_path LIKE ? ORDER BY id DESC;" run-id testpatt (if itempatt itempatt "%")) res)) ;; this one is a bit broken BUG FIXME -(define (db:delete-test-step-records db run-id test-name) - (sqlite3:execute db "DELETE FROM test_steps WHERE test_id in (SELECT id FROM tests WHERE run_id=? AND testname=?);" run-id test-name)) - +(define (db:delete-test-step-records db run-id test-name itemdat) + (sqlite3:execute db "DELETE FROM test_steps WHERE test_id in (SELECT id FROM tests WHERE run_id=? AND testname=? AND item_path=?);" + run-id test-name (item-list->path itemdat))) ;; (define (db:delete-test-records db test-id) (sqlite3:execute db "DELETE FROM test_steps WHERE test_id=?;" test-id) (sqlite3:execute db "DELETE FROM tests WHERE id=?;" test-id)) @@ -235,11 +235,11 @@ "SELECT count(id) FROM tests WHERE state in ('LAUNCHED','NOT_STARTED','REMOTEHOSTSTART','RUNNING') AND run_id=?;" run-id) res)) ;; NB// Sync this with runs:get-test-info (define (db:get-test-info db run-id testname item-path) - (let ((res '())) + (let ((res #f)) (sqlite3:for-each-row (lambda (id run-id testname state status event-time host cpuload diskfree uname rundir item-path run_duration final_logf comment) (set! res (vector id run-id testname state status event-time host cpuload diskfree uname rundir item-path run_duration final_logf comment))) 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=?;" Index: launch.scm ================================================================== --- launch.scm +++ launch.scm @@ -149,10 +149,12 @@ (list 'itemdat itemdat ) (list 'megatest remote-megatest) (list 'env-ovrd (hash-table-ref/default *configdat* "env-override" '())) (list 'runname (args:get-arg ":runname")) (list 'mt-bindir-path mt-bindir-path))))))) ;; (string-intersperse keyvallst " ")))) + ;; clean out step records from previous run if they exist + (db:delete-test-step-records db run-id test-name itemdat) (change-directory work-area) ;; so that log files from the launch process don't clutter the test dir (cond ((and launcher hosts) ;; must be using ssh hostname (set! fullcmd (append launcher (car hosts)(list remote-megatest "-execute" cmdparms)))) (launcher Index: runs.scm ================================================================== --- runs.scm +++ runs.scm @@ -319,20 +319,23 @@ (string->number max-concurrent-jobs) (not (>= num-running (string->number max-concurrent-jobs)))))) (print "WARNING: Max running jobs exceeded, current number running: " num-running ", max_concurrent_jobs: " max-concurrent-jobs) (begin - (let loop2 ((ts #f) + (let loop2 ((ts (db:get-test-info db run-id test-name item-path)) ;; #f) (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 + + ;; Move the next line into the test exectute code + ;; (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) (begin