Megatest

Check-in [33694be5f8]
Login
Overview
Comment:Added additional busy-handler
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.65-merge-fixes
Files: files | file ages | folders
SHA1: 33694be5f862fb551556bc292347983d3629009b
User & Date: matt on 2019-11-04 22:22:48
Other Links: branch diff | manifest | tags
Context
2019-11-08
16:12
Merged in v1.65-merge-fixes. Tested and passing all tests check-in: 8a260ddbc7 user: jmoon18 tags: v1.65
2019-11-04
22:22
Added additional busy-handler Leaf check-in: 33694be5f8 user: matt tags: v1.65-merge-fixes
20:47
Applied more fixes from modulization work check-in: e6e04b8c79 user: matt tags: v1.65-merge-fixes
Changes

Modified db.scm from [7166b4bedb] to [8a077942c3].

1

2
3
4
5
6
7
8

1
2
3
4
5
6
7
8
-
+







;======================================================================
;;======================================================================
;; Copyright 2006-2016, Matthew Welland.
;; 
;; This file is part of Megatest.
;; 
;;     Megatest is free software: you can redistribute it and/or modify
;;     it under the terms of the GNU General Public License as published by
;;     the Free Software Foundation, either version 3 of the License, or
265
266
267
268
269
270
271


272

273
274
275
276
277
278
279
265
266
267
268
269
270
271
272
273

274
275
276
277
278
279
280
281







+
+
-
+







         (exn (permission)(debug:print 0 *default-log-port* "ERROR: database " fname " has some permissions problem."))
         (exn () (debug:print 0 *default-log-port* "ERROR: Unknown error with database " fname " message: " ((condition-property-accessor 'exn 'message) exn))))
        
	(condition-case
         (begin
           (debug:print 2 *default-log-port* "WARNING: opening db in non-writable dir " fname)
           (let ((db (sqlite3:open-database fname)))
             (sqlite3:set-busy-handler! db (sqlite3:make-busy-timeout 136000))
             (sqlite3:execute db "PRAGMA synchronous = 0;")
             ;; (mutex-unlock! *db-open-mutex*)
	     ;; (mutex-unlock! *db-open-mutex*)
             db))
         (exn (io-error)  (debug:print 0 *default-log-port* "ERROR: i/o error with " fname ". Check permissions, disk space etc. and try again."))
         (exn (corrupt)   (debug:print 0 *default-log-port* "ERROR: database " fname " is corrupt. Repair it to proceed."))
         (exn (busy)      (debug:print 0 *default-log-port* "ERROR: database " fname " is locked. Try copying to another location, remove original and copy back."))
         (exn (permission)(debug:print 0 *default-log-port* "ERROR: database " fname " has some permissions problem."))
         (exn () (debug:print 0 *default-log-port* "ERROR: Unknown error with database " fname " message: " ((condition-property-accessor 'exn 'message) exn))))
	)))
603
604
605
606
607
608
609


610
611
612
613
614
615
616
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620







+
+







			  "megatest -cleanup-db"
			  "megatest -import-megatest.db;megatest -cleanup-db")
		      "\"\n")
	 (exit) ;; we can not safely continue when a db was corrupted - even if fixed.
	 )
       ;; test read/write access to the database
       (let ((db (sqlite3:open-database dbpath)))
	 (sqlite3:set-busy-handler! db (sqlite3:make-busy-timeout 136000))
	 (sqlite3:execute db "PRAGMA synchronous = 0;")
	 (cond
	  ((equal? fname "megatest.db")
	   (sqlite3:execute db "DELETE FROM tests WHERE state='DELETED';"))
	  ((equal? fname "main.db")
	   (sqlite3:execute db "DELETE FROM runs WHERE state='deleted';"))
	  ((string-match "\\d.db" fname)
	   (sqlite3:execute db "UPDATE tests SET state='DELETED' WHERE state='DELETED';"))