345
346
347
348
349
350
351
352
353
354
355
356
357
358
|
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
|
+
+
+
|
(let ((newval (conc (args:get-arg "-testpatt") "/" (args:get-arg "-itempatt"))))
(debug:print 0 "WARNING: -itempatt has been deprecated, please use -testpatt testpatt/itempatt method, new testpatt is "newval)
(hash-table-set! args:arg-hash "-testpatt" newval)
(hash-table-delete! args:arg-hash "-itempatt")))
(on-exit (lambda ()
(rmt:print-db-stats)
(let ((run-ids (hash-table-keys *db-local-sync*)))
(if (not (null? run-ids))
(db:multi-db-sync run-ids 'new2old)))
(if *dbstruct-db* (db:close-all *dbstruct-db*))
(if *megatest-db* (sqlite3:finalize! *megatest-db*))
(if *task-db* (sqlite3:finalize! (vector-ref *task-db* 0)))))
;;======================================================================
;; Misc general calls
;;======================================================================
|
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
|
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
|
-
+
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
+
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
|
;; ;; ;; redo me dat)
;; ;; ;; redo me (sqlite3:finalize! qry))))
;; ;; ;; redo me (db:close-all dbstruct)
;; ;; ;; redo me (list "uname" "rundir" "final_logf" "comment"))
;; ;; ;; redo me (set! *didsomething* #t)))
(if (args:get-arg "-import-megatest.db")
(let* ((toppath (launch:setup-for-run))
(begin
(dbstruct (if toppath (make-dbr:dbstruct path: toppath) #f))
(mtdb (if toppath (db:open-megatest-db)))
(run-ids (if toppath (db:get-all-run-ids mtdb)))
(mdb (tasks:open-db))
(servers (tasks:get-all-servers mdb)))
;; kill servers
(db:multi-db-sync
#f ;; do all run-ids
(for-each
(lambda (server)
(tasks:server-delete-record mdb (vector-ref server 0) "dbmigration")
(tasks:kill-server (vector-ref server 2)(vector-ref server 1)))
servers)
(sqlite3:finalize! mdb)
'killservers
'dejunk
'adj-testids
'old2new
;; clear out junk records
;;
(db:clean-up mtdb)
'new2old
;; adjust test-ids to fit into proper range
;;
(db:prep-megatest.db-for-migration mtdb)
)
;; sync runs, test_meta etc.
;;
(db:sync-tables (db:sync-main-list mtdb) mtdb (db:get-db dbstruct #f))
(for-each
(lambda (run-id)
(let ((testrecs (db:get-all-tests-info-by-run-id mtdb run-id))
(dbstruct (if toppath (make-dbr:dbstruct path: toppath local: #t) #f)))
(debug:print 0 "INFO: Propagating " (length testrecs) " records for run-id=" run-id " to run specific db")
(db:replace-test-records dbstruct run-id testrecs)
(sqlite3:finalize! (dbr:dbstruct-get-rundb dbstruct))))
run-ids)
;; now ensure all newdb data are synced to megatest.db
(for-each
(lambda (run-id)
(let ((fromdb (if toppath (make-dbr:dbstruct path: toppath local: #t) #f)))
(db:sync-tables db:sync-tests-only (db:get-db fromdb run-id) mtdb)))
run-ids)
(set! *didsomething* #t)
(set! *didsomething* #t)))
(db:close-all dbstruct)))
;;======================================================================
;; Exit and clean up
;;======================================================================
(if *runremote* (close-all-connections!))
(if (not *didsomething*)
|