System.Data.SQLite
Check-in [70c11fc93f]
Not logged in

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

Overview
Comment:Enhance stress test workload diagnostic messages.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | threadAbortProtect
Files: files | file ages | folders
SHA1: 70c11fc93fae40f7ebd086af693a2179e097dfd3
User & Date: mistachkin 2012-10-12 14:09:14
Context
2012-10-12
16:09
Add a LogMessage method overload to the SQLiteConnection class that takes a SQLiteErrorCode. check-in: d874518f31 user: mistachkin tags: threadAbortProtect
14:09
Enhance stress test workload diagnostic messages. check-in: 70c11fc93f user: mistachkin tags: threadAbortProtect
13:40
Logging related enhancements to stress test. check-in: 738abc1a0b user: mistachkin tags: threadAbortProtect
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Tests/stress.eagle.

   150    150       #
   151    151       lappend ::times(1) [lindex [time {
   152    152         setupDb $dstFileName "" "" "" "" "" true false
   153    153         if {[catch {
   154    154           for {set index 2} {$index <= $count} {incr index} {
   155    155             sql execute $db [appendArgs \
   156    156                 "CREATE TABLE IF NOT EXISTS t" $index "(x PRIMARY KEY, y, z);"]
   157         -          showTest 1
          157  +          showTest A
   158    158           }
   159    159         } error]} then {
   160    160           if {[expectedError $error]} then {
   161         -          showTest *
          161  +          showTest a
   162    162           } else {
   163    163             failTest $error
   164    164           }
   165    165         }
   166    166         cleanupDb $dstFileName db false true false
   167    167       }] 0]
   168    168     }]
................................................................................
   175    175       #
   176    176       lappend ::times(2) [lindex [time {
   177    177         setupDb $dstFileName "" "" "" "" "" true false
   178    178         if {[catch {
   179    179           for {set index 2} {$index <= $count} {incr index} {
   180    180             sql execute $db [appendArgs \
   181    181                 "DROP TABLE IF EXISTS t" $index \;]
   182         -          showTest 2
          182  +          showTest B
   183    183           }
   184    184         } error]} then {
   185    185           if {[expectedError $error]} then {
   186         -          showTest *
          186  +          showTest b
   187    187           } else {
   188    188             failTest $error
   189    189           }
   190    190         }
   191    191         cleanupDb $dstFileName db false true false
   192    192       }] 0]
   193    193     }]
................................................................................
   200    200       #
   201    201       lappend ::times(3) [lindex [time {
   202    202         setupDb $dstFileName "" "" "" "" "" true false
   203    203         if {[catch {
   204    204           for {set index 1} {$index <= $count} {incr index} {
   205    205             sql execute -execute reader $db [appendArgs \
   206    206                 "SELECT x, y FROM " $table " WHERE z = 'small';"]
   207         -          showTest 3
          207  +          showTest C
   208    208           }
   209    209         } error]} then {
   210    210           if {[expectedError $error]} then {
   211         -          showTest *
          211  +          showTest c
   212    212           } else {
   213    213             failTest $error
   214    214           }
   215    215         }
   216    216         cleanupDb $dstFileName db false true false
   217    217       }] 0]
   218    218     }]
................................................................................
   225    225       #
   226    226       lappend ::times(4) [lindex [time {
   227    227         setupDb $dstFileName "" "" "" "" "" true false
   228    228         if {[catch {
   229    229           for {set index 1} {$index <= $count} {incr index} {
   230    230             sql execute -execute reader $db [appendArgs \
   231    231                 "SELECT x, y FROM " $table " WHERE z = 'big';"]
   232         -          showTest 4
          232  +          showTest D
   233    233           }
   234    234         } error]} then {
   235    235           if {[expectedError $error]} then {
   236         -          showTest *
          236  +          showTest d
   237    237           } else {
   238    238             failTest $error
   239    239           }
   240    240         }
   241    241         cleanupDb $dstFileName db false true false
   242    242       }] 0]
   243    243     }]
................................................................................
   253    253         if {[catch {
   254    254           for {set index 1} {$index <= $count} {incr index} {
   255    255             sql execute $db [appendArgs \
   256    256                 "INSERT INTO " $table "(x, y, z) VALUES('" \
   257    257                 [format %lX [expr {random()}]] "', '" \
   258    258                 [base64 encode -- [expr {randstr(10000)}]] \
   259    259                 "', 'small');"]
   260         -          showTest 5
          260  +          showTest E
   261    261           }
   262    262         } error]} then {
   263    263           if {[expectedError $error]} then {
   264         -          showTest *
          264  +          showTest e
   265    265           } else {
   266    266             failTest $error
   267    267           }
   268    268         }
   269    269         cleanupDb $dstFileName db false true false
   270    270       }] 0]
   271    271     }]
................................................................................
   280    280         setupDb $dstFileName "" "" "" "" "" true false
   281    281         if {[catch {
   282    282           for {set index 1} {$index <= $count} {incr index} {
   283    283             sql execute $db [appendArgs \
   284    284                 "INSERT INTO " $table "(x, y, z) VALUES('" \
   285    285                 [format %lX [expr {random()}]] \
   286    286                 "', RANDOMBLOB(10000000), 'big');"]
   287         -          showTest 6
          287  +          showTest F
   288    288           }
   289    289         } error]} then {
   290    290           if {[expectedError $error]} then {
   291         -          showTest *
          291  +          showTest f
   292    292           } else {
   293    293             failTest $error
   294    294           }
   295    295         }
   296    296         cleanupDb $dstFileName db false true false
   297    297       }] 0]
   298    298     }]
................................................................................
   306    306       lappend ::times(7) [lindex [time {
   307    307         setupDb $dstFileName "" "" "" "" "" true false
   308    308         if {[catch {
   309    309           for {set index 1} {$index <= $count} {incr index} {
   310    310             sql execute $db [appendArgs "UPDATE " $table \
   311    311                 " SET y = '" [base64 encode -- [expr {randstr(10000)}]] \
   312    312                 "' WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]
   313         -          showTest 7
          313  +          showTest G
   314    314           }
   315    315         } error]} then {
   316    316           if {[expectedError $error]} then {
   317         -          showTest *
          317  +          showTest g
   318    318           } else {
   319    319             failTest $error
   320    320           }
   321    321         }
   322    322         cleanupDb $dstFileName db false true false
   323    323       }] 0]
   324    324     }]
................................................................................
   332    332       lappend ::times(8) [lindex [time {
   333    333         setupDb $dstFileName "" "" "" "" "" true false
   334    334         if {[catch {
   335    335           for {set index 1} {$index <= $count} {incr index} {
   336    336             sql execute $db [appendArgs "UPDATE " $table \
   337    337                 " SET y = RANDOMBLOB(10000000) WHERE x LIKE '" \
   338    338                 [format %X $index] "%' AND z = 'big';"]
   339         -          showTest 8
          339  +          showTest H
   340    340           }
   341    341         } error]} then {
   342    342           if {[expectedError $error]} then {
   343         -          showTest *
          343  +          showTest h
   344    344           } else {
   345    345             failTest $error
   346    346           }
   347    347         }
   348    348         cleanupDb $dstFileName db false true false
   349    349       }] 0]
   350    350     }]
................................................................................
   357    357       #
   358    358       lappend ::times(9) [lindex [time {
   359    359         setupDb $dstFileName "" "" "" "" "" true false
   360    360         if {[catch {
   361    361           for {set index 1} {$index <= $count} {incr index} {
   362    362             sql execute $db [appendArgs "DELETE FROM " $table \
   363    363                 " WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]
   364         -          showTest 9
          364  +          showTest I
   365    365           }
   366    366         } error]} then {
   367    367           if {[expectedError $error]} then {
   368         -          showTest *
          368  +          showTest i
   369    369           } else {
   370    370             failTest $error
   371    371           }
   372    372         }
   373    373         cleanupDb $dstFileName db false true false
   374    374       }] 0]
   375    375     }]
................................................................................
   382    382       #
   383    383       lappend ::times(10) [lindex [time {
   384    384         setupDb $dstFileName "" "" "" "" "" true false
   385    385         if {[catch {
   386    386           for {set index 1} {$index <= $count} {incr index} {
   387    387             sql execute $db [appendArgs "DELETE FROM " $table \
   388    388                 " WHERE x LIKE '" [format %X $index] "%' AND z = 'big';"]
   389         -          showTest A
          389  +          showTest J
   390    390           }
   391    391         } error]} then {
   392    392           if {[expectedError $error]} then {
   393         -          showTest *
          393  +          showTest j
   394    394           } else {
   395    395             failTest $error
   396    396           }
   397    397         }
   398    398         cleanupDb $dstFileName db false true false
   399    399       }] 0]
   400    400     }]
................................................................................
   406    406       # NOTE: Workload #11, VACUUM statement.
   407    407       #
   408    408       lappend ::times(11) [lindex [time {
   409    409         setupDb $dstFileName "" "" "" "" "" true false
   410    410         if {[catch {
   411    411           for {set index 1} {$index <= $count} {incr index} {
   412    412             sql execute $db "VACUUM;"
   413         -          showTest B
          413  +          showTest K
   414    414           }
   415    415         } error]} then {
   416    416           if {[expectedError $error]} then {
   417         -          showTest *
          417  +          showTest k
   418    418           } else {
   419    419             failTest $error
   420    420           }
   421    421         }
   422    422         cleanupDb $dstFileName db false true false
   423    423       }] 0]
   424    424     }]
................................................................................
   429    429       #
   430    430       # NOTE: Workload #12, backup to in-memory database.
   431    431       #
   432    432       lappend ::times(12) [lindex [time {
   433    433         for {set index 1} {$index <= $count} {incr index} {
   434    434           if {[string is integer -strict $::compiled(12)]} then {
   435    435             set id $::compiled(12); # NOTE: Already compiled.
   436         -          object invoke _Dynamic${id}.Test${id} BackupAndGetData
          436  +          if {[catch {
          437  +            object invoke _Dynamic${id}.Test${id} BackupAndGetData
          438  +            showTest L
          439  +          } error]} then {
          440  +            if {[expectedError $error]} then {
          441  +              showTest l
          442  +            } else {
          443  +              failTest $error
          444  +            }
          445  +          }
   437    446           } else {
   438    447             set id [object invoke Interpreter.GetActive NextId]
   439    448             set code [compileCSharpWith [subst {
   440    449               using System;
   441    450               using System.Data.SQLite;
   442    451               using System.Text;
   443    452   
................................................................................
   469    478                     // do nothing.
   470    479                   }
   471    480                 }
   472    481               }
   473    482             }] true true true results errors System.Data.SQLite.dll]
   474    483             if {$code eq "Ok"} then {
   475    484               set ::compiled(12) $id; # NOTE: Compiled OK.
   476         -            object invoke _Dynamic${id}.Test${id} BackupAndGetData
          485  +            if {[catch {
          486  +              object invoke _Dynamic${id}.Test${id} BackupAndGetData
          487  +              showTest L
          488  +            } error]} then {
          489  +              if {[expectedError $error]} then {
          490  +                showTest l
          491  +              } else {
          492  +                failTest $error
          493  +              }
          494  +            }
   477    495             } else {
   478    496               error $errors
   479    497             }
   480    498           }
   481         -        showTest C
   482    499         }
   483    500       }] 0]
   484    501     }]
   485    502   
   486    503     #############################################################################
   487    504   
   488    505     set workload(13) [list [list srcFileName dstFileName table count] {
................................................................................
   489    506       #
   490    507       # NOTE: Workload #13, backup from an in-memory database.
   491    508       #
   492    509       lappend ::times(13) [lindex [time {
   493    510         for {set index 1} {$index <= $count} {incr index} {
   494    511           if {[string is integer -strict $::compiled(13)]} then {
   495    512             set id $::compiled(13); # NOTE: Already compiled.
   496         -          object invoke _Dynamic${id}.Test${id} BackupAndGetData
          513  +          if {[catch {
          514  +            object invoke _Dynamic${id}.Test${id} BackupAndGetData
          515  +            showTest M
          516  +          } error]} then {
          517  +            if {[expectedError $error]} then {
          518  +              showTest m
          519  +            } else {
          520  +              failTest $error
          521  +            }
          522  +          }
   497    523           } else {
   498    524             set id [object invoke Interpreter.GetActive NextId]
   499    525             set code [compileCSharpWith [subst {
   500    526               using System;
   501    527               using System.Data.SQLite;
   502    528               using System.Text;
   503    529   
................................................................................
   529    555                     // do nothing.
   530    556                   }
   531    557                 }
   532    558               }
   533    559             }] true true true results errors System.Data.SQLite.dll]
   534    560             if {$code eq "Ok"} then {
   535    561               set ::compiled(13) $id; # NOTE: Compiled OK.
   536         -            object invoke _Dynamic${id}.Test${id} BackupAndGetData
          562  +            if {[catch {
          563  +              object invoke _Dynamic${id}.Test${id} BackupAndGetData
          564  +              showTest M
          565  +            } error]} then {
          566  +              if {[expectedError $error]} then {
          567  +                showTest m
          568  +              } else {
          569  +                failTest $error
          570  +              }
          571  +            }
   537    572             } else {
   538    573               error $errors
   539    574             }
   540    575           }
   541         -        showTest D
   542    576         }
   543    577       }] 0]
   544    578     }]
   545    579   
   546    580     #############################################################################
   547    581   
   548    582     set workload(14) [list [list srcFileName dstFileName table count] {
................................................................................
   552    586       lappend ::times(14) [lindex [time {
   553    587         setupDb $dstFileName "" "" "" "" "" true false
   554    588         if {[catch {
   555    589           for {set index 1} {$index <= $count} {incr index} {
   556    590             set result [sql execute -execute scalar $db \
   557    591                 "PRAGMA integrity_check;"]
   558    592             if {$result eq "ok"} then {
   559         -            showTest E
          593  +            showTest N
   560    594             } else {
   561    595               error [appendArgs "integrity check failed: " $result]
   562    596             }
   563    597           }
   564    598         } error]} then {
   565    599           if {[expectedError $error]} then {
   566         -          showTest *
          600  +          showTest n
   567    601           } else {
   568    602             failTest $error
   569    603           }
   570    604         }
   571    605         cleanupDb $dstFileName db false true false
   572    606       }] 0]
   573    607     }]
................................................................................
   578    612       #
   579    613       # NOTE: Workload #15, force managed garbage collection
   580    614       #
   581    615       lappend ::times(15) [lindex [time {
   582    616         if {[catch {
   583    617           for {set index 1} {$index <= $count} {incr index} {
   584    618             collectGarbage $::test_channel
   585         -          showTest F
          619  +          showTest O
   586    620           }
   587    621         } error]} then {
   588    622           if {[expectedError $error]} then {
   589         -          showTest *
          623  +          showTest o
   590    624           } else {
   591    625             failTest $error
   592    626           }
   593    627         }
   594    628       }] 0]
   595    629     }]
   596    630   } -body {