Megatest

Check-in [9ec56337cf]
Login
Overview
Comment:Added the .import uses back.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.90
Files: files | file ages | folders
SHA1: 9ec56337cfaa7cd595ebea97eefa790d984695a0
User & Date: mrwellan on 2024-02-15 15:00:05
Other Links: branch diff | manifest | tags
Context
2024-02-15
19:13
Cleaned up deps check-in: 0e757770a7 user: matt tags: v1.90
15:00
Added the .import uses back. check-in: 9ec56337cf user: mrwellan tags: v1.90
12:27
Major refactor to modules essentially complete and working (local db access only). check-in: 816f04b621 user: mrwellan tags: v1.90
Changes

Modified dbfile.scm from [042dd41f0b] to [60d8086f8b].

451
452
453
454
455
456
457



458
459
460
461
462
463
464
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467







+
+
+







    
(define (dbfile:print-err . params)
  (with-output-to-port
      (current-error-port)
    (lambda ()
      (apply print params))))

;;
;; converge this with dbmod:safely-open-db
;;
(define (dbfile:cautious-open-database fname init-proc sync-mode journal-mode
				       #!key (tries-left 500)(force-init #f))
  (let* ((busy-file  (conc fname "-journal"))
	 (delay-time (* (- 51 tries-left) 1.1))
      	 (write-access (file-write-access? fname))
         (dir-access (file-write-access? (pathname-directory fname)))
         (retry      (lambda ()

Modified dbmod.scm from [1751fc58ca] to [c78d2e0924].

25
26
27
28
29
30
31
32

33

34


35
36
37
38
39
40
41
25
26
27
28
29
30
31

32
33
34

35
36
37
38
39
40
41
42
43







-
+

+
-
+
+







(declare (uses configfmod))
(declare (uses debugprint))
(declare (uses mtargs))
(declare (uses mtmod))

(module dbmod
	(
	 ;; for debug, can be commented out
	 ;; for debug, can be commented out in production
	 dbmod:safely-open-db
	 dbmod:with-db
	 

	 ;; used elsewhere, keep
	 dbmod:db-to-db-sync
	 
	 db:test-get-event_time
	 db:test-get-item-path
	 db:test-get-testname
	 db:get-value-by-header
	 
295
296
297
298
299
300
301
302

303
304
305

306
307
308
309
310
311
312

313



314
315

316
317
318
319
320
321
322
297
298
299
300
301
302
303

304
305
306

307
308
309
310
311
312
313

314
315
316
317
318
319

320
321
322
323
324
325
326
327







-
+


-
+






-
+

+
+
+

-
+







	    (sync-proc last-update)

	    ;; MOVE THIS CALL TO INSIDE THE sync-proc CALL
	    (dbr:dbstruct-last-update-set! dbstruct curr-secs)
	    )))
    (assert (sqlite3:database? dbh) "FATAL: bad db handle in dbmod:with-db") 
    (if use-mutex (mutex-lock! *db-with-db-mutex*))
    (let* ((res (let loop ((count 3))
    (let* ((res (let loop ((count 10))
		  (condition-case
		   (apply proc dbdat dbh params)
		   (exn (busy)
		   (exn (sqlite3) ;; was 'busy', but never got hit
			(if (> count 0)
			    (begin
			      (debug:print-info 0 *default-log-port* "dbmod:with-db, database is busy, will try "count" more times.")
			      (thread-sleep! 1)
			      (loop (- count 1)))
			    (begin
			      (debug:print-info 0 *default-log-port* "dbmod:with-db, database is busy, giving up.")
			      (debug:print-info 0 *default-log-port* "dbmod:with-db, database is busy, giving up. params: "params)
			      (exit 1))))
		   (exn (locked)
			(dbfile:print-err exn "ERROR: dbmod:with-db: database locked for run-id "run-id", params "params", message: "
					  ((condition-property-accessor 'exn 'message) exn)))
		   (exn ()
			(dbfile:print-err exn "ERROR: dbmod:with-db: Unknown error with database for run-id "run-id", message: "
			(dbfile:print-err exn "ERROR: dbmod:with-db: Unknown error with database for run-id "run-id", params "params", message: "
					  ((condition-property-accessor 'exn 'message) exn))
			(exit 2))))))
      (if use-mutex (mutex-unlock! *db-with-db-mutex*))
      res)))

(define (db:with-db dbstruct run-id w/r proc . params)
  (dbmod:with-db dbstruct run-id w/r proc params))
352
353
354
355
356
357
358



359
360
361
362
363
364
365
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373







+
+
+







	  (debug:print 0 *default-log-port* "Unknown dbfile:sync-method setting: "
		       (dbfile:sync-method)))))
      (else
       (debug:print 0 *default-log-port* "Unknown dbfile:cache-method setting: "
		    (dbfile:cache-method))
       #f)))

;;
;; converge this with dbfile:cautious-open-database
;;
(define (dbmod:safely-open-db dbfullname init-proc write-access)
  (dbfile:with-simple-file-lock
   (conc dbfullname".lock")
   (lambda ()
     (let* ((dbexists (file-exists? dbfullname))
	    (db       (sqlite3:open-database dbfullname))
	    (handler  (sqlite3:make-busy-timeout 136000)))

Modified megatest.scm from [5f4807297f] to [fee9940301].

33
34
35
36
37
38
39
40

41
42
43
44
45
46
47
33
34
35
36
37
38
39

40
41
42
43
44
45
46
47







-
+







(declare (uses commonmod))
(declare (uses commonmod.import))
(declare (uses processmod))
(declare (uses processmod.import))
(declare (uses configfmod))
(declare (uses configfmod.import))
(declare (uses pgdb))
;; (declare (uses pgdb.import))
(declare (uses pgdb.import))
(declare (uses mtmod))
(declare (uses mtmod.import))
(declare (uses servermod))
(declare (uses servermod.import))
(declare (uses dbfile))
(declare (uses dbfile.import))
(declare (uses dbmod))
55
56
57
58
59
60
61
62

63
64

65
66

67
68

69
70
71
72
73

74
75
76
77
78
79
80
55
56
57
58
59
60
61

62
63

64
65

66
67

68
69

70
71

72
73
74
75
76
77
78
79







-
+

-
+

-
+

-
+

-


-
+







(declare (uses megatestmod))
(declare (uses megatestmod.import))
(declare (uses apimod))
(declare (uses apimod.import))
(declare (uses rmtmod))
(declare (uses rmtmod.import))
(declare (uses tasksmod))
;; (declare (uses tasksmod.import))
(declare (uses tasksmod.import))
(declare (uses testsmod))
;; (declare (uses testsmod.import))
(declare (uses testsmod.import))
(declare (uses subrunmod))
;; (declare (uses subrunmod.import))
(declare (uses subrunmod.import))
(declare (uses archivemod))
;; (declare (uses archivemod.import))
(declare (uses archivemod.import))
(declare (uses runsmod))
;; comment out following line for performance, but debug result.
(declare (uses runsmod.import))
(declare (uses cpumod))
;; (declare (uses cpumod.import))
(declare (uses cpumod.import))
(declare (uses runsmod))
(declare (uses ezstepsmod))
(declare (uses launchmod))

(declare (uses tdb))
(declare (uses api))
(declare (uses env))