System.Data.SQLite
Check-in [6220096d79]
Not logged in

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

Overview
Comment:Make the test for ticket [72905c9a77] a bit more robust and prevent it from halting the test run.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6220096d79c50dac69417288794aae19b6705015
User & Date: mistachkin 2014-02-12 04:29:35
Context
2014-02-12
21:44
Final updates for release 1.0.91.0. check-in: a6e03b2119 user: mistachkin tags: trunk, release, release-1.0.91.0
04:29
Make the test for ticket [72905c9a77] a bit more robust and prevent it from halting the test run. check-in: 6220096d79 user: mistachkin tags: trunk
2014-02-11
20:44
Update SQLite core library to 3.8.3.1 release. check-in: 2bdeb7584b user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Tests/tkt-72905c9a77.eagle.

    92     92               //       order to lookup the primary method used for this test (via
    93     93               //       reflection).  This is only necessary because the method
    94     94               //       under test is private and cannot normally be executed from
    95     95               //       C# directly.  If this fails, the following statement will
    96     96               //       throw a NullReferenceException, which is fine as that will
    97     97               //       cause the whole test to fail.
    98     98               //
    99         -            Type type = Type.GetType("System.Data.SQLite.SQLite3, " +
   100         -                "System.Data.SQLite");
           99  +            Type type = Type.GetType(
          100  +                "System.Data.SQLite.SQLite3, System.Data.SQLite");
   101    101   
   102    102               //
   103    103               // NOTE: Attempt to lookup the method object for the private method
   104    104               //       we need for this test.  If this fails, the first attempt
   105    105               //       to invoke the method using this variable will throw a
   106    106               //       NullReferenceException, which is fine as that will cause
   107    107               //       the whole test to fail.
................................................................................
   122    122                 //       chance of triggering the race condition being tested.
   123    123                 //       However, since this test was originally designed on a
   124    124                 //       machine with 4 processors, limit the total number of
   125    125                 //       threads to 16.
   126    126                 //
   127    127                 int count = Math.Min(4 * Environment.ProcessorCount, 16);
   128    128   
   129         -              //
   130         -              // NOTE: Create a random number generator suitable for waiting a
   131         -              //       random number of milliseconds between each attempt to
   132         -              //       cause the race condition on a given thread.
   133         -              //
   134         -              Random random = new Random();
   135         -
   136    129                 //
   137    130                 // NOTE: Create a (reusable) delegate that will contain the code
   138    131                 //       that each created thread is to execute.
   139    132                 //
   140    133                 ThreadStart threadStart = delegate()
   141    134                 {
   142    135                   try
................................................................................
   143    136                   {
   144    137                     //
   145    138                     // NOTE: Wait forever for the "GO" signal so that all threads
   146    139                     //       can start working at approximately the same time.
   147    140                     //
   148    141                     goEvent.WaitOne();
   149    142   
          143  +                  //
          144  +                  // NOTE: Create a pseudorandom number generator suitable for
          145  +                  //       waiting a random number of milliseconds between each
          146  +                  //       attempt to cause the race condition being tested on
          147  +                  //       a given thread.
          148  +                  //
          149  +                  Random random = new Random();
          150  +
   150    151                     //
   151    152                     // NOTE: Force the SQLiteLog.StaticIsInitialized method to
   152    153                     //       be repeatedly called on every thread right away to
   153    154                     //       thoroughly test its locking semantics.  Also, use a
   154    155                     //       random delay, in milliseconds, between zero and the
   155    156                     //       number of test threads squared after each attempt.
   156    157                     //
................................................................................
   271    272         [expr {$code eq "Ok" ? [catch {
   272    273           object invoke _Dynamic${id}.Test${id} GetTraceOutput
   273    274         } result] : [set result ""]}] [string map [list \r\n \n] $result]
   274    275   } -cleanup {
   275    276     cleanupDb $fileName
   276    277   
   277    278     unset -nocomplain result code results errors dataSource fileName
   278         -} -constraints [fixConstraints {eagle monoBug28 configuration.Release\
          279  +} -constraints \
          280  +[fixConstraints {fail.false eagle monoBug28 configuration.Release\
   279    281   !defineConstant.System.Data.SQLite.INTEROP_LOG command.sql compile.DATA\
   280    282   SQLite System.Data.SQLite compileCSharp}] -match regexp -result [appendArgs \
   281    283   "^Ok System#CodeDom#Compiler#CompilerResults#\\d+ \\{\\} 0 \\{" [string repeat \
   282    284   "SQLite message \\(0\\): TEST $id
   283    285   " [expr {min(4 * [info processors], 16)}]] "\\}\$"]}
   284    286   
   285    287   ###############################################################################