Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -773,11 +773,11 @@ (lambda (update_time cpuload disk_free run_duration) (db:test-set-cpuload! res cpuload) (db:test-set-diskfree! res disk_free) (db:test-set-run_duration! res run_duration)) tdb - "SELECT update_time,cpuload,diskfree,run_duration FROM test_rundat;") + "SELECT update_time,cpuload,diskfree,run_duration FROM test_rundat ORDER BY id DESC LIMIT 1;") (sqlite3:finalize! tdb)) ;; if the test db is not found what to do? ;; 1. set state to DELETED ;; 2. set status to n/a (begin Index: launch.scm ================================================================== --- launch.scm +++ launch.scm @@ -104,11 +104,11 @@ ;; environment overrides are done *before* the remaining critical envars. (alist->env-vars env-ovrd) (open-run-close set-megatest-env-vars #f run-id) (set-item-env-vars itemdat) (save-environment-as-files "megatest") - (open-run-close test-set-meta-info #f test-id run-id test-name itemdat) + (open-run-close test-set-meta-info #f test-id run-id test-name itemdat 0) (open-run-close test-set-status! #f test-id "REMOTEHOSTSTART" "n/a" (args:get-arg "-m") #f) (if (args:get-arg "-xterm") (set! fullrunscript "xterm") (if (and fullrunscript (not (file-execute-access? fullrunscript))) (system (conc "chmod ug+x " fullrunscript)))) @@ -254,11 +254,11 @@ ;; (if (not (args:get-arg "-server")) ;; (server:client-setup db)) ;; (if (not cpuload) (begin (debug:print 0 "WARNING: CPULOAD not found.") (set! cpuload "n/a"))) ;; (if (not diskfree) (begin (debug:print 0 "WARNING: DISKFREE not found.") (set! diskfree "n/a"))) (set! kill-job? (open-run-close test-get-kill-request #f test-id)) ;; run-id test-name itemdat)) - (open-run-close test-set-meta-info #f test-id run-id test-name itemdat minutes: minutes) + (open-run-close test-set-meta-info #f test-id run-id test-name itemdat minutes) ;; (rdb:test-update-meta-info db test-id minutes cpuload diskfree tmpfree) (if kill-job? (begin (mutex-lock! m) (let* ((pid (vector-ref exit-info 0))) @@ -333,11 +333,11 @@ ;; (exec-results (cmd-run->list fullrunscript)) ;; (list ">" (conc test-name "-run.log")))) ;; (success exec-results)) ;; (eq? (cadr exec-results) 0))) (debug:print 2 "Output from running " fullrunscript ", pid " (vector-ref exit-info 0) " in work area " work-area ":\n====\n exit code " (vector-ref exit-info 2) "\n" "====\n") ;; (sqlite3:finalize! db) - (sqlite3:finalize! tdb) + ;; (sqlite3:finalize! tdb) (if (not (vector-ref exit-info 1)) (exit 4))))))) ;; set up the very basics needed for doing anything here. (define (setup-for-run) Index: tests.scm ================================================================== --- tests.scm +++ tests.scm @@ -402,11 +402,11 @@ tdb "SELECT count(id) FROM test_rundat;") res)) 0) -(define (test-set-meta-info db test-id run-id testname itemdat #!key (minutes #f)) +(define (test-set-meta-info db test-id run-id testname itemdat minutes) (let* ((tdb (db:open-test-db-by-test-id db test-id)) (num-records (test:tdb-get-rundat-count tdb)) (item-path (item-list->path itemdat)) (cpuload (get-cpu-load)) (diskfree (get-df (current-directory)))) @@ -416,19 +416,19 @@ cpuload diskfree run-id testname item-path) + (if minutes (sqlite3:execute db "UPDATE tests SET run_duration=? WHERE id=?;" minutes test-id)) (if (eq? num-records 0) - (begin + (let ((uname (get-uname "-srvpio")) + (hostname (get-host-name))) (sqlite3:execute db "UPDATE tests SET uname=?,host=? WHERE run_id=? AND testname=? AND item_path=?;" - (get-uname "-srvpio") (get-host-name) run-id testname item-path) - (if minutes - (sqlite3:execute db "UPDATE tests SET run_duration=? WHERE id=?;" ;; run_id=? AND testname=? AND item_path=?;" - minutes test-id)))))) ;; run-id testname item-path)))))) - (sqlite3:execute tdb "INSERT INTO test_rundat (cpuload,diskfree) VALUES (?,?);" - cpuload diskfree))) + uname hostname run-id testname item-path))))) + + (sqlite3:execute tdb "INSERT INTO test_rundat (update_time,cpuload,diskfree,run_duration) VALUES (strftime('%s','now'),?,?,?);" + cpuload diskfree minutes))) ;;====================================================================== ;; A R C H I V I N G ;;======================================================================