@@ -25,12 +25,12 @@ (declare (uses client)) (declare (uses tests)) (declare (uses genexample)) (declare (uses daemon)) (declare (uses db)) -(declare (uses sdb)) -(declare (uses filedb)) +;; (declare (uses sdb)) +;; (declare (uses filedb)) (declare (uses tdb)) (declare (uses mt)) (declare (uses api)) (define *db* #f) ;; this is only for the repl, do not use in general!!!! @@ -243,10 +243,11 @@ "-gen-megatest-area" "-mark-incompletes" "-convert-to-norm" "-convert-to-old" + "-import-megatest.db" "-logging" "-v" ;; verbose 2, more than normal (normal is 1) "-q" ;; quiet 0, errors/warnings only ) @@ -358,11 +359,11 @@ "-stop-server" "-show-cmdinfo" "-list-runs"))) (if (setup-for-run) (begin - (set! *fdb* (filedb:open-db (conc *toppath* "/db/paths.db"))) + ;; (set! *fdb* (filedb:open-db (conc *toppath* "/db/paths.db"))) ;; if not list or kill then start a client (if appropriate) (if (or (args-defined? "-h" "-version" "-gen-megatest-area" "-gen-megatest-test") (eq? (length (hash-table-keys args:arg-hash)) 0)) (debug:print-info 1 "Server connection not needed") ;; ok, so lets connect to the server @@ -615,13 +616,14 @@ (equal? (db:test-get-status test) "WARN") (equal? (db:test-get-state test) "NOT_STARTED"))) (begin (print " cpuload: " (db:test-get-cpuload test) "\n diskfree: " (db:test-get-diskfree test) - "\n uname: " (sdb:qry 'getstr (db:test-get-uname test)) - "\n rundir: " (sdb:qry 'getstr ;; (filedb:get-path *fdb* - (db:test-get-rundir test)) + "\n uname: " ;; (sdb:qry 'getstr + (db:test-get-uname test) ;; ) + "\n rundir: " ;; (sdb:qry 'getstr ;; (filedb:get-path *fdb* + (db:test-get-rundir test) ;; ) ) ;; Each test ;; DO NOT remote run (let ((steps (db:get-steps-for-test dbstruct run-id (db:test-get-id test)))) (for-each @@ -1173,19 +1175,36 @@ (conc "SELECT id," field " FROM tests;")) (debug:print-info 0 "found " (length dat) " items for field " field) (let ((qry (sqlite3:prepare db (conc "UPDATE tests SET " field "=? WHERE id=?;")))) (for-each (lambda (item) - (let ((newval (sdb:qry 'getid (cadr item)))) + (let ((newval ;; (sdb:qry 'getid + (cadr item))) ;; ) (if (not (equal? newval (cadr item))) (debug:print-info 0 "Converting " (cadr item) " to " newval " for test #" (car item))) (sqlite3:execute qry newval (car item)))) dat) (sqlite3:finalize! qry)))) (db:close-all dbstruct) (list "uname" "rundir" "final_logf" "comment")) (set! *didsomething* #t))) + +(if (args:get-arg "-import-megatest.db") + (let* ((toppath (setup-for-run)) + (dbstruct (if toppath (make-dbr:dbstruct path: toppath) #f)) + (mtdb (if toppath (db:open-megatest-db))) + (run-ids (if toppath (db:get-run-ids mtdb)))) + (for-each + (lambda (run-id) + (let ((testrecs (db:get-all-tests-info-by-run-id mtdb run-id))) + (debug:print 0 "INFO: Updating " (length testrecs) " records for run-id=" run-id) + (db:replace-test-records dbstruct run-id testrecs))) + run-ids) + (set! *didsomething* #t) + (db:close-all dbstruct))) + + ;;====================================================================== ;; Exit and clean up ;;====================================================================== @@ -1194,11 +1213,11 @@ ;; this is the socket if we are a client ;; (if (and *runremote* ;; (socket? *runremote*)) ;; (close-socket *runremote*)) -(if sdb:qry (sdb:qry 'finalize #f)) +;; (if sdb:qry (sdb:qry 'finalize #f)) ;; (if *fdb* (filedb:finalize-db! *fdb*)) (if (not *didsomething*) (debug:print 0 help))