Megatest

Check-in [be4a5839b2]
Login
Overview
Comment:Fixed -cleanup-db
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.60
Files: files | file ages | folders
SHA1: be4a5839b2e9e46ca482f208bdc24f3d387bdb94
User & Date: matt on 2014-10-24 00:49:28
Other Links: branch diff | manifest | tags
Context
2014-10-24
08:55
Bumped version check-in: 80f67bad9a user: mrwellan tags: v1.60
00:49
Fixed -cleanup-db check-in: be4a5839b2 user: matt tags: v1.60
00:25
Merged rerun-behavior-fixes check-in: ef02bf7a14 user: matt tags: v1.60
Changes

Modified db.scm from [a92867ffdc] to [46f949fa8a].

292
293
294
295
296
297
298
299

300
301
302
303
304
305
306
292
293
294
295
296
297
298

299
300
301
302
303
304
305
306







-
+







		 (sqlite3:finalize! db #t))))
	 (hash-table-values (dbr:dbstruct-get-locdbs dbstruct))))
    (thread-sleep! 3)
    (if (and rundb
	     (sqlite3:database? rundb))
	(handle-exceptions
	 exn
	 (debug:print 0 "WARNING: database files may not have been closed correctly. Consider running -cleanup-db")
	 #t ;; (debug:print 0 "WARNING: database files may not have been closed correctly. Consider running -cleanup-db")
	 (sqlite3:interrupt! rundb)
	 (sqlite3:finalize! rundb #t)))))

(define (db:open-inmem-db)
  (let* ((db      (sqlite3:open-database ":memory:"))
	 (handler (make-busy-timeout 3600)))
    (db:initialize-run-id-db db)
851
852
853
854
855
856
857
858

859
860
861
862
863
864
865
851
852
853
854
855
856
857

858
859
860
861
862
863
864
865







-
+







;;    a. If test dir exists, set the the test to state='UNKNOWN', Set the run to 'unknown'
;;    b. If test dir gone, delete the test record
;; 2. Look at run records
;;    a. If have tests that are not deleted, set state='unknown'
;;    b. ....
;;
(define (db:clean-up db)
  (debug:print 0 "WARNING: db clean up not ported to v1.60, cleanup action will be on megatest.db")
  (debug:print 0 "WARNING: db clean up not fully ported to v1.60, cleanup action will be on megatest.db")
  (let* (;; (db         (db:get-db dbstruct #f))
	 (count-stmt (sqlite3:prepare db "SELECT (SELECT count(id) FROM tests)+(SELECT count(id) FROM runs);"))
	(statements
	 (map (lambda (stmt)
		(sqlite3:prepare db stmt))
	      (list
	       ;; delete all tests that belong to runs that are 'deleted'

Modified megatest.scm from [456389bec5] to [237c56ca49].

1217
1218
1219
1220
1221
1222
1223
1224










1225
1226
1227
1228
1229
1230
1231
1217
1218
1219
1220
1221
1222
1223

1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240







-
+
+
+
+
+
+
+
+
+
+







(if (args:get-arg "-cleanup-db")
    (begin
      (if (not (launch:setup-for-run))
	  (begin
	    (debug:print 0 "Failed to setup, exiting") 
	    (exit 1)))
      ;; keep this one local
      (open-run-close db:clean-up #f)
      ;; (open-run-close db:clean-up #f)
      (db:multi-db-sync 
       #f ;; do all run-ids
       'new2old
       'killservers
       'dejunk
       'adj-testids
       'old2new
       'new2old
       )
      (set! *didsomething* #t)))

(if (args:get-arg "-mark-incompletes")
    (begin
      (if (not (launch:setup-for-run))
	  (begin
	    (debug:print 0 "Failed to setup, exiting")