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

Changes to Tests/tkt-72905c9a77.eagle.

92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
...
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
...
143
144
145
146
147
148
149








150
151
152
153
154
155
156
...
271
272
273
274
275
276
277

278
279
280
281
282
283
284
285
            //       order to lookup the primary method used for this test (via
            //       reflection).  This is only necessary because the method
            //       under test is private and cannot normally be executed from
            //       C# directly.  If this fails, the following statement will
            //       throw a NullReferenceException, which is fine as that will
            //       cause the whole test to fail.
            //
            Type type = Type.GetType("System.Data.SQLite.SQLite3, " +
                "System.Data.SQLite");

            //
            // NOTE: Attempt to lookup the method object for the private method
            //       we need for this test.  If this fails, the first attempt
            //       to invoke the method using this variable will throw a
            //       NullReferenceException, which is fine as that will cause
            //       the whole test to fail.
................................................................................
              //       chance of triggering the race condition being tested.
              //       However, since this test was originally designed on a
              //       machine with 4 processors, limit the total number of
              //       threads to 16.
              //
              int count = Math.Min(4 * Environment.ProcessorCount, 16);

              //
              // NOTE: Create a random number generator suitable for waiting a
              //       random number of milliseconds between each attempt to
              //       cause the race condition on a given thread.
              //
              Random random = new Random();

              //
              // NOTE: Create a (reusable) delegate that will contain the code
              //       that each created thread is to execute.
              //
              ThreadStart threadStart = delegate()
              {
                try
................................................................................
                {
                  //
                  // NOTE: Wait forever for the "GO" signal so that all threads
                  //       can start working at approximately the same time.
                  //
                  goEvent.WaitOne();









                  //
                  // NOTE: Force the SQLiteLog.StaticIsInitialized method to
                  //       be repeatedly called on every thread right away to
                  //       thoroughly test its locking semantics.  Also, use a
                  //       random delay, in milliseconds, between zero and the
                  //       number of test threads squared after each attempt.
                  //
................................................................................
      [expr {$code eq "Ok" ? [catch {
        object invoke _Dynamic${id}.Test${id} GetTraceOutput
      } result] : [set result ""]}] [string map [list \r\n \n] $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors dataSource fileName

} -constraints [fixConstraints {eagle monoBug28 configuration.Release\
!defineConstant.System.Data.SQLite.INTEROP_LOG command.sql compile.DATA\
SQLite System.Data.SQLite compileCSharp}] -match regexp -result [appendArgs \
"^Ok System#CodeDom#Compiler#CompilerResults#\\d+ \\{\\} 0 \\{" [string repeat \
"SQLite message \\(0\\): TEST $id
" [expr {min(4 * [info processors], 16)}]] "\\}\$"]}

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







|
|







 







<
<
<
<
<
<
<







 







>
>
>
>
>
>
>
>







 







>
|







92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
...
122
123
124
125
126
127
128







129
130
131
132
133
134
135
...
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
...
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
            //       order to lookup the primary method used for this test (via
            //       reflection).  This is only necessary because the method
            //       under test is private and cannot normally be executed from
            //       C# directly.  If this fails, the following statement will
            //       throw a NullReferenceException, which is fine as that will
            //       cause the whole test to fail.
            //
            Type type = Type.GetType(
                "System.Data.SQLite.SQLite3, System.Data.SQLite");

            //
            // NOTE: Attempt to lookup the method object for the private method
            //       we need for this test.  If this fails, the first attempt
            //       to invoke the method using this variable will throw a
            //       NullReferenceException, which is fine as that will cause
            //       the whole test to fail.
................................................................................
              //       chance of triggering the race condition being tested.
              //       However, since this test was originally designed on a
              //       machine with 4 processors, limit the total number of
              //       threads to 16.
              //
              int count = Math.Min(4 * Environment.ProcessorCount, 16);








              //
              // NOTE: Create a (reusable) delegate that will contain the code
              //       that each created thread is to execute.
              //
              ThreadStart threadStart = delegate()
              {
                try
................................................................................
                {
                  //
                  // NOTE: Wait forever for the "GO" signal so that all threads
                  //       can start working at approximately the same time.
                  //
                  goEvent.WaitOne();

                  //
                  // NOTE: Create a pseudorandom number generator suitable for
                  //       waiting a random number of milliseconds between each
                  //       attempt to cause the race condition being tested on
                  //       a given thread.
                  //
                  Random random = new Random();

                  //
                  // NOTE: Force the SQLiteLog.StaticIsInitialized method to
                  //       be repeatedly called on every thread right away to
                  //       thoroughly test its locking semantics.  Also, use a
                  //       random delay, in milliseconds, between zero and the
                  //       number of test threads squared after each attempt.
                  //
................................................................................
      [expr {$code eq "Ok" ? [catch {
        object invoke _Dynamic${id}.Test${id} GetTraceOutput
      } result] : [set result ""]}] [string map [list \r\n \n] $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors dataSource fileName
} -constraints \
[fixConstraints {fail.false eagle monoBug28 configuration.Release\
!defineConstant.System.Data.SQLite.INTEROP_LOG command.sql compile.DATA\
SQLite System.Data.SQLite compileCSharp}] -match regexp -result [appendArgs \
"^Ok System#CodeDom#Compiler#CompilerResults#\\d+ \\{\\} 0 \\{" [string repeat \
"SQLite message \\(0\\): TEST $id
" [expr {min(4 * [info processors], 16)}]] "\\}\$"]}

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