Megatest

Diff
Login

Differences From Artifact [9beea9f91a]:

To Artifact [1e352e44dc]:


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
28
29
30
31
32
33
34
35
36
37





(use trace test (prefix sqlite3 sqlite3:))
(import dbfile)
(trace-call-sites #t)

(trace
 ;; dbfile:setup
 dbfile:open-sqlite3-db
 ;; dbfile:init-subdb
 ;; dbfile:add-dbdat
 ;; db:initialize-main-db
 ;; dbfile:set-subdb
 ;; db:with-db
 ;; dbfile:get-subdb
 )

(define tmpdir (common:get-db-tmp-area))
(test #f #t (dbr:dbstruct? (dbfile:setup #t *toppath* tmpdir)))
(test #f #t (dbr:dbstruct? (db:setup #t)))
(define dbstruct *dbstruct-dbs*)
(test #f #t (dbr:dbdat? (dbfile:open-db *dbstruct-dbs* #f db:initialize-main-db)))
(define mydbdat (dbfile:open-db *dbstruct-dbs* #f db:initialize-main-db))
(dbfile:add-dbdat dbstruct #f mydbdat)
(test #f #t (dbr:subdb? (dbfile:get-subdb dbstruct #f)))
(test #f #t (dbr:dbdat? (dbfile:get-dbdat dbstruct #f)))
(test #f #f (dbr:dbdat? (dbfile:get-dbdat dbstruct #f))) ;; stack empty so should fail.

(test #f #t (hash-table? (dbr:dbstruct-subdbs dbstruct)))
(test #f #t (stack? (dbr:subdb-dbstack (dbfile:get-subdb dbstruct #f))))
(test #f '("SYSTEM" "RELEASE") (db:get-keys *dbstruct-dbs*))


(test #f #t (dbr:dbdat? (dbfile:open-db dbstruct 1 db:initialize-main-db)))
(define rundbdat (dbfile:open-db dbstruct 1 db:initialize-main-db))
(dbfile:add-dbdat dbstruct 1 rundbdat)
(test #f #t (dbr:subdb? (dbfile:get-subdb dbstruct 1)))
(test #f #t (dbr:dbdat? (dbfile:get-dbdat dbstruct 1)))












|













|
|















>
>
>
>
>
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(use trace test (prefix sqlite3 sqlite3:))
(import dbfile)
(trace-call-sites #t)

(trace
 ;; dbfile:setup
 ;; dbfile:open-sqlite3-db
 ;; dbfile:init-subdb
 ;; dbfile:add-dbdat
 ;; db:initialize-main-db
 ;; dbfile:set-subdb
 ;; db:with-db
 ;; dbfile:get-subdb
 )

(define tmpdir (common:get-db-tmp-area))
(test #f #t (dbr:dbstruct? (dbfile:setup #t *toppath* tmpdir)))
(test #f #t (dbr:dbstruct? (db:setup #t)))
(define dbstruct *dbstruct-dbs*)
(test #f #t (dbr:dbdat? (dbfile:open-db *dbstruct-dbs* #f db:initialize-main-db)))
(define maindbdat (dbfile:open-db *dbstruct-dbs* #f db:initialize-main-db))
(dbfile:add-dbdat dbstruct #f maindbdat)
(test #f #t (dbr:subdb? (dbfile:get-subdb dbstruct #f)))
(test #f #t (dbr:dbdat? (dbfile:get-dbdat dbstruct #f)))
(test #f #f (dbr:dbdat? (dbfile:get-dbdat dbstruct #f))) ;; stack empty so should fail.

(test #f #t (hash-table? (dbr:dbstruct-subdbs dbstruct)))
(test #f #t (stack? (dbr:subdb-dbstack (dbfile:get-subdb dbstruct #f))))
(test #f '("SYSTEM" "RELEASE") (db:get-keys *dbstruct-dbs*))


(test #f #t (dbr:dbdat? (dbfile:open-db dbstruct 1 db:initialize-main-db)))
(define rundbdat (dbfile:open-db dbstruct 1 db:initialize-main-db))
(dbfile:add-dbdat dbstruct 1 rundbdat)
(test #f #t (dbr:subdb? (dbfile:get-subdb dbstruct 1)))
(test #f #t (dbr:dbdat? (dbfile:get-dbdat dbstruct 1)))

(test #f #t (db:close-all dbstruct))

(test #f #t (db:safely-close-sqlite3-db (dbr:dbdat-dbh rundbdat) (dbr:dbdat-stmt-cache rundbdat)))
(test #f #t (db:safely-close-sqlite3-db (dbr:dbdat-dbh maindbdat) (dbr:dbdat-stmt-cache maindbdat)))