System.Data.SQLite

Check-in [a81eb9b135]
Login

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

Overview
Comment:Revise handling of errors in the stress test.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a81eb9b135e0fd97bd6acb3536864aa316639181
User & Date: mistachkin 2012-10-13 22:38:54.647
Context
2012-10-14
01:07
Add workload to the stress test that allocates (large amounts of) native heap memory. check-in: 977ba2a5fb user: mistachkin tags: trunk
2012-10-13
22:38
Revise handling of errors in the stress test. check-in: a81eb9b135 user: mistachkin tags: trunk
20:28
Make the stress test failure handling more flexible, add more comments, and improve readability. check-in: 742684b09c user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Tests/stress.eagle.
31
32
33
34
35
36
37
























38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53





54
55
56
57
58



59

60

61
62
63
64
65

66
67
68
69
70
71
72
runTest {test stress-1.1 {multithreaded stress testing} -setup {
  unset -nocomplain result thread index workload noWorkload srcDb db \
      fileName compiled options count times logFileName logListener \
      connection indicators iterations exitOnFail failures

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

























  proc isExpectedError { error } {
    return [expr {[regexp -- {\sno such table: t1\s} $error] || \
        [regexp -- {\sdatabase is locked\s} $error]}]
  }

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

  proc showTest { indicator } {
    tputs $::test_channel $indicator
    append ::indicators $indicator
    after [expr {int(rand() * 1000 + $::count(2))}]
  }

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

  proc failTest { error } {





    set level [expr {[info level] - 1}]

    tputs $::test_channel [appendArgs \
        \n [info level $level] ": " $error \n]




    #

    # NOTE: Halt all testing now -OR- just record the failure and continue?

    #
    if {$::exitOnFail} then {
      exit Failure
    } else {
      incr ::failures

    }
  }

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

  proc setupLogging { fileName } {
    if {![info exists ::logListener]} then {







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















|
>
>
>
>
>
|

|
|

>
>
>
|
>
|
>
|
<
<
<
|
>







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95



96
97
98
99
100
101
102
103
104
runTest {test stress-1.1 {multithreaded stress testing} -setup {
  unset -nocomplain result thread index workload noWorkload srcDb db \
      fileName compiled options count times logFileName logListener \
      connection indicators iterations exitOnFail failures

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

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

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

    append result [expr {[info exists ::iterations($index,error)] ? \
        $::iterations($index,error) : 0}] " error, "

    #
    # NOTE: Translate the workload index to the corresponding iteration
    #       error indicator so that we can easily lookup the number of
    #       failures (i.e. "unexpected errors") for the workload.
    #
    set indicator [string character [expr {[string ordinal a 0] + $index - 1}]]

    append result [expr {[info exists ::failures($indicator)] ? \
        $::failures($indicator) : 0}] " failed\n"

    return $result
  }

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

  proc isExpectedError { error } {
    return [expr {[regexp -- {\sno such table: t1\s} $error] || \
        [regexp -- {\sdatabase is locked\s} $error]}]
  }

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

  proc showTest { indicator } {
    tputs $::test_channel $indicator
    append ::indicators $indicator
    after [expr {int(rand() * 1000 + $::count(2))}]
  }

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

  proc failTest { indicator error } {
    #
    # NOTE: Halt all testing and exit the process now
    #       -OR- just record the failure and continue?
    #
    if {$::exitOnFail} then {
      set level [expr {[info level] - 1}]

      tputs $::test_channel [appendArgs \
          \n [info level $level] ": " \n\t $error \n]

      exit Failure
    } else {
      tputs $::test_channel $indicator

      if {![info exists ::failures($indicator)]} then {
        set ::failures($indicator) 0
      }




      incr ::failures($indicator)
      after [expr {int(rand() * 1000 + $::count(2))}]
    }
  }

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

  proc setupLogging { fileName } {
    if {![info exists ::logListener]} then {
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
  # 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 $test_log .trace]
  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) 200;      # 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 noWorkload [list]; # Workloads to be omitted from the run, by index.
  set exitOnFail true;   # Halt testing and exit process on test failure?

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








|










|







144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
  # 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 noWorkload [list]; # Workloads to be omitted from the run, by index.
  set exitOnFail true;   # Halt testing and exit process on test failure?

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

179
180
181
182
183
184
185
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

  if {[llength $noWorkload] > 0} then {
    tputs $test_channel [appendArgs \
        "---- workloads to be skipped... " $noWorkload \n]
  }

  tputs $test_channel [appendArgs \
      "---- workload iteration failures " [expr {$exitOnFail ? "will" : \
      "will not"}] " halt testing and exit the process...\n"]

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

  #
  # NOTE: Workloads #12 and #13 contain C# code that should be compiled, but
  #       only once.  These variables keep track of that state information.
  #       An integer value in one of these variables means the compilation was
  #       completed and the resulting compiled method may be invoked using the
  #       following command (where ${id} is the value of the variable):
  #
  #           object invoke _Dynamic${id}.Test${id} BackupAndGetData
  #
  set compiled(12) ""
  set compiled(13) ""

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

  #
  # NOTE: This is an in-memory database with shared cache enabled.
  #
  set fileName(1) "file::memory:?cache=shared"

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

  #
  # NOTE: This is a normal on-disk database.
  #
  set fileName(2) [file join [getDatabaseDirectory] [appendArgs \







|
|




















|







211
212
213
214
215
216
217
218
219
220
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

  if {[llength $noWorkload] > 0} then {
    tputs $test_channel [appendArgs \
        "---- workloads to be skipped... " $noWorkload \n]
  }

  tputs $test_channel [appendArgs \
      "---- workload failures " [expr {$exitOnFail ? "will" : "will not"}] \
      " halt testing and exit the process...\n"]

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

  #
  # NOTE: Workloads #12 and #13 contain C# code that should be compiled, but
  #       only once.  These variables keep track of that state information.
  #       An integer value in one of these variables means the compilation was
  #       completed and the resulting compiled method may be invoked using the
  #       following command (where ${id} is the value of the variable):
  #
  #           object invoke _Dynamic${id}.Test${id} BackupAndGetData
  #
  set compiled(12) ""
  set compiled(13) ""

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

  #
  # NOTE: This is an in-memory database with shared cache enabled.
  #
  set fileName(1) file::memory:?cache=shared

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

  #
  # NOTE: This is a normal on-disk database.
  #
  set fileName(2) [file join [getDatabaseDirectory] [appendArgs \
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
  # NOTE: This serves two purposes.  First, it allows us to verify the trace
  #       logging subsystem is working properly.  Second, it places the file
  #       name for the associated database file into the trace log file.
  #
  set connection [getDbConnection]

  $connection LogMessage 0 [appendArgs \
      "starting stress test using database \"" $fileName(2) "\"..."]

  #############################################################################
  #                              WORKLOAD #1 (A)                              #
  #############################################################################

  set workload(1) [list \
      [list srcFileName dstFileName table count1 count2 count3] {







|







258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
  # NOTE: This serves two purposes.  First, it allows us to verify the trace
  #       logging subsystem is working properly.  Second, it places the file
  #       name for the associated database file into the trace log file.
  #
  set connection [getDbConnection]

  $connection LogMessage 0 [appendArgs \
      "starting stress test using database \"" $fileName(2) \"...]

  #############################################################################
  #                              WORKLOAD #1 (A)                              #
  #############################################################################

  set workload(1) [list \
      [list srcFileName dstFileName table count1 count2 count3] {
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
              "CREATE TABLE IF NOT EXISTS t" \
              $index "(x PRIMARY KEY, y, z);"]
          showTest A
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest a
          } else {
            failTest $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]








|







281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
              "CREATE TABLE IF NOT EXISTS t" \
              $index "(x PRIMARY KEY, y, z);"]
          showTest A
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest a
          } else {
            failTest a $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
          sql execute $db [appendArgs \
              "DROP TABLE IF EXISTS t" $index \;]
          showTest B
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest b
          } else {
            failTest $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]








|







309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
          sql execute $db [appendArgs \
              "DROP TABLE IF EXISTS t" $index \;]
          showTest B
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest b
          } else {
            failTest b $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
          }
          unset -nocomplain reader
          showTest C
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest c
          } else {
            failTest $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]








|







345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
          }
          unset -nocomplain reader
          showTest C
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest c
          } else {
            failTest c $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
          }
          unset -nocomplain reader
          showTest D
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest d
          } else {
            failTest $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]








|







381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
          }
          unset -nocomplain reader
          showTest D
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest d
          } else {
            failTest d $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
              [base64 encode -- [expr {randstr($count2)}]] \
              "', 'small');"]
          showTest E
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest e
          } else {
            failTest $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]








|







412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
              [base64 encode -- [expr {randstr($count2)}]] \
              "', 'small');"]
          showTest E
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest e
          } else {
            failTest e $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
              [format %lX [expr {random()}]] \
              "', RANDOMBLOB(" $count3 "), 'big');"]
          showTest F
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest f
          } else {
            failTest $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]








|







442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
              [format %lX [expr {random()}]] \
              "', RANDOMBLOB(" $count3 "), 'big');"]
          showTest F
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest f
          } else {
            failTest f $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
              " SET y = '" [base64 encode -- [expr {randstr($count2)}]] \
              "' WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]
          showTest G
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest g
          } else {
            failTest $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]








|







471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
              " SET y = '" [base64 encode -- [expr {randstr($count2)}]] \
              "' WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]
          showTest G
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest g
          } else {
            failTest g $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
              ") WHERE x LIKE '" [format %X $index] \
              "%' AND z = 'big';"]
          showTest H
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest h
          } else {
            failTest $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]








|







501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
              ") WHERE x LIKE '" [format %X $index] \
              "%' AND z = 'big';"]
          showTest H
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest h
          } else {
            failTest h $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]
          showTest I
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest i
          } else {
            failTest $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]








|







529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]
          showTest I
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest i
          } else {
            failTest i $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'big';"]
          showTest J
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest j
          } else {
            failTest $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]








|







557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'big';"]
          showTest J
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest j
          } else {
            failTest j $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
        if {[catch {
          sql execute $db "VACUUM;"
          showTest K
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest k
          } else {
            failTest $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]








|







584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
        if {[catch {
          sql execute $db "VACUUM;"
          showTest K
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest k
          } else {
            failTest k $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
          if {[catch {
            object invoke _Dynamic${id}.Test${id} BackupAndGetData
            showTest L
          } error]} then {
            if {[isExpectedError $error]} then {
              showTest l
            } else {
              failTest $error
            }
          }
        } else {
          set id [object invoke Interpreter.GetActive NextId]
          set code [compileCSharpWith [subst {
            using System;
            using System.Data.SQLite;







|







612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
          if {[catch {
            object invoke _Dynamic${id}.Test${id} BackupAndGetData
            showTest L
          } error]} then {
            if {[isExpectedError $error]} then {
              showTest l
            } else {
              failTest l $error
            }
          }
        } else {
          set id [object invoke Interpreter.GetActive NextId]
          set code [compileCSharpWith [subst {
            using System;
            using System.Data.SQLite;
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
            if {[catch {
              object invoke _Dynamic${id}.Test${id} BackupAndGetData
              showTest L
            } error]} then {
              if {[isExpectedError $error]} then {
                showTest l
              } else {
                failTest $error
              }
            }
          } else {
            error $errors
          }
        }
      }







|







661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
            if {[catch {
              object invoke _Dynamic${id}.Test${id} BackupAndGetData
              showTest L
            } error]} then {
              if {[isExpectedError $error]} then {
                showTest l
              } else {
                failTest l $error
              }
            }
          } else {
            error $errors
          }
        }
      }
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
          if {[catch {
            object invoke _Dynamic${id}.Test${id} BackupAndGetData
            showTest M
          } error]} then {
            if {[isExpectedError $error]} then {
              showTest m
            } else {
              failTest $error
            }
          }
        } else {
          set id [object invoke Interpreter.GetActive NextId]
          set code [compileCSharpWith [subst {
            using System;
            using System.Data.SQLite;







|







692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
          if {[catch {
            object invoke _Dynamic${id}.Test${id} BackupAndGetData
            showTest M
          } error]} then {
            if {[isExpectedError $error]} then {
              showTest m
            } else {
              failTest m $error
            }
          }
        } else {
          set id [object invoke Interpreter.GetActive NextId]
          set code [compileCSharpWith [subst {
            using System;
            using System.Data.SQLite;
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
            if {[catch {
              object invoke _Dynamic${id}.Test${id} BackupAndGetData
              showTest M
            } error]} then {
              if {[isExpectedError $error]} then {
                showTest m
              } else {
                failTest $error
              }
            }
          } else {
            error $errors
          }
        }
      }







|







741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
            if {[catch {
              object invoke _Dynamic${id}.Test${id} BackupAndGetData
              showTest M
            } error]} then {
              if {[isExpectedError $error]} then {
                showTest m
              } else {
                failTest m $error
              }
            }
          } else {
            error $errors
          }
        }
      }
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
          } else {
            error [appendArgs "integrity check failed: " $result]
          }
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest n
          } else {
            failTest $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]








|







776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
          } else {
            error [appendArgs "integrity check failed: " $result]
          }
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest n
          } else {
            failTest n $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
        if {[catch {
          collectGarbage $::test_channel
          showTest O
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest o
          } else {
            failTest $error
          }
        }
      }
    }] 0]
  }]
} -body {
  set failures 0

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

  for {set index(0) 0} {$index(0) < $count(0)} {incr index(0)} {
    sql execute $db "CREATE TABLE IF NOT EXISTS t1(x PRIMARY KEY, y, z);"

    unset -nocomplain thread

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







|






<
<
<
<







802
803
804
805
806
807
808
809
810
811
812
813
814
815




816
817
818
819
820
821
822
        if {[catch {
          collectGarbage $::test_channel
          showTest O
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest o
          } else {
            failTest o $error
          }
        }
      }
    }] 0]
  }]
} -body {




  for {set index(0) 0} {$index(0) < $count(0)} {incr index(0)} {
    sql execute $db "CREATE TABLE IF NOT EXISTS t1(x PRIMARY KEY, y, z);"

    unset -nocomplain thread

    foreach index(1) [lsort -integer [array names workload]] {
      if {[lsearch -exact $noWorkload $index(1)] == -1} then {
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
          "---- no times for workload (" $index(0) ")\n"]
    }
  }

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

  foreach index(0) [lsort -integer [array names workload]] {
    if {[info exists iterations($index(0),ok)]} then {
      tputs $test_channel [appendArgs \
          "---- workload (" $index(0) ") had " \
          $iterations($index(0),ok) \
          " iterations that returned \"ok\"\n"]
    } else {
      tputs $test_channel [appendArgs \
          "---- workload (" $index(0) \
          ") had no iterations that returned \"ok\"\n"]
    }

    if {[info exists iterations($index(0),error)]} then {
      tputs $test_channel [appendArgs \
          "---- workload (" $index(0) ") had " \
          $iterations($index(0),error) \
          " iterations that returned \"error\"\n"]
    } else {
      tputs $test_channel [appendArgs \
          "---- workload (" $index(0) \
          ") had no iterations that returned \"error\"\n"]
    }
  }

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

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

  if {$result eq "ok"} then {







<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







880
881
882
883
884
885
886

887



















888
889
890
891
892
893
894
          "---- 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 {
898
899
900
901
902
903
904
905
906
907
908

909
910
911
912

913
914
915
916
917
918
919
  } else {
    error [appendArgs "integrity check failed (db): " $result]
  }

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

  #
  # NOTE: The overall test result is the total number of failures encountered
  #       during all the workload iterations.
  #
  set failures

} -cleanup {
  rename failTest ""
  rename showTest ""
  rename isExpectedError ""


  cleanupDb $fileName(2)
  cleanupDb $fileName(1) srcDb

  foreach index(0) [array names workload] {
    catch {
      object removecallback [list apply $workload($index(0)) $fileName(1) \







|
|

|
>




>







906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
  } else {
    error [appendArgs "integrity check failed (db): " $result]
  }

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

  #
  # NOTE: The overall test result is the total number of failures (i.e.
  #       "unexpected errors") encountered during a workload iteration.
  #
  expr {[array size failures] > 0 ? \
      [expr [join [array values failures] +]] : 0}
} -cleanup {
  rename failTest ""
  rename showTest ""
  rename isExpectedError ""
  rename formatWorkloadResult ""

  cleanupDb $fileName(2)
  cleanupDb $fileName(1) srcDb

  foreach index(0) [array names workload] {
    catch {
      object removecallback [list apply $workload($index(0)) $fileName(1) \