Megatest

Check-in [3a76f000c0]
Login
Overview
Comment:junk
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.65
Files: files | file ages | folders
SHA1: 3a76f000c0bfa520b3b8d28b68d118caf37ef60d
User & Date: mrwellan on 2019-04-04 10:30:04
Other Links: branch diff | manifest | tags
Context
2019-04-04
10:30
junk check-in: ac8a516285 user: mrwellan tags: v1.65
10:30
junk check-in: 3a76f000c0 user: mrwellan tags: v1.65
01:51
junk check-in: b7dfc5691b user: matt tags: v1.65
Changes

Modified db.scm from [a146d876b8] to [09f2a4da9d].

264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
         (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))))
	)))






;; ;; 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"))
;;          (dbexists     (common:file-exists? dbfile))
;;          (db           (db:lock-create-open dbfile (lambda (db)
;;                                                      (handle-exceptions
;;                                                       exn
;;                                                       (begin
;;                                                         ;; (release-dot-lock dbpath)
;;                                                         (if (> attemptnum 2)
;;                                                             (debug:print-error 0 *default-log-port* "tried twice, cannot create/initialize db for run-id " run-id ", at path " dbpath)
;;                                                             (db:open-rundb dbstruct run-id attemptnum (+ attemptnum 1))))
;;                                                       (db:initialize-run-id-db db)
;;                                                       (sqlite3:execute 
;;                                                        db
;;                                                        "INSERT OR IGNORE INTO tests (id,run_id,testname,event_time,item_path,state,status) VALUES (?,?,'bogustest',strftime('%s','now'),'nowherepath','DELETED','n/a');"
;;                                                        (* run-id 30000) ;; allow for up to 30k tests per run
;;                                                        run-id)
;;                                                       ;; do a dummy query to test that the table exists and the db is truly readable
;;                                                       (sqlite3:execute db "SELECT * FROM tests WHERE id=?;" (* run-id 30000))
;;                                                       )))) ;; add strings db to rundb, not in use yet
;;          (olddb        (if *megatest-db*
;;                            *megatest-db* 
;;                            (let ((db (db:open-megatest-db)))
;;                              (set! *megatest-db* db)
;;                              db)))
;;          (write-access (file-write-access? dbfile)))
;;     (if (and dbexists (not write-access))
;;         (set! *db-write-access* #f)) ;; only unset so other db's also can use this control
;;     (dbr:dbstruct-rundb-set!  dbstruct (cons db dbfile))
;;     (dbr:dbstruct-inuse-set!  dbstruct #t)
;;     (dbr:dbstruct-olddb-set!  dbstruct olddb)
;;     ;;; (mutex-unlock! *rundb-mutex*) ;;; why did we need a mutex on opening db's?
;;     (db:sync-tables db:sync-tests-only *megatest-db* db)
;;     db))

;; This routine creates the db if not already present. It is only called if the db is not already opened
;;
(define (db:open-db dbstruct #!key (areapath #f)(do-sync #t)) ;; TODO: actually use areapath
  (let ((tmpdb-stack (dbr:dbstruct-dbstack dbstruct))) ;; RA => Returns the first reference in dbstruct
    (if (stack? tmpdb-stack)
	(db:get-db tmpdb-stack) ;; get previously opened db (will create new db handle if all in the stack are already used
        (let* ((max-stale-tmp (configf:lookup-number *configdat* "server" "filling-db-max-stale-seconds" default: 10))







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







264
265
266
267
268
269
270









































271
272
273
274
275
276
277
         (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))))
	)))











































;; This routine creates the db if not already present. It is only called if the db is not already opened
;;
(define (db:open-db dbstruct #!key (areapath #f)(do-sync #t)) ;; TODO: actually use areapath
  (let ((tmpdb-stack (dbr:dbstruct-dbstack dbstruct))) ;; RA => Returns the first reference in dbstruct
    (if (stack? tmpdb-stack)
	(db:get-db tmpdb-stack) ;; get previously opened db (will create new db handle if all in the stack are already used
        (let* ((max-stale-tmp (configf:lookup-number *configdat* "server" "filling-db-max-stale-seconds" default: 10))

Modified junk/cube.scm from [dfc5973f3b] to [a44db36c6b].

74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
  (gl:Vertex2f 1 0) 
  (gl:End) 
  )

(define data
  (map (lambda (inl)
	 (map string->number (string-split inl)))
       (with-input-from-file "data.scm"
	 read-lines)))

(print "data: " data)

(use trace)

;; (add-object draw-cube animate: spin select: (lambda _ (print "oink!")))







|







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
  (gl:Vertex2f 1 0) 
  (gl:End) 
  )

(define data
  (map (lambda (inl)
	 (map string->number (string-split inl)))
       (with-input-from-file "data.txt"
	 read-lines)))

(print "data: " data)

(use trace)

;; (add-object draw-cube animate: spin select: (lambda _ (print "oink!")))

Added junk/data.txt version [cb1d5c0059].























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
0 0 0 1 2 3 4 5 6
0 0 1 1 2 3 4 5 6
0 0 2 1 2 3 4 5 6
0 1 0 1 2 3 4 5 6
0 1 1 1 2 3 4 5 6
0 1 2 1 2 3 4 5 6
0 2 0 1 2 3 4 5 6
0 2 1 1 2 3 4 5 6
0 2 2 1 2 3 4 5 6
1 0 0 1 2 3 4 5 6
1 0 1 1 2 3 4 5 6
1 0 2 1 2 3 4 5 6
1 1 0 1 2 3 4 5 6
1 1 1 1 2 3 4 5 6
1 1 2 1 2 3 4 5 6
1 2 0 1 2 3 4 5 6
1 2 1 1 2 3 4 5 6
1 2 2 1 2 3 4 5 6
2 0 0 1 2 3 4 5 6
2 0 1 1 2 3 4 5 6
2 0 2 1 2 3 4 5 6
2 1 0 1 2 3 4 5 6
2 1 1 1 2 3 4 5 6
2 1 2 1 2 3 4 5 6
2 2 0 1 2 3 4 5 6
2 2 1 1 2 3 4 5 6
2 2 2 1 2 3 4 5 6