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

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

Overview
Comment:Allow trace logging to a file to be disabled in the stress test. Display and log values of test overrides specified on the command line.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ecd7bb07225eeb0cbc6820b1a17abb4e2031b552
User & Date: mistachkin 2012-10-15 06:54:30
Context
2012-10-15
12:56
Test suite infrastructure enhancements. check-in: 91e1dcb907 user: mistachkin tags: trunk
06:54
Allow trace logging to a file to be disabled in the stress test. Display and log values of test overrides specified on the command line. check-in: ecd7bb0722 user: mistachkin tags: trunk
06:19
Add stress test workload to change the database journal mode. check-in: 0771490908 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Externals/Eagle/lib/Eagle1.0/vendor.eagle.

41
42
43
44
45
46
47
48

49
50
51
52
53
54
55
...
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
...
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
          continue
        }

        incr result

        if {!$quiet} then {
          tqputs $channel [appendArgs \
              "---- found vendor-specific test override \"" $varName "\".\n"]

        }
      }

      #
      # NOTE: Keep track of the list of test override variables, for later
      #       use by the test suite.  This needs to be done after the loop
      #       above because the variable used to keep track is listed with
................................................................................
      }

      #
      # NOTE: If we have NOT been instructed to be quiet, report now.
      #
      if {!$quiet} then {
        tqputs $channel \
            "---- could not find vendor-specific test package directory.\n"
      }

      #
      # NOTE: Directory not found, return failure.
      #
      return false
    }
................................................................................
          TestPath]

      if {$dir ne $testPath} then {
        object invoke -flags +NonPublic Interpreter.GetActive TestPath $dir

        if {!$quiet} then {
          tqputs $channel [appendArgs \
              "---- set interpreter test path to \"" $dir \".\n]
        }
      }
    }
 
    #
    # NOTE: Check for any overridden settings that may have been specified via
    #       the command line, etc.







|
>







 







|







 







|







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
...
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
...
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
          continue
        }

        incr result

        if {!$quiet} then {
          tqputs $channel [appendArgs \
              "---- found vendor-specific test override \"" $varName \
              "\" with value \"" [uplevel 1 [list set $varName]] \"\n]
        }
      }

      #
      # NOTE: Keep track of the list of test override variables, for later
      #       use by the test suite.  This needs to be done after the loop
      #       above because the variable used to keep track is listed with
................................................................................
      }

      #
      # NOTE: If we have NOT been instructed to be quiet, report now.
      #
      if {!$quiet} then {
        tqputs $channel \
            "---- could not find vendor-specific test package directory\n"
      }

      #
      # NOTE: Directory not found, return failure.
      #
      return false
    }
................................................................................
          TestPath]

      if {$dir ne $testPath} then {
        object invoke -flags +NonPublic Interpreter.GetActive TestPath $dir

        if {!$quiet} then {
          tqputs $channel [appendArgs \
              "---- set interpreter test path to \"" $dir \"\n]
        }
      }
    }
 
    #
    # NOTE: Check for any overridden settings that may have been specified via
    #       the command line, etc.

Changes to Tests/stress.eagle.

28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
...
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
212
...
213
214
215
216
217
218
219

220
221
222
223
224
225
226
...
233
234
235
236
237
238
239
240

241
242
243
244
245
246
247
248
249
250
251
















252
253
254
255
256
257
258
...
285
286
287
288
289
290
291




292
293
294
295
296
297
298
....
1029
1030
1031
1032
1033
1034
1035

1036

1037
1038
1039
1040
1041
1042
1043
....
1082
1083
1084
1085
1086
1087
1088

1089

1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105

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

runTest {test stress-1.1 {multithreaded stress testing} -setup {
  unset -nocomplain result thread index workload priority noWorkload \
      priorities srcDb db fileName compiled options count times logFileName \
      logListener connection indicators iterations exitOnFail coTaskMem \
      failures

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

  proc formatWorkloadResult { index } {
    set result [appendArgs "---- iterations for workload (" $index "): "]

    append result [expr {[info exists ::iterations($index,ok)] ? \
................................................................................

    tputs $::test_channel [appendArgs \
        "---- disabled SQLite trace logging to file \"" $fileName \"\n]
  }

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

  #
  # NOTE: The trace listener used with the SQLiteLog class to capture output
  #       from the core SQLite library requires its own log file because the
  #       TextWriterTraceListener class opens and locks the log file it uses
  #       as the basis of the output stream.  Before this test is complete,
  #       the entire contents of this trace log file will be copied into the
  #       main test log file and then deleted.
  #
  set logFileName [appendArgs [file rootname $test_log] .trace.log]
  setupLogging $logFileName

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

  #
  # NOTE: Setup the default values for the tunable workload parameters.  Any,
  #       all, or none of these may be overriden via the command line.
  #
  set count(0) 1;         # Workload repeat count (i.e. total full runs).
  set count(1) 20;        # Workload iteration count (i.e. within a run).
  set count(2) 500;       # Workload iteration delay, in milliseconds.
................................................................................
  set count(3) 2000;      # Workload "small" data chunk size, in bytes.
  set count(4) 10000000;  # Workload "big" data chunk size, in bytes.
  set count(5) 314572800; # Maximum heap memory to exclude at one time.
  set noWorkload [list];  # Workloads to be omitted from the run, by index.
  set priorities [list];  # Dictionary of workload thread priorities.
  set exitOnFail true;    # Halt testing and exit process on test failure?
  set coTaskMem true;     # Use AllocCoTaskMem/FreeCoTaskMem for memory?


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

  #
  # NOTE: If command line arguments to the test suite are available, process
  #       them for any options that are applicable to this test (i.e. any of
  #       the tunable workload parameters listed above).
................................................................................
        [list null MustHaveIntegerValue -1 -1 -count2 $count(2)] \
        [list null MustHaveIntegerValue -1 -1 -count3 $count(3)] \
        [list null MustHaveIntegerValue -1 -1 -count4 $count(4)] \
        [list null MustHaveIntegerValue -1 -1 -count5 $count(5)] \
        [list null MustHaveListValue -1 -1 -noWorkload $noWorkload] \
        [list null MustHaveListValue -1 -1 -priorities $priorities] \
        [list null MustHaveBooleanValue -1 -1 -exitOnFail $exitOnFail] \
        [list null MustHaveBooleanValue -1 -1 -coTaskMem $coTaskMem]] $argv


    set count(0) $options(-count0,value)
    set count(1) $options(-count1,value)
    set count(2) $options(-count2,value)
    set count(3) $options(-count3,value)
    set count(4) $options(-count4,value)
    set count(5) $options(-count5,value)
    set noWorkload $options(-noWorkload,value)
    set priorities $options(-priorities,value)
    set exitOnFail $options(-exitOnFail,value)
    set coTaskMem $options(-coTaskMem,value)
















  }

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

  tputs $test_channel [appendArgs \
      "---- workloads will repeat " $count(0) " time(s)\n"]

................................................................................
      [expr {$exitOnFail ? "will" : "will not"}] \
      " halt testing and exit the process\n"]

  tputs $test_channel [appendArgs \
      "---- the " [expr {$coTaskMem ? "CoTaskMem" : "SQLite"}] \
      " allocator will be used to exclude heap memory\n"]





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

  #
  # NOTE: Create the workload priority array based on the priority list seen
  #       on the command line, if any.
  #
  array set priority $priorities
................................................................................
          "---- no times for workload (" $index(0) ")\n"]
    }
  }

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

  foreach index(0) [lsort -integer [array names workload]] {

    tputs $test_channel [formatWorkloadResult $index(0)]

  }

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

  set result [sql execute -execute scalar $srcDb "PRAGMA integrity_check;"]

  if {$result eq "ok"} then {
................................................................................
      object removecallback [list apply $workload($index(0)) $fileName(1) \
          $fileName(2) t1 $count(1) $count(3) $count(4)]
    }
  }

  freeDbConnection


  cleanupLogging $logFileName


  rename cleanupLogging ""
  rename setupLogging ""

  unset -nocomplain result thread index workload priority noWorkload \
      priorities srcDb db fileName compiled options count times logFileName \
      logListener connection indicators iterations exitOnFail coTaskMem \
      failures
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
-result {0}}

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

runSQLiteTestEpilogue
runTestEpilogue







|







 







<
<
<
<
<
<
<
<
<
<
<
<
<







 







>







 







|
>











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







 







>
>
>
>







 







>
|
>







 







>
|
>







|








28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
...
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
212
213
214
...
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
...
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
....
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
....
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118

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

runTest {test stress-1.1 {multithreaded stress testing} -setup {
  unset -nocomplain result thread index workload priority noWorkload \
      priorities srcDb db fileName compiled options count times logFileName \
      logListener connection indicators iterations exitOnFail coTaskMem \
      noTrace failures

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

  proc formatWorkloadResult { index } {
    set result [appendArgs "---- iterations for workload (" $index "): "]

    append result [expr {[info exists ::iterations($index,ok)] ? \
................................................................................

    tputs $::test_channel [appendArgs \
        "---- disabled SQLite trace logging to file \"" $fileName \"\n]
  }

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














  #
  # NOTE: Setup the default values for the tunable workload parameters.  Any,
  #       all, or none of these may be overriden via the command line.
  #
  set count(0) 1;         # Workload repeat count (i.e. total full runs).
  set count(1) 20;        # Workload iteration count (i.e. within a run).
  set count(2) 500;       # Workload iteration delay, in milliseconds.
................................................................................
  set count(3) 2000;      # Workload "small" data chunk size, in bytes.
  set count(4) 10000000;  # Workload "big" data chunk size, in bytes.
  set count(5) 314572800; # Maximum heap memory to exclude at one time.
  set noWorkload [list];  # Workloads to be omitted from the run, by index.
  set priorities [list];  # Dictionary of workload thread priorities.
  set exitOnFail true;    # Halt testing and exit process on test failure?
  set coTaskMem true;     # Use AllocCoTaskMem/FreeCoTaskMem for memory?
  set noTrace false;      # Disable SQLite trace logging to a file?

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

  #
  # NOTE: If command line arguments to the test suite are available, process
  #       them for any options that are applicable to this test (i.e. any of
  #       the tunable workload parameters listed above).
................................................................................
        [list null MustHaveIntegerValue -1 -1 -count2 $count(2)] \
        [list null MustHaveIntegerValue -1 -1 -count3 $count(3)] \
        [list null MustHaveIntegerValue -1 -1 -count4 $count(4)] \
        [list null MustHaveIntegerValue -1 -1 -count5 $count(5)] \
        [list null MustHaveListValue -1 -1 -noWorkload $noWorkload] \
        [list null MustHaveListValue -1 -1 -priorities $priorities] \
        [list null MustHaveBooleanValue -1 -1 -exitOnFail $exitOnFail] \
        [list null MustHaveBooleanValue -1 -1 -coTaskMem $coTaskMem] \
        [list null MustHaveBooleanValue -1 -1 -noTrace $noTrace]] $argv

    set count(0) $options(-count0,value)
    set count(1) $options(-count1,value)
    set count(2) $options(-count2,value)
    set count(3) $options(-count3,value)
    set count(4) $options(-count4,value)
    set count(5) $options(-count5,value)
    set noWorkload $options(-noWorkload,value)
    set priorities $options(-priorities,value)
    set exitOnFail $options(-exitOnFail,value)
    set coTaskMem $options(-coTaskMem,value)
    set noTrace $options(-noTrace,value)
  }

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

  #
  # NOTE: The trace listener used with the SQLiteLog class to capture output
  #       from the core SQLite library requires its own log file because the
  #       TextWriterTraceListener class opens and locks the log file it uses
  #       as the basis of the output stream.  Before this test is complete,
  #       the entire contents of this trace log file will be copied into the
  #       main test log file and then deleted.
  #
  if {!$noTrace} then {
    set logFileName [appendArgs [file rootname $test_log] .trace.log]
    setupLogging $logFileName
  }

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

  tputs $test_channel [appendArgs \
      "---- workloads will repeat " $count(0) " time(s)\n"]

................................................................................
      [expr {$exitOnFail ? "will" : "will not"}] \
      " halt testing and exit the process\n"]

  tputs $test_channel [appendArgs \
      "---- the " [expr {$coTaskMem ? "CoTaskMem" : "SQLite"}] \
      " allocator will be used to exclude heap memory\n"]

  tputs $test_channel [appendArgs \
      "---- trace logging to a file is " \
      [expr {$noTrace ? "disabled" : "enabled"}] \n]

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

  #
  # NOTE: Create the workload priority array based on the priority list seen
  #       on the command line, if any.
  #
  array set priority $priorities
................................................................................
          "---- no times for workload (" $index(0) ")\n"]
    }
  }

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

  foreach index(0) [lsort -integer [array names workload]] {
    if {[lsearch -exact $noWorkload $index(0)] == -1} then {
      tputs $test_channel [formatWorkloadResult $index(0)]
    }
  }

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

  set result [sql execute -execute scalar $srcDb "PRAGMA integrity_check;"]

  if {$result eq "ok"} then {
................................................................................
      object removecallback [list apply $workload($index(0)) $fileName(1) \
          $fileName(2) t1 $count(1) $count(3) $count(4)]
    }
  }

  freeDbConnection

  if {!$noTrace} then {
    cleanupLogging $logFileName
  }

  rename cleanupLogging ""
  rename setupLogging ""

  unset -nocomplain result thread index workload priority noWorkload \
      priorities srcDb db fileName compiled options count times logFileName \
      logListener connection indicators iterations exitOnFail coTaskMem \
      noTrace failures
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
-result {0}}

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

runSQLiteTestEpilogue
runTestEpilogue