/ Check-in [698fba82]
Login

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

Overview
Comment:Do not run some tests in notify3.test with the inmemory_journal permutation. They do not pass as the tests assume that the database schema is not loaded until the first invocation of [db eval]. This is not true with the inmemory_journal permutation.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 698fba826e40ce6414cf6c261441d68b174c1637
User & Date: dan 2010-08-06 13:50:07
Context
2010-08-06
19:00
Remove all vestiges of ctype.h from FTS3. This addresses ticket [991789d9f3136a] among other bug reports. check-in: b8b465ed user: drh tags: trunk
13:53
Merge trunk changes into experimental branch. check-in: aef6698c user: dan tags: experimental
13:50
Do not run some tests in notify3.test with the inmemory_journal permutation. They do not pass as the tests assume that the database schema is not loaded until the first invocation of [db eval]. This is not true with the inmemory_journal permutation. check-in: 698fba82 user: dan tags: trunk
02:10
Change two automatic array variables into static constant arrays. Update and reformat some comments for cleaner presentation. check-in: a7a15547 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/notify3.test.

    88     88   #
    89     89   # This block tests that if the loading of schemas as a result of an
    90     90   # ATTACH fails due to locks on the schema table held by other shared-cache
    91     91   # connections the extended error code is SQLITE_LOCKED_SHAREDCACHE and
    92     92   # it is possible to use the unlock-notify mechanism to determine when
    93     93   # the ATTACH might succeed.
    94     94   #
    95         -foreach {
    96         -  tn
    97         -  db1_loaded
    98         -  db2_loaded
    99         -  enable_extended_errors
   100         -  result
   101         -  error1 error2
   102         -} "
   103         -  0   0 0 0   $err     SQLITE_LOCKED               SQLITE_LOCKED_SHAREDCACHE
   104         -  1   0 0 1   $err     SQLITE_LOCKED_SHAREDCACHE   SQLITE_LOCKED_SHAREDCACHE
   105         -  2   0 1 0   $err     SQLITE_LOCKED               SQLITE_LOCKED_SHAREDCACHE
   106         -  3   0 1 1   $err     SQLITE_LOCKED_SHAREDCACHE   SQLITE_LOCKED_SHAREDCACHE
   107         -  4   1 0 0   $err     SQLITE_LOCKED               SQLITE_LOCKED_SHAREDCACHE
   108         -  5   1 0 1   $err     SQLITE_LOCKED_SHAREDCACHE   SQLITE_LOCKED_SHAREDCACHE
   109         -  6   1 1 0   $noerr   SQLITE_OK                   SQLITE_OK
   110         -  7   1 1 1   $noerr   SQLITE_OK                   SQLITE_OK
   111         -" {
   112         -
   113         -  do_test notify3-2.$tn.1 {
   114         -    catch { db1 close }
   115         -    catch { db2 close }
   116         -    sqlite3 db1 test.db
   117         -    sqlite3 db2 test.db2
   118         -
   119         -    sqlite3_extended_result_codes db1 $enable_extended_errors
   120         -    sqlite3_extended_result_codes db2 $enable_extended_errors
   121         -
   122         -    if { $db1_loaded } { db1 eval "SELECT * FROM sqlite_master" }
   123         -    if { $db2_loaded } { db2 eval "SELECT * FROM sqlite_master" }
   124         -
   125         -    db2 eval "BEGIN EXCLUSIVE"
   126         -    catchsql "ATTACH 'test.db2' AS two" db1
   127         -  } $result
   128         -
   129         -  do_test notify3-2.$tn.2 {
   130         -    list [sqlite3_errcode db1] [sqlite3_extended_errcode db1]
   131         -  } [list $error1 $error2]
   132         -
   133         -  do_test notify3-2.$tn.3 {
   134         -    db1 unlock_notify {set invoked 1}
   135         -    set invoked 0
   136         -    db2 eval commit
   137         -    set invoked
   138         -  } [lindex $result 0]
           95  +# This test does not work for test-permutations that specify SQL to
           96  +# be executed as part of the [sqlite3] command that opens the database.
           97  +# Executing such SQL causes SQLite to load the database schema into memory 
           98  +# earlier than expected, causing test cases to fail.
           99  +#
          100  +if {[presql] == ""} {
          101  +  foreach {
          102  +    tn
          103  +    db1_loaded
          104  +    db2_loaded
          105  +    enable_extended_errors
          106  +    result
          107  +    error1 error2
          108  +  } "
          109  +    0   0 0 0   $err     SQLITE_LOCKED               SQLITE_LOCKED_SHAREDCACHE
          110  +    1   0 0 1   $err     SQLITE_LOCKED_SHAREDCACHE   SQLITE_LOCKED_SHAREDCACHE
          111  +    2   0 1 0   $err     SQLITE_LOCKED               SQLITE_LOCKED_SHAREDCACHE
          112  +    3   0 1 1   $err     SQLITE_LOCKED_SHAREDCACHE   SQLITE_LOCKED_SHAREDCACHE
          113  +    4   1 0 0   $err     SQLITE_LOCKED               SQLITE_LOCKED_SHAREDCACHE
          114  +    5   1 0 1   $err     SQLITE_LOCKED_SHAREDCACHE   SQLITE_LOCKED_SHAREDCACHE
          115  +    6   1 1 0   $noerr   SQLITE_OK                   SQLITE_OK
          116  +    7   1 1 1   $noerr   SQLITE_OK                   SQLITE_OK
          117  +  " {
          118  +  
          119  +    do_test notify3-2.$tn.1 {
          120  +      catch { db1 close }
          121  +      catch { db2 close }
          122  +      sqlite3 db1 test.db
          123  +      sqlite3 db2 test.db2
          124  +  
          125  +      sqlite3_extended_result_codes db1 $enable_extended_errors
          126  +      sqlite3_extended_result_codes db2 $enable_extended_errors
          127  +  
          128  +      if { $db1_loaded } { db1 eval "SELECT * FROM sqlite_master" }
          129  +      if { $db2_loaded } { db2 eval "SELECT * FROM sqlite_master" }
          130  +  
          131  +      db2 eval "BEGIN EXCLUSIVE"
          132  +      catchsql "ATTACH 'test.db2' AS two" db1
          133  +    } $result
          134  +  
          135  +    do_test notify3-2.$tn.2 {
          136  +      list [sqlite3_errcode db1] [sqlite3_extended_errcode db1]
          137  +    } [list $error1 $error2]
          138  +  
          139  +    do_test notify3-2.$tn.3 {
          140  +      db1 unlock_notify {set invoked 1}
          141  +      set invoked 0
          142  +      db2 eval commit
          143  +      set invoked
          144  +    } [lindex $result 0]
          145  +  }
   139    146   }
   140    147   catch { db1 close }
   141    148   catch { db2 close }
   142    149   
   143    150   
   144    151   sqlite3_enable_shared_cache $esc
   145    152   finish_test
   146    153   

Changes to test/tester.tcl.

    66     66   # Commands to help create test files that run with the "WAL" and other
    67     67   # permutations (see file permutations.test):
    68     68   #
    69     69   #      wal_is_wal_mode
    70     70   #      wal_set_journal_mode   ?DB?
    71     71   #      wal_check_journal_mode TESTNAME?DB?
    72     72   #      permutation
           73  +#      presql
    73     74   #
    74     75   
    75     76   # Set the precision of FP arithmatic used by the interpreter. And 
    76     77   # configure SQLite to take database file locks on the page that begins
    77     78   # 64KB into the database file instead of the one 1GB in. This means
    78     79   # the code that handles that special case can be tested without creating
    79     80   # very large database files.
................................................................................
  1145   1146     }
  1146   1147   }
  1147   1148   
  1148   1149   proc permutation {} {
  1149   1150     set perm ""
  1150   1151     catch {set perm $::G(perm:name)}
  1151   1152     set perm
         1153  +}
         1154  +proc presql {} {
         1155  +  set presql ""
         1156  +  catch {set presql $::G(perm:presql)}
         1157  +  set presql
  1152   1158   }
  1153   1159   
  1154   1160   #-------------------------------------------------------------------------
  1155   1161   #
  1156   1162   proc slave_test_script {script} {
  1157   1163   
  1158   1164     # Create the interpreter used to run the test script.