System.Data.SQLite
Check-in [767b97f170]
Not logged in

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

Overview
Comment:Enhance the new tests for SQLiteLog subsystem initialization.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 767b97f17029698d929f3fd9be563f51942b1805
User & Date: mistachkin 2019-05-16 03:23:41
Context
2019-06-09
19:31
Final updates for release 1.0.111.0. check-in: d567636ccb user: mistachkin tags: trunk, release, release-1.0.111.0
2019-05-16
03:23
Enhance the new tests for SQLiteLog subsystem initialization. check-in: 767b97f170 user: mistachkin tags: trunk
2019-05-15
02:35
Pickup the SQLite core library 3.28.0 docs from upstream. check-in: 0323de7965 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to System.Data.SQLite/SQLiteLog.cs.

205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
                    return;
                }
            }

            ///////////////////////////////////////////////////////////////////

            //
            // BUFXIX: We cannot initialize the logging interface if the SQLite
            //         core library has already been initialized anywhere in
            //         the process (see ticket [2ce0870fad]).
            //
            if (SQLite3.StaticIsInitialized())
                return;

            ///////////////////////////////////////////////////////////////////







|







205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
                    return;
                }
            }

            ///////////////////////////////////////////////////////////////////

            //
            // BUFXIX: Cannot initialize the logging interface if the SQLite
            //         core library has already been initialized anywhere in
            //         the process (see ticket [2ce0870fad]).
            //
            if (SQLite3.StaticIsInitialized())
                return;

            ///////////////////////////////////////////////////////////////////

Changes to Tests/basic.eagle.

5136
5137
5138
5139
5140
5141
5142
5143






5144
5145
5146
5147
5148
5149
5150
5151
5152
5153

5154










5155
5156
5157



5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172





















































5173
































































5174
































5175
5176
5177
5178
5179
5180
5181
5182
5183
....
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196






5197
5198
5199
5200
5201
5202
5203
5204
5205
5206

5207










5208
5209
5210



5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227

5228
5229
5230
5231
5232
5233
5234
5235
5236
....
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
  unset -nocomplain error code db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{1 {attempt to write a readonly database} 0 1 4}}

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

runTest {test data-1.98 {create SQLiteConnection objects w/logging} -setup {






  proc threadStart {} {
    for {set i 0} {$i < 1000} {incr i} {
      set c($i) [object create System.Data.SQLite.SQLiteConnection]
      incr ::count
    }
  }

  saveEnvironmentVariables [list No_SQLiteLog] savedEnv

  unset -nocomplain env(No_SQLiteLog)

} -body {










  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount 0




  for {set i 0} {$i < 20} {incr i} {
    set thread($i) [createThread threadStart false 1048576]
    $thread($i) Name [appendArgs "test data-1.98 #" $i]
  }

  set count 0

  foreach i [array names thread] {
    startThread $thread($i)
  }

  foreach i [array names thread] {
    $thread($i) Join
  }






















































  list $count [object invoke -flags +NonPublic \
































































      System.Data.SQLite.SQLiteLog _initializeCallCount]
































} -cleanup {
  restoreEnvironmentVariables [list No_SQLiteLog] savedEnv

  if {[info exists thread]} then {
    foreach i [array names thread] {
      if {[info exists thread($i)] && [cleanupThread $thread($i)]} then {
        unset -nocomplain thread($i)
      }
    }
................................................................................

  catch {object removecallback threadStart}

  unset -nocomplain thread i count

  rename threadStart ""
} -constraints {eagle command.object SQLite System.Data.SQLite} -result \
{20000 20000}}

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

runTest {test data-1.99 {create SQLiteConnection objects w/o logging} -setup {






  proc threadStart {} {
    for {set i 0} {$i < 1000} {incr i} {
      set c($i) [object create System.Data.SQLite.SQLiteConnection]
      incr ::count
    }
  }

  saveEnvironmentVariables [list No_SQLiteLog] savedEnv

  set env(No_SQLiteLog) 1

} -body {










  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount 0




  for {set i 0} {$i < 20} {incr i} {
    set thread($i) [createThread threadStart false 1048576]
    $thread($i) Name [appendArgs "test data-1.99 #" $i]
  }

  set count 0

  foreach i [array names thread] {
    startThread $thread($i)
  }

  foreach i [array names thread] {
    $thread($i) Join
  }

  list $count [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount]

} -cleanup {
  restoreEnvironmentVariables [list No_SQLiteLog] savedEnv

  if {[info exists thread]} then {
    foreach i [array names thread] {
      if {[info exists thread($i)] && [cleanupThread $thread($i)]} then {
        unset -nocomplain thread($i)
      }
    }
................................................................................

  catch {object removecallback threadStart}

  unset -nocomplain thread i count

  rename threadStart ""
} -constraints {eagle command.object SQLite System.Data.SQLite} -result \
{20000 0}}

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

reportSQLiteResources $test_channel

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

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue







|
>
>
>
>
>
>



|



|


>

>
>
>
>
>
>
>
>
>
>



>
>
>





|









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

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

|







 







|



|
>
>
>
>
>
>



|



|


>

>
>
>
>
>
>
>
>
>
>



>
>
>


|


|









|
|
>

|







 







|










5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
....
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
....
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
  unset -nocomplain error code db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{1 {attempt to write a readonly database} 0 1 4}}

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

runTest {test data-1.98 {SQLiteLog initialize (enabled)} -setup {
  #
  # NOTE: Make sure that SQLite core library is completely shutdown prior to
  #       starting this test.
  #
  shutdownSQLite $test_channel

  proc threadStart {} {
    for {set i 0} {$i < 1000} {incr i} {
      set c($i) [object create System.Data.SQLite.SQLiteConnection]
      incr ::count(0)
    }
  }

  saveEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv

  unset -nocomplain env(No_SQLiteLog)
  unset -nocomplain env(Initialize_SQLiteLog)
} -body {
  set count(1) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount]

  set count(2) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _attemptedInitialize]

  tputs $test_channel [appendArgs \
      "---- starting with call count " $count(1) " and attempt count " \
      $count(2) \n]

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount 0

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _attemptedInitialize 0

  for {set i 0} {$i < 20} {incr i} {
    set thread($i) [createThread threadStart false 1048576]
    $thread($i) Name [appendArgs "test data-1.98 #" $i]
  }

  set count(0) 0

  foreach i [array names thread] {
    startThread $thread($i)
  }

  foreach i [array names thread] {
    $thread($i) Join
  }

  list $count(0) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount] [object invoke \
      -flags +NonPublic System.Data.SQLite.SQLiteLog _attemptedInitialize]
} -cleanup {
  restoreEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv

  if {[info exists thread]} then {
    foreach i [array names thread] {
      if {[info exists thread($i)] && [cleanupThread $thread($i)]} then {
        unset -nocomplain thread($i)
      }
    }
  }

  catch {object removecallback threadStart}

  unset -nocomplain thread i count

  rename threadStart ""
} -constraints {eagle command.object SQLite System.Data.SQLite} -result \
{20000 20000 1}}

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

runTest {test data-1.99 {SQLiteLog initialize (disabled)} -setup {
  #
  # NOTE: Make sure that SQLite core library is completely shutdown prior to
  #       starting this test.
  #
  shutdownSQLite $test_channel

  proc threadStart {} {
    for {set i 0} {$i < 1000} {incr i} {
      set c($i) [object create System.Data.SQLite.SQLiteConnection]
      incr ::count(0)
    }
  }

  saveEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv

  set env(No_SQLiteLog) 1
  unset -nocomplain env(Initialize_SQLiteLog)
} -body {
  set count(1) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount]

  set count(2) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _attemptedInitialize]

  tputs $test_channel [appendArgs \
      "---- starting with call count " $count(1) " and attempt count " \
      $count(2) \n]

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount 0

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _attemptedInitialize 0

  for {set i 0} {$i < 20} {incr i} {
    set thread($i) [createThread threadStart false 1048576]
    $thread($i) Name [appendArgs "test data-1.99 #" $i]
  }

  set count(0) 0

  foreach i [array names thread] {
    startThread $thread($i)
  }

  foreach i [array names thread] {
    $thread($i) Join
  }

  list $count(0) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount] [object invoke \
      -flags +NonPublic System.Data.SQLite.SQLiteLog _attemptedInitialize]
} -cleanup {
  restoreEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv

  if {[info exists thread]} then {
    foreach i [array names thread] {
      if {[info exists thread($i)] && [cleanupThread $thread($i)]} then {
        unset -nocomplain thread($i)
      }
    }
  }

  catch {object removecallback threadStart}

  unset -nocomplain thread i count

  rename threadStart ""
} -constraints {eagle command.object SQLite System.Data.SQLite} -result \
{20000 0 0}}

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

runTest {test data-1.100 {SQLiteLog forced initialize (enabled)} -setup {
  #
  # NOTE: Make sure that SQLite core library is completely shutdown prior to
  #       starting this test.
  #
  shutdownSQLite $test_channel

  proc threadStart {} {
    for {set i 0} {$i < 1000} {incr i} {
      set c($i) [object create System.Data.SQLite.SQLiteConnection]
      incr ::count(0)
    }
  }

  saveEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv

  unset -nocomplain env(No_SQLiteLog)
  set env(Initialize_SQLiteLog) 1
} -body {
  set count(1) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount]

  set count(2) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _attemptedInitialize]

  tputs $test_channel [appendArgs \
      "---- starting with call count " $count(1) " and attempt count " \
      $count(2) \n]

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount 0

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _attemptedInitialize 0

  for {set i 0} {$i < 20} {incr i} {
    set thread($i) [createThread threadStart false 1048576]
    $thread($i) Name [appendArgs "test data-1.100 #" $i]
  }

  set count(0) 0

  foreach i [array names thread] {
    startThread $thread($i)
  }

  foreach i [array names thread] {
    $thread($i) Join
  }

  list $count(0) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount] [object invoke \
      -flags +NonPublic System.Data.SQLite.SQLiteLog _attemptedInitialize]
} -cleanup {
  restoreEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv

  if {[info exists thread]} then {
    foreach i [array names thread] {
      if {[info exists thread($i)] && [cleanupThread $thread($i)]} then {
        unset -nocomplain thread($i)
      }
    }
................................................................................

  catch {object removecallback threadStart}

  unset -nocomplain thread i count

  rename threadStart ""
} -constraints {eagle command.object SQLite System.Data.SQLite} -result \
{20000 20000 0}}

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

runTest {test data-1.101 {SQLiteLog forced initialize (disabled)} -setup {
  #
  # NOTE: Make sure that SQLite core library is completely shutdown prior to
  #       starting this test.
  #
  shutdownSQLite $test_channel

  proc threadStart {} {
    for {set i 0} {$i < 1000} {incr i} {
      set c($i) [object create System.Data.SQLite.SQLiteConnection]
      incr ::count(0)
    }
  }

  saveEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv

  set env(No_SQLiteLog) 1
  set env(Initialize_SQLiteLog) 1
} -body {
  set count(1) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount]

  set count(2) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _attemptedInitialize]

  tputs $test_channel [appendArgs \
      "---- starting with call count " $count(1) " and attempt count " \
      $count(2) \n]

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount 0

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _attemptedInitialize 0

  for {set i 0} {$i < 20} {incr i} {
    set thread($i) [createThread threadStart false 1048576]
    $thread($i) Name [appendArgs "test data-1.101 #" $i]
  }

  set count(0) 0

  foreach i [array names thread] {
    startThread $thread($i)
  }

  foreach i [array names thread] {
    $thread($i) Join
  }

  list $count(0) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount] [object invoke \
      -flags +NonPublic System.Data.SQLite.SQLiteLog _attemptedInitialize]
} -cleanup {
  restoreEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv

  if {[info exists thread]} then {
    foreach i [array names thread] {
      if {[info exists thread($i)] && [cleanupThread $thread($i)]} then {
        unset -nocomplain thread($i)
      }
    }
................................................................................

  catch {object removecallback threadStart}

  unset -nocomplain thread i count

  rename threadStart ""
} -constraints {eagle command.object SQLite System.Data.SQLite} -result \
{20000 0 0}}

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

reportSQLiteResources $test_channel

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

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue