Megatest

Check-in [f3d24ced62]
Login
Overview
Comment:changed readonly mode check to include unwritable mtra dir and unwritable mtra/logs dir
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.64-ro
Files: files | file ages | folders
SHA1: f3d24ced62ab5cc0bca9a3eb6bba47e0b0089dfe
User & Date: bjbarcla on 2017-11-29 12:00:53
Other Links: branch diff | manifest | tags
Context
2017-11-29
15:14
wip Leaf check-in: 4153c0f183 user: bjbarcla tags: v1.64-ro
12:00
changed readonly mode check to include unwritable mtra dir and unwritable mtra/logs dir check-in: f3d24ced62 user: bjbarcla tags: v1.64-ro
2017-11-27
17:19
Edits to dashboard for redHat check-in: 5e5a6adb65 user: ritikaag tags: v1.64
Changes

Modified common.scm from [d7b3aac795] to [7b00f2e8ef].

330
331
332
333
334
335
336



337

338
339
340
341
342
343
344
330
331
332
333
334
335
336
337
338
339

340
341
342
343
344
345
346
347







+
+
+
-
+







;; Do NOT check if not on homehost!
;;
(define (common:exit-on-version-changed)
  (if (common:on-homehost?)
      (if (common:api-changed?)
	  (let* ((mtconf (conc (get-environment-variable "MT_RUN_AREA_HOME") "/megatest.config"))
                (dbfile (conc (get-environment-variable "MT_RUN_AREA_HOME") "/megatest.db"))
                (read-only (or
                            (get-environment-variable "MT_FORCE_READONLY")
                            (not (file-write-access? (get-environment-variable "MT_RUN_AREA_HOME")))
                (read-only (not (file-write-access? dbfile)))
                            (not (file-write-access? dbfile))))
                (dbstruct (db:setup #t)))
	    (debug:print 0 *default-log-port*
			 "WARNING: Version mismatch!\n"
			 "   expected: " (common:version-signature) "\n"
			 "   got:      " (common:get-last-run-version))
            (cond
             ((get-environment-variable "MT_SKIP_DB_MIGRATE") #t)

Modified db.scm from [afc751ae6f] to [cdffa82ac9].

255
256
257
258
259
260
261
262








263
264
265
266
267
268
269
255
256
257
258
259
260
261

262
263
264
265
266
267
268
269
270
271
272
273
274
275
276







-
+
+
+
+
+
+
+
+







         (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))))
	)))



(define (db:mtdbpath-writable? mtdbpath)
  (let* ((parent-dir (pathname-directory mtdbpath))
         (logdir     (conc parent-dir "/logs")))
    (and
     (file-write-access? parent-dir)
     (file-write-access? mtdbpath)
     (or (not (common:file-exists? logdir)) (file-write-access? logdir))
     )))



;; ;; This routine creates the db. It is only called if the db is not already opened
;; ;; 
;; (define (db:open-rundb dbstruct run-id #!key (attemptnum 0)(do-not-open #f)) ;;  (conc *toppath* "/megatest.db") (car *configinfo*)))
;;   (let* ((dbfile       (db:dbfile-path run-id)) ;; (conc toppath "/db/" run-id ".db"))
312
313
314
315
316
317
318
319

320
321
322
323
324
325
326
319
320
321
322
323
324
325

326
327
328
329
330
331
332
333







-
+







	       (dbfexists    (common:file-exists? tmpdbfname))  ;; (conc dbpath "/megatest.db")))
               (mtdbexists   (common:file-exists? (conc *toppath* "/megatest.db")))
               
               (mtdb         (db:open-megatest-db))
               (mtdbpath     (db:dbdat-get-path mtdb))
               (tmpdb        (db:open-megatest-db path: dbpath)) ;; lock-create-open dbpath db:initialize-main-db))
               (refndb       (db:open-megatest-db path: dbpath name: "megatest_ref.db"))
               (write-access (file-write-access? mtdbpath))
               (write-access (db:mtdbpath-writable? mtdbpath)) ;; this determines if we are i readonly mode or not.
	       (mtdbmodtime  (if mtdbexists (common:lazy-sqlite-db-modification-time mtdbpath)   #f))
	       (tmpdbmodtime (if dbfexists  (common:lazy-sqlite-db-modification-time tmpdbfname) #f))
	       (modtimedelta (and mtdbmodtime tmpdbmodtime (- mtdbmodtime tmpdbmodtime))))
	  
          ;;(debug:print-info 13 *default-log-port* "db:open-db>> mtdbpath="mtdbpath" mtdbexists="mtdbexists" and write-access="write-access)
          (if (and dbexists (not write-access))
              (begin