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

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

Overview
Comment:Allow the directory used for test databases to be easily overridden for the vast majority of tests.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b35fffe201c1eac26e3bbc71525c07b9091c11ff
User & Date: mistachkin 2011-12-16 08:33:16
Context
2011-12-16
08:45
Revise the CLR method used to force a full garbage collection in the unit test infrastructure. check-in: e1319dd971 user: mistachkin tags: trunk
08:33
Allow the directory used for test databases to be easily overridden for the vast majority of tests. check-in: b35fffe201 user: mistachkin tags: trunk
07:09
Report memory currently in use by the CLR before and after each test file. check-in: 3fae72f823 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Tests/basic.eagle.

49
50
51
52
53
54
55


56
57
58
59




60
61

62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
...
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
...
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
...
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
...
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
...
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
...
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
  checkForFile $test_channel $testLinqOutFile
}

###############################################################################

runTest {test data-1.1 {unit tests from the 'test' project} -setup {
  catch {file delete [file join [file dirname $testExeFile] Test.db3]}


} -body {
  set output ""

  set code [catch {




    testClrExec $testExeFile [list -eventflags Wait -directory \
    [file dirname $testExeFile] -stdout output -success 0] -autoRun

  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  list $code [expr {$code == 0 ? "" : $error}]
} -cleanup {
  unset -nocomplain code output error
} -constraints {eagle file_test.exe} -result {0 {}}}

###############################################################################

runTest {test data-1.2 {unit tests from the 'testlinq' project} -setup {
  #
  # NOTE: Re-copy the reference database file used for this unit test to the
................................................................................

###############################################################################

runTest {test data-1.4 {GetSchema with ReservedWords} -setup {
  setupDb [set fileName data-1.4.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getTemporaryPath] data-1.4.db]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

................................................................................
      DEFAULT 1
    );
  }

  sql execute $db "CREATE TABLE t2(x INTEGER REFERENCES t3);"

  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getTemporaryPath] data-1.5.db]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

................................................................................

###############################################################################

runTest {test data-1.6 {SQLITE_FCNTL_WIN32_AV_RETRY} -setup {
  setupDb [set fileName data-1.6.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getTemporaryPath] data-1.6.db]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

................................................................................

###############################################################################

runTest {test data-1.7 {properly closed database file (non-query)} -setup {
  set fileName data-1.7.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getTemporaryPath] $fileName]

  set sql { \
    BEGIN EXCLUSIVE TRANSACTION; \
    CREATE TABLE t1(x INTEGER); \
    INSERT INTO t1 (x) VALUES(1); \
    SELECT * FROM t1; \
  }
................................................................................

###############################################################################

runTest {test data-1.8 {properly closed database file (reader #1)} -setup {
  set fileName data-1.8.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getTemporaryPath] $fileName]

  set sql { \
    BEGIN EXCLUSIVE TRANSACTION; \
    CREATE TABLE t1(x INTEGER); \
    INSERT INTO t1 (x) VALUES(1); \
    SELECT * FROM t1; \
  }
................................................................................

###############################################################################

runTest {test data-1.9 {properly closed database file (reader #2)} -setup {
  set fileName data-1.9.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getTemporaryPath] $fileName]

  set sql { \
    BEGIN EXCLUSIVE TRANSACTION; \
    CREATE TABLE t1(x INTEGER); \
    INSERT INTO t1 (x) VALUES(1); \
    SELECT * FROM t1; \
  }







>
>




>
>
>
>

|
>








|







 







|







 







|







 







|







 







|







 







|







 







|







49
50
51
52
53
54
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
81
82
83
84
...
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
...
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
...
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
...
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
...
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
...
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
  checkForFile $test_channel $testLinqOutFile
}

###############################################################################

runTest {test data-1.1 {unit tests from the 'test' project} -setup {
  catch {file delete [file join [file dirname $testExeFile] Test.db3]}
  set fileName [file join [getDatabaseDirectory] data-1.1.db]
  catch {file delete $fileName}
} -body {
  set output ""

  set code [catch {
    #
    # NOTE: For the sake of backward compatibility, the "-autoRun" argument
    #       must be first.
    #
    testClrExec $testExeFile [list -eventflags Wait -directory \
    [file dirname $testExeFile] -stdout output -success 0] -autoRun \
    -fileName [appendArgs \" [file nativename $fileName] \"]
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  list $code [expr {$code == 0 ? "" : $error}]
} -cleanup {
  unset -nocomplain code output error fileName
} -constraints {eagle file_test.exe} -result {0 {}}}

###############################################################################

runTest {test data-1.2 {unit tests from the 'testlinq' project} -setup {
  #
  # NOTE: Re-copy the reference database file used for this unit test to the
................................................................................

###############################################################################

runTest {test data-1.4 {GetSchema with ReservedWords} -setup {
  setupDb [set fileName data-1.4.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] data-1.4.db]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

................................................................................
      DEFAULT 1
    );
  }

  sql execute $db "CREATE TABLE t2(x INTEGER REFERENCES t3);"

  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] data-1.5.db]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

................................................................................

###############################################################################

runTest {test data-1.6 {SQLITE_FCNTL_WIN32_AV_RETRY} -setup {
  setupDb [set fileName data-1.6.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] data-1.6.db]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

................................................................................

###############################################################################

runTest {test data-1.7 {properly closed database file (non-query)} -setup {
  set fileName data-1.7.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    BEGIN EXCLUSIVE TRANSACTION; \
    CREATE TABLE t1(x INTEGER); \
    INSERT INTO t1 (x) VALUES(1); \
    SELECT * FROM t1; \
  }
................................................................................

###############################################################################

runTest {test data-1.8 {properly closed database file (reader #1)} -setup {
  set fileName data-1.8.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    BEGIN EXCLUSIVE TRANSACTION; \
    CREATE TABLE t1(x INTEGER); \
    INSERT INTO t1 (x) VALUES(1); \
    SELECT * FROM t1; \
  }
................................................................................

###############################################################################

runTest {test data-1.9 {properly closed database file (reader #2)} -setup {
  set fileName data-1.9.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    BEGIN EXCLUSIVE TRANSACTION; \
    CREATE TABLE t1(x INTEGER); \
    INSERT INTO t1 (x) VALUES(1); \
    SELECT * FROM t1; \
  }

Changes to Tests/common.eagle.

180
181
182
183
184
185
186


















187
188
189
190
191
192
193
...
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
...
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
      }
    }
 
    proc getBinaryFileName { fileName } {
      return [file nativename \
          [file join [getBinaryDirectory] [file tail $fileName]]]
    }


















 
    proc getAppDomainPreamble { {prefix ""} {suffix ""} } {
      #
      # NOTE: This procedure returns a test setup script suitable for evaluation
      #       by a test interpreter created in an isolated application domain.
      #       The script being returned will be surrounded by the prefix and
      #       suffix "script fragments" specified by the caller, if any.  The
................................................................................
            fileName {mode ""} {dateTimeFormat ""} {dateTimeKind ""} {extra ""}
            {delete true} {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 it currently exists.
      #
      if {$delete && [file exists $fileName]} then {
        if {[catch {file delete $fileName} error]} then {
................................................................................
            \n\t $error \n]
      }

      #
      # NOTE: Build the full path to the database file name.  For now, all test
      #       database files are stored in the temporary directory.
      #
      set fileName [file join [getTemporaryPath] [file tail $fileName]]

      if {[file exists $fileName]} then {
        #
        # NOTE: Attempt to delete the test database file now.
        #
        if {[set code [catch {file delete $fileName} error]]} then {
          #







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|







 







|







180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
...
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
...
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
      }
    }
 
    proc getBinaryFileName { fileName } {
      return [file nativename \
          [file join [getBinaryDirectory] [file tail $fileName]]]
    }
 
    proc getDatabaseDirectory {} {
      #
      # NOTE: This procedure returns the directory where the test databases
      #       should be located.  By default, this just uses the temporary
      #       directory configured for this system.
      #
      if {[info exists ::database_directory] && \
          [string length $::database_directory] > 0} then {
        #
        # NOTE: The location of the database directory has been overridden;
        #       therefore, use it.
        #
        return [file normalize $::database_directory]
      } else {
        return [getTemporaryPath]
      }
    }
 
    proc getAppDomainPreamble { {prefix ""} {suffix ""} } {
      #
      # NOTE: This procedure returns a test setup script suitable for evaluation
      #       by a test interpreter created in an isolated application domain.
      #       The script being returned will be surrounded by the prefix and
      #       suffix "script fragments" specified by the caller, if any.  The
................................................................................
            fileName {mode ""} {dateTimeFormat ""} {dateTimeKind ""} {extra ""}
            {delete true} {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 [getDatabaseDirectory] [file tail $fileName]]

      #
      # NOTE: By default, delete any pre-existing database with the same file
      #       name if it currently exists.
      #
      if {$delete && [file exists $fileName]} then {
        if {[catch {file delete $fileName} error]} then {
................................................................................
            \n\t $error \n]
      }

      #
      # NOTE: Build the full path to the database file name.  For now, all test
      #       database files are stored in the temporary directory.
      #
      set fileName [file join [getDatabaseDirectory] [file tail $fileName]]

      if {[file exists $fileName]} then {
        #
        # NOTE: Attempt to delete the test database file now.
        #
        if {[set code [catch {file delete $fileName} error]]} then {
          #

Changes to Tests/tkt-343d392b51.eagle.

87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
...
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
...
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
###############################################################################

runTest {test tkt-343d392b51-2.1 {SQLiteDataAdapter update fail} -setup {
  setupDb [set fileName tkt-343d392b51-2.1.db]
  set otherFileName tkt-343d392b51-2.1-otherDb.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getTemporaryPath] $fileName]
  set otherDataSource [file join [getTemporaryPath] $otherFileName]
  set otherDbName otherDb
  set otherTable [appendArgs $otherDbName .t1]

  set sql(inserts) ""
  set sql(1) [subst { \
    ATTACH DATABASE '${otherDataSource}' AS ${otherDbName}; \
    CREATE TABLE ${otherTable}(x INTEGER PRIMARY KEY, y DATETIME); \
................................................................................
###############################################################################

runTest {test tkt-343d392b51-2.2 {SQLiteDataAdapter update success} -setup {
  setupDb [set fileName tkt-343d392b51-2.2.db] "" JulianDay
  set otherFileName tkt-343d392b51-2.2-otherDb.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getTemporaryPath] $fileName]
  set otherDataSource [file join [getTemporaryPath] $otherFileName]
  set otherDbName otherDb
  set otherTable [appendArgs $otherDbName .t1]

  set sql(inserts) ""
  set sql(1) [subst { \
    ATTACH DATABASE '${otherDataSource}' AS ${otherDbName}; \
    CREATE TABLE ${otherTable}(x INTEGER PRIMARY KEY, y DATETIME); \
................................................................................

###############################################################################

runTest {test tkt-343d392b51-3.1 {attached database, same table name} -setup {
  setupDb [set fileName tkt-343d392b51-3.1.db]
  set otherFileName tkt-343d392b51-3.1-otherDb.db
} -body {
  set otherDataSource [file join [getTemporaryPath] $otherFileName]
  set otherDbName otherDb
  set otherTable [appendArgs $otherDbName .t1]

  set sql(inserts) ""
  set sql(1) [subst { \
    CREATE TABLE t1(x INTEGER PRIMARY KEY); \
    ATTACH DATABASE '${otherDataSource}' AS ${otherDbName}; \
................................................................................
###############################################################################

runTest {test tkt-343d392b51-3.2 {adapter, attached db, table names} -setup {
  setupDb [set fileName tkt-343d392b51-3.2.db]
  set otherFileName tkt-343d392b51-3.2-otherDb.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getTemporaryPath] $fileName]
  set otherDataSource [file join [getTemporaryPath] $otherFileName]
  set otherDbName otherDb
  set otherTable [appendArgs $otherDbName .t1]

  set sql(inserts) ""
  set sql(1) [subst { \
    CREATE TABLE t1(x INTEGER PRIMARY KEY); \
    ATTACH DATABASE '${otherDataSource}' AS ${otherDbName}; \







|
|







 







|
|







 







|







 







|
|







87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
...
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
...
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
###############################################################################

runTest {test tkt-343d392b51-2.1 {SQLiteDataAdapter update fail} -setup {
  setupDb [set fileName tkt-343d392b51-2.1.db]
  set otherFileName tkt-343d392b51-2.1-otherDb.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]
  set otherDataSource [file join [getDatabaseDirectory] $otherFileName]
  set otherDbName otherDb
  set otherTable [appendArgs $otherDbName .t1]

  set sql(inserts) ""
  set sql(1) [subst { \
    ATTACH DATABASE '${otherDataSource}' AS ${otherDbName}; \
    CREATE TABLE ${otherTable}(x INTEGER PRIMARY KEY, y DATETIME); \
................................................................................
###############################################################################

runTest {test tkt-343d392b51-2.2 {SQLiteDataAdapter update success} -setup {
  setupDb [set fileName tkt-343d392b51-2.2.db] "" JulianDay
  set otherFileName tkt-343d392b51-2.2-otherDb.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]
  set otherDataSource [file join [getDatabaseDirectory] $otherFileName]
  set otherDbName otherDb
  set otherTable [appendArgs $otherDbName .t1]

  set sql(inserts) ""
  set sql(1) [subst { \
    ATTACH DATABASE '${otherDataSource}' AS ${otherDbName}; \
    CREATE TABLE ${otherTable}(x INTEGER PRIMARY KEY, y DATETIME); \
................................................................................

###############################################################################

runTest {test tkt-343d392b51-3.1 {attached database, same table name} -setup {
  setupDb [set fileName tkt-343d392b51-3.1.db]
  set otherFileName tkt-343d392b51-3.1-otherDb.db
} -body {
  set otherDataSource [file join [getDatabaseDirectory] $otherFileName]
  set otherDbName otherDb
  set otherTable [appendArgs $otherDbName .t1]

  set sql(inserts) ""
  set sql(1) [subst { \
    CREATE TABLE t1(x INTEGER PRIMARY KEY); \
    ATTACH DATABASE '${otherDataSource}' AS ${otherDbName}; \
................................................................................
###############################################################################

runTest {test tkt-343d392b51-3.2 {adapter, attached db, table names} -setup {
  setupDb [set fileName tkt-343d392b51-3.2.db]
  set otherFileName tkt-343d392b51-3.2-otherDb.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]
  set otherDataSource [file join [getDatabaseDirectory] $otherFileName]
  set otherDbName otherDb
  set otherTable [appendArgs $otherDbName .t1]

  set sql(inserts) ""
  set sql(1) [subst { \
    CREATE TABLE t1(x INTEGER PRIMARY KEY); \
    ATTACH DATABASE '${otherDataSource}' AS ${otherDbName}; \

Changes to Tests/tkt-448d663d11.eagle.

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
..
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
..
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
..
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
...
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
...
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
...
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
{delete}}

###############################################################################

runTest {test tkt-448d663d11-1.2 {missing journal mode, WAL db} -body {
  set fileName tkt-448d663d11-1.2.db
  file copy -force [file join $path wal.db] \
      [file join [getTemporaryPath] $fileName]
  setupDb $fileName "" "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
................................................................................
{wal}}

###############################################################################

runTest {test tkt-448d663d11-1.3 {missing journal mode, non-WAL db} -body {
  set fileName tkt-448d663d11-1.3.db
  file copy -force [file join $path nonWal.db] \
      [file join [getTemporaryPath] $fileName]
  setupDb $fileName "" "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
................................................................................
{delete}}

###############################################################################

runTest {test tkt-448d663d11-1.5 {'Default' journal mode, WAL db} -body {
  set fileName tkt-448d663d11-1.5.db
  file copy -force [file join $path wal.db] \
      [file join [getTemporaryPath] $fileName]
  setupDb $fileName Default "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
................................................................................
{wal}}

###############################################################################

runTest {test tkt-448d663d11-1.6 {'Default' journal mode, non-WAL db} -body {
  set fileName tkt-448d663d11-1.6.db
  file copy -force [file join $path nonWal.db] \
      [file join [getTemporaryPath] $fileName]
  setupDb $fileName Default "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
................................................................................
{delete}}

###############################################################################

runTest {test tkt-448d663d11-1.8 {'Delete' journal mode, WAL db} -body {
  set fileName tkt-448d663d11-1.8.db
  file copy -force [file join $path wal.db] \
      [file join [getTemporaryPath] $fileName]
  setupDb $fileName Delete "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
................................................................................
{delete}}

###############################################################################

runTest {test tkt-448d663d11-1.9 {'Delete' journal mode, non-WAL db} -body {
  set fileName tkt-448d663d11-1.9.db
  file copy -force [file join $path nonWal.db] \
      [file join [getTemporaryPath] $fileName]
  setupDb $fileName Delete "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
................................................................................
{wal}}

###############################################################################

runTest {test tkt-448d663d11-1.15 {'Wal' journal mode, non-WAL db} -body {
  set fileName tkt-448d663d11-1.15.db
  file copy -force [file join $path nonWal.db] \
      [file join [getTemporaryPath] $fileName]
  setupDb $fileName Wal "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
................................................................................
{wal}}

###############################################################################

runTest {test tkt-448d663d11-1.16 {'Wal' journal mode, WAL db} -body {
  set fileName tkt-448d663d11-1.16.db
  file copy -force [file join $path wal.db] \
      [file join [getTemporaryPath] $fileName]
  setupDb $fileName Wal "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
................................................................................
{delete}}

###############################################################################

runTest {test tkt-448d663d11-1.18 {'Bad' journal mode, non-WAL db} -body {
  set fileName tkt-448d663d11-1.18.db
  file copy -force [file join $path nonWal.db] \
      [file join [getTemporaryPath] $fileName]
  setupDb $fileName Bad "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
................................................................................
{delete}}

###############################################################################

runTest {test tkt-448d663d11-1.19 {'Bad' journal mode, WAL db} -body {
  set fileName tkt-448d663d11-1.19.db
  file copy -force [file join $path wal.db] \
      [file join [getTemporaryPath] $fileName]
  setupDb $fileName Bad "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{wal}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|













31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
..
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
..
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
..
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
...
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
...
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
...
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
{delete}}

###############################################################################

runTest {test tkt-448d663d11-1.2 {missing journal mode, WAL db} -body {
  set fileName tkt-448d663d11-1.2.db
  file copy -force [file join $path wal.db] \
      [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName "" "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
................................................................................
{wal}}

###############################################################################

runTest {test tkt-448d663d11-1.3 {missing journal mode, non-WAL db} -body {
  set fileName tkt-448d663d11-1.3.db
  file copy -force [file join $path nonWal.db] \
      [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName "" "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
................................................................................
{delete}}

###############################################################################

runTest {test tkt-448d663d11-1.5 {'Default' journal mode, WAL db} -body {
  set fileName tkt-448d663d11-1.5.db
  file copy -force [file join $path wal.db] \
      [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Default "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
................................................................................
{wal}}

###############################################################################

runTest {test tkt-448d663d11-1.6 {'Default' journal mode, non-WAL db} -body {
  set fileName tkt-448d663d11-1.6.db
  file copy -force [file join $path nonWal.db] \
      [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Default "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
................................................................................
{delete}}

###############################################################################

runTest {test tkt-448d663d11-1.8 {'Delete' journal mode, WAL db} -body {
  set fileName tkt-448d663d11-1.8.db
  file copy -force [file join $path wal.db] \
      [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Delete "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
................................................................................
{delete}}

###############################################################################

runTest {test tkt-448d663d11-1.9 {'Delete' journal mode, non-WAL db} -body {
  set fileName tkt-448d663d11-1.9.db
  file copy -force [file join $path nonWal.db] \
      [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Delete "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
................................................................................
{wal}}

###############################################################################

runTest {test tkt-448d663d11-1.15 {'Wal' journal mode, non-WAL db} -body {
  set fileName tkt-448d663d11-1.15.db
  file copy -force [file join $path nonWal.db] \
      [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Wal "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
................................................................................
{wal}}

###############################################################################

runTest {test tkt-448d663d11-1.16 {'Wal' journal mode, WAL db} -body {
  set fileName tkt-448d663d11-1.16.db
  file copy -force [file join $path wal.db] \
      [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Wal "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
................................................................................
{delete}}

###############################################################################

runTest {test tkt-448d663d11-1.18 {'Bad' journal mode, non-WAL db} -body {
  set fileName tkt-448d663d11-1.18.db
  file copy -force [file join $path nonWal.db] \
      [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Bad "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
................................................................................
{delete}}

###############################################################################

runTest {test tkt-448d663d11-1.19 {'Bad' journal mode, WAL db} -body {
  set fileName tkt-448d663d11-1.19.db
  file copy -force [file join $path wal.db] \
      [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Bad "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{wal}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Changes to Tests/tkt-7e3fa93744.eagle.

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

###############################################################################

runTest {test tkt-7e3fa93744-1.2 {composite primary key, DataTable} -setup {
  setupDb [set fileName tkt-7e3fa93744-1.2.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getTemporaryPath] $fileName]

  set sql { \
    CREATE TABLE t1 ( \
      id1 INTEGER PRIMARY KEY NOT NULL \
    ); \
    CREATE TABLE t2 ( \
      id1 INTEGER NOT NULL, \







|







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

###############################################################################

runTest {test tkt-7e3fa93744-1.2 {composite primary key, DataTable} -setup {
  setupDb [set fileName tkt-7e3fa93744-1.2.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    CREATE TABLE t1 ( \
      id1 INTEGER PRIMARY KEY NOT NULL \
    ); \
    CREATE TABLE t2 ( \
      id1 INTEGER NOT NULL, \

Changes to Tests/tkt-e1b2e0f769.eagle.

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  sql execute $db "CREATE TABLE t2(x INTEGER);"

  foreach x [list 1 2 3] {
    sql execute $db "INSERT INTO t1 (x) VALUES($x);"
  }

  set result1 [list]
  set dataSource [file join [getTemporaryPath] tkt-e1b2e0f769-1.1.db]

  foreach table [list t1 t2] {
    set id [object invoke Interpreter.GetActive NextId]
    set sql "SELECT x FROM $table ORDER BY x;"

    unset -nocomplain results errors








|







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  sql execute $db "CREATE TABLE t2(x INTEGER);"

  foreach x [list 1 2 3] {
    sql execute $db "INSERT INTO t1 (x) VALUES($x);"
  }

  set result1 [list]
  set dataSource [file join [getDatabaseDirectory] tkt-e1b2e0f769-1.1.db]

  foreach table [list t1 t2] {
    set id [object invoke Interpreter.GetActive NextId]
    set sql "SELECT x FROM $table ORDER BY x;"

    unset -nocomplain results errors

Changes to Tests/tkt-e30b820248.eagle.

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
...
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134

###############################################################################

runTest {test tkt-e30b820248-1.1 {disposal ordering} -setup {
  set fileName tkt-e30b820248-1.1.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getTemporaryPath] $fileName]
  set name [file rootname [file tail $fileName]]

  set sql { \
    CREATE TABLE t1 (id1 INTEGER); \
    INSERT INTO t1 (id1) VALUES (1); \
    INSERT INTO t1 (id1) VALUES (2); \
    INSERT INTO t1 (id1) VALUES (?); \
................................................................................

  #############################################################################

  runTest {test [appendArgs tkt-e30b820248-1. $i] {disposal ordering} -setup {
    set fileName [appendArgs tkt-e30b820248-1. $i .db]
  } -body {
    set id [object invoke Interpreter.GetActive NextId]
    set dataSource [file join [getTemporaryPath] $fileName]
    set name [file rootname [file tail $fileName]]

    set sql { \
      CREATE TABLE t1 (id1 INTEGER); \
      INSERT INTO t1 (id1) VALUES (1); \
      INSERT INTO t1 (id1) VALUES (2); \
      INSERT INTO t1 (id1) VALUES (3); \







|







 







|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
...
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134

###############################################################################

runTest {test tkt-e30b820248-1.1 {disposal ordering} -setup {
  set fileName tkt-e30b820248-1.1.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]
  set name [file rootname [file tail $fileName]]

  set sql { \
    CREATE TABLE t1 (id1 INTEGER); \
    INSERT INTO t1 (id1) VALUES (1); \
    INSERT INTO t1 (id1) VALUES (2); \
    INSERT INTO t1 (id1) VALUES (?); \
................................................................................

  #############################################################################

  runTest {test [appendArgs tkt-e30b820248-1. $i] {disposal ordering} -setup {
    set fileName [appendArgs tkt-e30b820248-1. $i .db]
  } -body {
    set id [object invoke Interpreter.GetActive NextId]
    set dataSource [file join [getDatabaseDirectory] $fileName]
    set name [file rootname [file tail $fileName]]

    set sql { \
      CREATE TABLE t1 (id1 INTEGER); \
      INSERT INTO t1 (id1) VALUES (1); \
      INSERT INTO t1 (id1) VALUES (2); \
      INSERT INTO t1 (id1) VALUES (3); \

Changes to test/Program.cs.

30
31
32
33
34
35
36

37
38
39
40




41
42
43
44
45
46








47
48
49
50

51
52
53
54
55
56
57
58
                {
                    // do nothing.
                }

                Debugger.Break();
            }


            bool autoRun = false;

            if ((args != null) && (args.Length > 0))
            {




                string arg = args[0];

                if (arg != null)
                {
                    arg = arg.TrimStart(new char[] { '-', '/' });









                    if (String.Equals(arg, "autoRun",
                            StringComparison.OrdinalIgnoreCase))
                    {
                        autoRun = true;

                    }
                }
            }

            Application.Run(new TestCasesDialog(autoRun));
        }
    }
}







>


|

>
>
>
>
|

|
|
|

>
>
>
>
>
>
>
>
|
|
|
|
>




|



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
                {
                    // do nothing.
                }

                Debugger.Break();
            }

            string fileName = "test.db"; // NOTE: New default, was "Test.db3".
            bool autoRun = false;

            if (args != null)
            {
                int length = args.Length;

                for (int index = 0; index < length; index++)
                {
                    string arg = args[index];

                    if (arg != null)
                    {
                        arg = arg.TrimStart(new char[] { '-', '/' });

                        if (String.Equals(arg, "fileName",
                                StringComparison.OrdinalIgnoreCase))
                        {
                            index++;

                            if (index < length)
                                fileName = args[index];
                        }
                        else if (String.Equals(arg, "autoRun",
                                StringComparison.OrdinalIgnoreCase))
                        {
                            autoRun = true;
                        }
                    }
                }
            }

            Application.Run(new TestCasesDialog(fileName, autoRun));
        }
    }
}

Changes to test/TestCasesDialog.cs.

28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
..
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
    /// If set, then automatically run all the tests and exit.
    /// </summary>
    private bool _autoRun;

    private TestCases _test;
    private TestCases _testitems;

    public TestCasesDialog(bool autoRun)
    {
      InitializeComponent();

      using (DataTable tbl = DbProviderFactories.GetFactoryClasses())
      {
        foreach (DataRow row in tbl.Rows)
        {
................................................................................
          if (prov.IndexOf("SQLite", 0, StringComparison.OrdinalIgnoreCase) != -1
            || prov.IndexOf("SqlClient", 0, StringComparison.OrdinalIgnoreCase) != -1
            )
            _provider.Items.Add(prov);
          if (prov == "System.Data.SQLite") _provider.SelectedItem = prov;
        }
      }
      _connectionString.Items.Add("Data Source=Test.db3;Pooling=true;FailIfMissing=false");
      _connectionString.Items.Add("Data Source=(local);Initial Catalog=sqlite;Integrated Security=True;Max Pool Size=10");
      _connectionString.SelectedIndex = 0;

      _autoRun = autoRun;
      _testitems = new TestCases();
      foreach (KeyValuePair<string, bool> pair in _testitems.Tests)
      {







|







 







|







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
..
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
    /// If set, then automatically run all the tests and exit.
    /// </summary>
    private bool _autoRun;

    private TestCases _test;
    private TestCases _testitems;

    public TestCasesDialog(string fileName, bool autoRun)
    {
      InitializeComponent();

      using (DataTable tbl = DbProviderFactories.GetFactoryClasses())
      {
        foreach (DataRow row in tbl.Rows)
        {
................................................................................
          if (prov.IndexOf("SQLite", 0, StringComparison.OrdinalIgnoreCase) != -1
            || prov.IndexOf("SqlClient", 0, StringComparison.OrdinalIgnoreCase) != -1
            )
            _provider.Items.Add(prov);
          if (prov == "System.Data.SQLite") _provider.SelectedItem = prov;
        }
      }
      _connectionString.Items.Add(String.Format("Data Source={0};Pooling=true;FailIfMissing=false", fileName));
      _connectionString.Items.Add("Data Source=(local);Initial Catalog=sqlite;Integrated Security=True;Max Pool Size=10");
      _connectionString.SelectedIndex = 0;

      _autoRun = autoRun;
      _testitems = new TestCases();
      foreach (KeyValuePair<string, bool> pair in _testitems.Tests)
      {