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 Side-by-Side Diffs Show Whitespace Changes Patch

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

   205    205                       return;
   206    206                   }
   207    207               }
   208    208   
   209    209               ///////////////////////////////////////////////////////////////////
   210    210   
   211    211               //
   212         -            // BUFXIX: We cannot initialize the logging interface if the SQLite
          212  +            // BUFXIX: Cannot initialize the logging interface if the SQLite
   213    213               //         core library has already been initialized anywhere in
   214    214               //         the process (see ticket [2ce0870fad]).
   215    215               //
   216    216               if (SQLite3.StaticIsInitialized())
   217    217                   return;
   218    218   
   219    219               ///////////////////////////////////////////////////////////////////

Changes to Tests/basic.eagle.

  5136   5136     unset -nocomplain error code db fileName
  5137   5137   } -constraints \
  5138   5138   {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
  5139   5139   {1 {attempt to write a readonly database} 0 1 4}}
  5140   5140   
  5141   5141   ###############################################################################
  5142   5142   
  5143         -runTest {test data-1.98 {create SQLiteConnection objects w/logging} -setup {
         5143  +runTest {test data-1.98 {SQLiteLog initialize (enabled)} -setup {
         5144  +  #
         5145  +  # NOTE: Make sure that SQLite core library is completely shutdown prior to
         5146  +  #       starting this test.
         5147  +  #
         5148  +  shutdownSQLite $test_channel
         5149  +
  5144   5150     proc threadStart {} {
  5145   5151       for {set i 0} {$i < 1000} {incr i} {
  5146   5152         set c($i) [object create System.Data.SQLite.SQLiteConnection]
  5147         -      incr ::count
         5153  +      incr ::count(0)
  5148   5154       }
  5149   5155     }
  5150   5156   
  5151         -  saveEnvironmentVariables [list No_SQLiteLog] savedEnv
         5157  +  saveEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv
  5152   5158   
  5153   5159     unset -nocomplain env(No_SQLiteLog)
         5160  +  unset -nocomplain env(Initialize_SQLiteLog)
  5154   5161   } -body {
         5162  +  set count(1) [object invoke -flags +NonPublic \
         5163  +      System.Data.SQLite.SQLiteLog _initializeCallCount]
         5164  +
         5165  +  set count(2) [object invoke -flags +NonPublic \
         5166  +      System.Data.SQLite.SQLiteLog _attemptedInitialize]
         5167  +
         5168  +  tputs $test_channel [appendArgs \
         5169  +      "---- starting with call count " $count(1) " and attempt count " \
         5170  +      $count(2) \n]
         5171  +
  5155   5172     object invoke -flags +NonPublic \
  5156   5173         System.Data.SQLite.SQLiteLog _initializeCallCount 0
  5157   5174   
         5175  +  object invoke -flags +NonPublic \
         5176  +      System.Data.SQLite.SQLiteLog _attemptedInitialize 0
         5177  +
  5158   5178     for {set i 0} {$i < 20} {incr i} {
  5159   5179       set thread($i) [createThread threadStart false 1048576]
  5160   5180       $thread($i) Name [appendArgs "test data-1.98 #" $i]
  5161   5181     }
  5162   5182   
  5163         -  set count 0
         5183  +  set count(0) 0
         5184  +
         5185  +  foreach i [array names thread] {
         5186  +    startThread $thread($i)
         5187  +  }
         5188  +
         5189  +  foreach i [array names thread] {
         5190  +    $thread($i) Join
         5191  +  }
         5192  +
         5193  +  list $count(0) [object invoke -flags +NonPublic \
         5194  +      System.Data.SQLite.SQLiteLog _initializeCallCount] [object invoke \
         5195  +      -flags +NonPublic System.Data.SQLite.SQLiteLog _attemptedInitialize]
         5196  +} -cleanup {
         5197  +  restoreEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv
         5198  +
         5199  +  if {[info exists thread]} then {
         5200  +    foreach i [array names thread] {
         5201  +      if {[info exists thread($i)] && [cleanupThread $thread($i)]} then {
         5202  +        unset -nocomplain thread($i)
         5203  +      }
         5204  +    }
         5205  +  }
         5206  +
         5207  +  catch {object removecallback threadStart}
         5208  +
         5209  +  unset -nocomplain thread i count
         5210  +
         5211  +  rename threadStart ""
         5212  +} -constraints {eagle command.object SQLite System.Data.SQLite} -result \
         5213  +{20000 20000 1}}
         5214  +
         5215  +###############################################################################
         5216  +
         5217  +runTest {test data-1.99 {SQLiteLog initialize (disabled)} -setup {
         5218  +  #
         5219  +  # NOTE: Make sure that SQLite core library is completely shutdown prior to
         5220  +  #       starting this test.
         5221  +  #
         5222  +  shutdownSQLite $test_channel
         5223  +
         5224  +  proc threadStart {} {
         5225  +    for {set i 0} {$i < 1000} {incr i} {
         5226  +      set c($i) [object create System.Data.SQLite.SQLiteConnection]
         5227  +      incr ::count(0)
         5228  +    }
         5229  +  }
         5230  +
         5231  +  saveEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv
         5232  +
         5233  +  set env(No_SQLiteLog) 1
         5234  +  unset -nocomplain env(Initialize_SQLiteLog)
         5235  +} -body {
         5236  +  set count(1) [object invoke -flags +NonPublic \
         5237  +      System.Data.SQLite.SQLiteLog _initializeCallCount]
         5238  +
         5239  +  set count(2) [object invoke -flags +NonPublic \
         5240  +      System.Data.SQLite.SQLiteLog _attemptedInitialize]
         5241  +
         5242  +  tputs $test_channel [appendArgs \
         5243  +      "---- starting with call count " $count(1) " and attempt count " \
         5244  +      $count(2) \n]
         5245  +
         5246  +  object invoke -flags +NonPublic \
         5247  +      System.Data.SQLite.SQLiteLog _initializeCallCount 0
         5248  +
         5249  +  object invoke -flags +NonPublic \
         5250  +      System.Data.SQLite.SQLiteLog _attemptedInitialize 0
         5251  +
         5252  +  for {set i 0} {$i < 20} {incr i} {
         5253  +    set thread($i) [createThread threadStart false 1048576]
         5254  +    $thread($i) Name [appendArgs "test data-1.99 #" $i]
         5255  +  }
         5256  +
         5257  +  set count(0) 0
         5258  +
         5259  +  foreach i [array names thread] {
         5260  +    startThread $thread($i)
         5261  +  }
         5262  +
         5263  +  foreach i [array names thread] {
         5264  +    $thread($i) Join
         5265  +  }
         5266  +
         5267  +  list $count(0) [object invoke -flags +NonPublic \
         5268  +      System.Data.SQLite.SQLiteLog _initializeCallCount] [object invoke \
         5269  +      -flags +NonPublic System.Data.SQLite.SQLiteLog _attemptedInitialize]
         5270  +} -cleanup {
         5271  +  restoreEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv
         5272  +
         5273  +  if {[info exists thread]} then {
         5274  +    foreach i [array names thread] {
         5275  +      if {[info exists thread($i)] && [cleanupThread $thread($i)]} then {
         5276  +        unset -nocomplain thread($i)
         5277  +      }
         5278  +    }
         5279  +  }
         5280  +
         5281  +  catch {object removecallback threadStart}
         5282  +
         5283  +  unset -nocomplain thread i count
         5284  +
         5285  +  rename threadStart ""
         5286  +} -constraints {eagle command.object SQLite System.Data.SQLite} -result \
         5287  +{20000 0 0}}
         5288  +
         5289  +###############################################################################
         5290  +
         5291  +runTest {test data-1.100 {SQLiteLog forced initialize (enabled)} -setup {
         5292  +  #
         5293  +  # NOTE: Make sure that SQLite core library is completely shutdown prior to
         5294  +  #       starting this test.
         5295  +  #
         5296  +  shutdownSQLite $test_channel
         5297  +
         5298  +  proc threadStart {} {
         5299  +    for {set i 0} {$i < 1000} {incr i} {
         5300  +      set c($i) [object create System.Data.SQLite.SQLiteConnection]
         5301  +      incr ::count(0)
         5302  +    }
         5303  +  }
         5304  +
         5305  +  saveEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv
         5306  +
         5307  +  unset -nocomplain env(No_SQLiteLog)
         5308  +  set env(Initialize_SQLiteLog) 1
         5309  +} -body {
         5310  +  set count(1) [object invoke -flags +NonPublic \
         5311  +      System.Data.SQLite.SQLiteLog _initializeCallCount]
         5312  +
         5313  +  set count(2) [object invoke -flags +NonPublic \
         5314  +      System.Data.SQLite.SQLiteLog _attemptedInitialize]
         5315  +
         5316  +  tputs $test_channel [appendArgs \
         5317  +      "---- starting with call count " $count(1) " and attempt count " \
         5318  +      $count(2) \n]
         5319  +
         5320  +  object invoke -flags +NonPublic \
         5321  +      System.Data.SQLite.SQLiteLog _initializeCallCount 0
         5322  +
         5323  +  object invoke -flags +NonPublic \
         5324  +      System.Data.SQLite.SQLiteLog _attemptedInitialize 0
         5325  +
         5326  +  for {set i 0} {$i < 20} {incr i} {
         5327  +    set thread($i) [createThread threadStart false 1048576]
         5328  +    $thread($i) Name [appendArgs "test data-1.100 #" $i]
         5329  +  }
         5330  +
         5331  +  set count(0) 0
  5164   5332   
  5165   5333     foreach i [array names thread] {
  5166   5334       startThread $thread($i)
  5167   5335     }
  5168   5336   
  5169   5337     foreach i [array names thread] {
  5170   5338       $thread($i) Join
  5171   5339     }
  5172   5340   
  5173         -  list $count [object invoke -flags +NonPublic \
  5174         -      System.Data.SQLite.SQLiteLog _initializeCallCount]
         5341  +  list $count(0) [object invoke -flags +NonPublic \
         5342  +      System.Data.SQLite.SQLiteLog _initializeCallCount] [object invoke \
         5343  +      -flags +NonPublic System.Data.SQLite.SQLiteLog _attemptedInitialize]
  5175   5344   } -cleanup {
  5176         -  restoreEnvironmentVariables [list No_SQLiteLog] savedEnv
         5345  +  restoreEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv
  5177   5346   
  5178   5347     if {[info exists thread]} then {
  5179   5348       foreach i [array names thread] {
  5180   5349         if {[info exists thread($i)] && [cleanupThread $thread($i)]} then {
  5181   5350           unset -nocomplain thread($i)
  5182   5351         }
  5183   5352       }
................................................................................
  5185   5354   
  5186   5355     catch {object removecallback threadStart}
  5187   5356   
  5188   5357     unset -nocomplain thread i count
  5189   5358   
  5190   5359     rename threadStart ""
  5191   5360   } -constraints {eagle command.object SQLite System.Data.SQLite} -result \
  5192         -{20000 20000}}
         5361  +{20000 20000 0}}
  5193   5362   
  5194   5363   ###############################################################################
  5195   5364   
  5196         -runTest {test data-1.99 {create SQLiteConnection objects w/o logging} -setup {
         5365  +runTest {test data-1.101 {SQLiteLog forced initialize (disabled)} -setup {
         5366  +  #
         5367  +  # NOTE: Make sure that SQLite core library is completely shutdown prior to
         5368  +  #       starting this test.
         5369  +  #
         5370  +  shutdownSQLite $test_channel
         5371  +
  5197   5372     proc threadStart {} {
  5198   5373       for {set i 0} {$i < 1000} {incr i} {
  5199   5374         set c($i) [object create System.Data.SQLite.SQLiteConnection]
  5200         -      incr ::count
         5375  +      incr ::count(0)
  5201   5376       }
  5202   5377     }
  5203   5378   
  5204         -  saveEnvironmentVariables [list No_SQLiteLog] savedEnv
         5379  +  saveEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv
  5205   5380   
  5206   5381     set env(No_SQLiteLog) 1
         5382  +  set env(Initialize_SQLiteLog) 1
  5207   5383   } -body {
         5384  +  set count(1) [object invoke -flags +NonPublic \
         5385  +      System.Data.SQLite.SQLiteLog _initializeCallCount]
         5386  +
         5387  +  set count(2) [object invoke -flags +NonPublic \
         5388  +      System.Data.SQLite.SQLiteLog _attemptedInitialize]
         5389  +
         5390  +  tputs $test_channel [appendArgs \
         5391  +      "---- starting with call count " $count(1) " and attempt count " \
         5392  +      $count(2) \n]
         5393  +
  5208   5394     object invoke -flags +NonPublic \
  5209   5395         System.Data.SQLite.SQLiteLog _initializeCallCount 0
  5210   5396   
         5397  +  object invoke -flags +NonPublic \
         5398  +      System.Data.SQLite.SQLiteLog _attemptedInitialize 0
         5399  +
  5211   5400     for {set i 0} {$i < 20} {incr i} {
  5212   5401       set thread($i) [createThread threadStart false 1048576]
  5213         -    $thread($i) Name [appendArgs "test data-1.99 #" $i]
         5402  +    $thread($i) Name [appendArgs "test data-1.101 #" $i]
  5214   5403     }
  5215   5404   
  5216         -  set count 0
         5405  +  set count(0) 0
  5217   5406   
  5218   5407     foreach i [array names thread] {
  5219   5408       startThread $thread($i)
  5220   5409     }
  5221   5410   
  5222   5411     foreach i [array names thread] {
  5223   5412       $thread($i) Join
  5224   5413     }
  5225   5414   
  5226         -  list $count [object invoke -flags +NonPublic \
  5227         -      System.Data.SQLite.SQLiteLog _initializeCallCount]
         5415  +  list $count(0) [object invoke -flags +NonPublic \
         5416  +      System.Data.SQLite.SQLiteLog _initializeCallCount] [object invoke \
         5417  +      -flags +NonPublic System.Data.SQLite.SQLiteLog _attemptedInitialize]
  5228   5418   } -cleanup {
  5229         -  restoreEnvironmentVariables [list No_SQLiteLog] savedEnv
         5419  +  restoreEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv
  5230   5420   
  5231   5421     if {[info exists thread]} then {
  5232   5422       foreach i [array names thread] {
  5233   5423         if {[info exists thread($i)] && [cleanupThread $thread($i)]} then {
  5234   5424           unset -nocomplain thread($i)
  5235   5425         }
  5236   5426       }
................................................................................
  5238   5428   
  5239   5429     catch {object removecallback threadStart}
  5240   5430   
  5241   5431     unset -nocomplain thread i count
  5242   5432   
  5243   5433     rename threadStart ""
  5244   5434   } -constraints {eagle command.object SQLite System.Data.SQLite} -result \
  5245         -{20000 0}}
         5435  +{20000 0 0}}
  5246   5436   
  5247   5437   ###############################################################################
  5248   5438   
  5249   5439   reportSQLiteResources $test_channel
  5250   5440   
  5251   5441   ###############################################################################
  5252   5442   
  5253   5443   runSQLiteTestFilesEpilogue
  5254   5444   runSQLiteTestEpilogue
  5255   5445   runTestEpilogue