System.Data.SQLite
Check-in [0cd38620d4]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Modify unit test infrastructure to support more options for the setupDb and cleanupDb helper procedures, namely skipping garbage collection and file deletion.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0cd38620d45aaad9929865a2b1a5d1a990913e7c
User & Date: mistachkin 2012-07-11 01:29:33
Context
2012-07-11
03:37
Update test prologue and epilogue to make sure they unset all variables used prior to using any of them. check-in: 9189c4f757 user: mistachkin tags: trunk
01:32
Initial draft of new stress test. check-in: 96ab455945 user: mistachkin tags: stress
01:29
Modify unit test infrastructure to support more options for the setupDb and cleanupDb helper procedures, namely skipping garbage collection and file deletion. check-in: 0cd38620d4 user: mistachkin tags: trunk
2012-07-04
22:09
Update Eagle in externals to the beta 24 release. check-in: bf0e36e840 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to Tests/common.eagle.

   591    591         #
   592    592         # NOTE: Open the database connection now, placing the opaque handle value
   593    593         #       into the variable specified by the caller.
   594    594         #
   595    595         set db [sql open -type SQLite [subst $connection]]
   596    596       }
   597    597   
   598         -    proc cleanupDb { fileName {varName db} } {
          598  +    proc cleanupDb { fileName {varName db} {collect true} {delete true} } {
   599    599         #
   600    600         # NOTE: Attempt to force all pending "garbage" objects to be collected,
   601    601         #       including SQLite statements and backup objects; this should allow
   602    602         #       the underlying database file to be deleted.
   603    603         #
   604         -      if {[catch {object invoke GC GetTotalMemory true} error]} then {
          604  +      if {$collect && \
          605  +          [catch {object invoke GC GetTotalMemory true} error]} then {
   605    606           tputs $channel [appendArgs \
   606    607               "==== WARNING: failed full garbage collection, error: " \
   607    608               \n\t $error \n]
   608    609         }
   609    610   
   610    611         #
   611    612         # NOTE: Refer to the specified variable (e.g. "db") in the context of the
................................................................................
   638    639         if {!$isMemory} then {
   639    640           set fileName [file join [getDatabaseDirectory] [file tail $fileName]]
   640    641         }
   641    642   
   642    643         #
   643    644         # NOTE: Check if the file still exists.
   644    645         #
   645         -      if {!$isMemory && [file exists $fileName]} then {
          646  +      if {!$isMemory && $delete && [file exists $fileName]} then {
   646    647           #
   647    648           # NOTE: Skip deleting database files if somebody sets the global
   648    649           #       variable to prevent it.
   649    650           #
   650    651           if {![info exists ::no(cleanupDb)]} then {
   651    652             #
   652    653             # NOTE: Attempt to delete the test database file now.
................................................................................
   675    676           #
   676    677           set code 0
   677    678         }
   678    679   
   679    680         return $code
   680    681       }
   681    682   
   682         -    proc cleanupFile { fileName {force false} } {
          683  +    proc cleanupFile { fileName {collect true} {force false} } {
   683    684         #
   684    685         # NOTE: Attempt to force all pending "garbage" objects to be collected,
   685    686         #       including SQLite statements and backup objects; this should allow
   686    687         #       the underlying database file to be deleted.
   687    688         #
   688         -      if {[catch {object invoke GC GetTotalMemory true} error]} then {
          689  +      if {$collect && \
          690  +          [catch {object invoke GC GetTotalMemory true} error]} then {
   689    691           tputs $channel [appendArgs \
   690    692               "==== WARNING: failed full garbage collection, error: " \
   691    693               \n\t $error \n]
   692    694         }
   693    695   
   694    696         #
   695    697         # NOTE: Check if the file still exists.