System.Data.SQLite
Check-in [a49d88c5aa]
Not logged in

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

Overview
Comment:Add comments to several test suite routines. Also, make sure to strip the directory information from file names provided to the setupDb and cleanupDb test helpers.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a49d88c5aa2ef6be10ad6e4503b4728f06bea245
User & Date: mistachkin 2011-09-02 17:57:42
Context
2011-09-03
14:58
Add more comments to the unit test infrastructure. Cleanup and modularize use of the test configuration. check-in: a9046f0f02 user: mistachkin tags: trunk
2011-09-02
17:57
Add comments to several test suite routines. Also, make sure to strip the directory information from file names provided to the setupDb and cleanupDb test helpers. check-in: a49d88c5aa user: mistachkin tags: trunk
15:56
Documentation updates for the upcoming 1.0.75.0 release. check-in: 4bd374a253 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Tests/common.eagle.

9
10
11
12
13
14
15
16




17
18
19
20
21
22
23
..
51
52
53
54
55
56
57







58
59
60
61
62
63
64
...
194
195
196
197
198
199
200





201
202




203
204
205
206




207
208




209
210




211
212
213
214




215
216
217
218




219
220
221
222




223





224





225
226
227
228
229
230
231
232

if {[isEagle]} then {
  proc getBuildYear {} {
    #
    # NOTE: See if the "year" setting has been overridden by the user (e.g. on
    #       the command line).  This controls which binaries we are testing,
    #       those produced by either the Visual Studio 2008 or Visual Studio
    #       2010 build systems.




    #
    if {[info exists ::test_year] && [string length $::test_year] > 0} then {
      return $::test_year
    } else {
      return [expr {[haveConstraint imageRuntime40] ? "2010" : "2008"}]
    }
  }
................................................................................
 
  proc getBuildFileName { fileName } {
    return [file nativename \
        [file join [getBuildDirectory] [file tail $fileName]]]
  }
 
  proc getBinaryDirectory {} {







    return [info binary]
  }
 
  proc getBinaryFileName { fileName } {
    return [file nativename \
        [file join [getBinaryDirectory] [file tail $fileName]]]
  }
................................................................................
    # NOTE: Evaluate the constructed [compileCSharp] command and return the
    #       result.
    #
    eval $command
  }
 
  proc setupDb {fileName {mode ""} {delete ""} {extra ""} {varName db}} {





    set fileName [file join [getTemporaryPath] $fileName]





    if {[string length $delete] == 0 || $delete} then {
      catch {file delete $fileName}
    }





    upvar 1 $varName db





    set connection {Data Source=${fileName}}





    if {[string length $mode] > 0} then {
      append connection {;Journal Mode=${mode}}
    }





    if {[string length $extra] > 0} then {
      append connection \; $extra
    }





    set db [sql open -type SQLite [subst $connection]]
  }
 
  proc cleanupDb {fileName {varName db}} {




    upvar 1 $varName db





    catch {sql close $db}





    catch {file delete [file join [getTemporaryPath] $fileName]}
  }
 
  proc runSQLiteTestPrologue {} {
    #
    # NOTE: Skip running our custom prologue if the main one has been skipped.
    #
    if {![info exists ::no(prologue.eagle)]} then {







|
>
>
>
>







 







>
>
>
>
>
>
>







 







>
>
>
>
>
|

>
>
>
>




>
>
>
>


>
>
>
>


>
>
>
>




>
>
>
>




>
>
>
>




>
>
>
>

>
>
>
>
>

>
>
>
>
>
|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
..
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
...
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286

if {[isEagle]} then {
  proc getBuildYear {} {
    #
    # NOTE: See if the "year" setting has been overridden by the user (e.g. on
    #       the command line).  This controls which binaries we are testing,
    #       those produced by either the Visual Studio 2008 or Visual Studio
    #       2010 build systems.  To override this value via the command line,
    #       enter a command similar to the following (all on one line):
    #
    #       EagleShell.exe -preInitialize "set test_year 2008"
    #         -file .\path\to\all.eagle
    #
    if {[info exists ::test_year] && [string length $::test_year] > 0} then {
      return $::test_year
    } else {
      return [expr {[haveConstraint imageRuntime40] ? "2010" : "2008"}]
    }
  }
................................................................................
 
  proc getBuildFileName { fileName } {
    return [file nativename \
        [file join [getBuildDirectory] [file tail $fileName]]]
  }
 
  proc getBinaryDirectory {} {
    #
    # NOTE: This procedure returns the directory where the test application
    #       itself (i.e. the Eagle shell) is located.  This will be used as
    #       the destination for the copied System.Data.SQLite native and
    #       managed assemblies (i.e. because this is one of the few places
    #       where the CLR will actually find and load them properly).
    #
    return [info binary]
  }
 
  proc getBinaryFileName { fileName } {
    return [file nativename \
        [file join [getBinaryDirectory] [file tail $fileName]]]
  }
................................................................................
    # NOTE: Evaluate the constructed [compileCSharp] command and return the
    #       result.
    #
    eval $command
  }
 
  proc setupDb {fileName {mode ""} {delete ""} {extra ""} {varName db}} {
    #
    # NOTE: For now, all test databases used by the test suite are placed into
    #       the temporary directory.  Each database used by a test should be
    #       cleaned up by that test using the "cleanupDb" procedure, below.
    #
    set fileName [file join [getTemporaryPath] [file tail $fileName]]

    #
    # NOTE: By default, delete any pre-existing database with the same file
    #       name.
    #
    if {[string length $delete] == 0 || $delete} then {
      catch {file delete $fileName}
    }

    #
    # NOTE: Refer to the specified variable (e.g. "db") in the context of the
    #       caller.  The handle to the opened database will be stored there.
    #
    upvar 1 $varName db

    #
    # NOTE: Start building the connection string.  The only required portion
    #       of the connection string is the database file name itself.
    #
    set connection {Data Source=${fileName}}

    #
    # NOTE: If the caller specified a journal mode, add the necessary portion
    #       of the connection string now.
    #
    if {[string length $mode] > 0} then {
      append connection {;Journal Mode=${mode}}
    }

    #
    # NOTE: If the caller specified an extra payload to the connection string,
    #       append it now.
    #
    if {[string length $extra] > 0} then {
      append connection \; $extra
    }

    #
    # NOTE: Open the database connection now, placing the opaque handle value
    #       into the variable specified by the caller.
    #
    set db [sql open -type SQLite [subst $connection]]
  }
 
  proc cleanupDb {fileName {varName db}} {
    #
    # NOTE: Refer to the specified variable (e.g. "db") in the context of the
    #       caller.  The handle to the opened database is stored there.
    #
    upvar 1 $varName db

    #
    # NOTE: Close the connection to the database now.  This should allow us to
    #       delete the underlying database file.
    #
    catch {sql close $db}

    #
    # NOTE: Delete the test database file now.  For now, all test database
    #       files are stored in the temporary directory.
    #
    catch {file delete [file join [getTemporaryPath] [file tail $fileName]]}
  }
 
  proc runSQLiteTestPrologue {} {
    #
    # NOTE: Skip running our custom prologue if the main one has been skipped.
    #
    if {![info exists ::no(prologue.eagle)]} then {