/ Check-in [698fba82]
Login
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 Unified Diffs Ignore Whitespace Patch

Changes to test/notify3.test.

88
89
90
91
92
93
94






95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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
138
139

140
141
142
143
144
145
146
#
# This block tests that if the loading of schemas as a result of an
# ATTACH fails due to locks on the schema table held by other shared-cache
# connections the extended error code is SQLITE_LOCKED_SHAREDCACHE and
# it is possible to use the unlock-notify mechanism to determine when
# the ATTACH might succeed.
#






foreach {
  tn
  db1_loaded
  db2_loaded
  enable_extended_errors
  result
  error1 error2
} "
  0   0 0 0   $err     SQLITE_LOCKED               SQLITE_LOCKED_SHAREDCACHE
  1   0 0 1   $err     SQLITE_LOCKED_SHAREDCACHE   SQLITE_LOCKED_SHAREDCACHE
  2   0 1 0   $err     SQLITE_LOCKED               SQLITE_LOCKED_SHAREDCACHE
  3   0 1 1   $err     SQLITE_LOCKED_SHAREDCACHE   SQLITE_LOCKED_SHAREDCACHE
  4   1 0 0   $err     SQLITE_LOCKED               SQLITE_LOCKED_SHAREDCACHE
  5   1 0 1   $err     SQLITE_LOCKED_SHAREDCACHE   SQLITE_LOCKED_SHAREDCACHE
  6   1 1 0   $noerr   SQLITE_OK                   SQLITE_OK
  7   1 1 1   $noerr   SQLITE_OK                   SQLITE_OK
" {

  do_test notify3-2.$tn.1 {
    catch { db1 close }
    catch { db2 close }
    sqlite3 db1 test.db
    sqlite3 db2 test.db2

    sqlite3_extended_result_codes db1 $enable_extended_errors
    sqlite3_extended_result_codes db2 $enable_extended_errors

    if { $db1_loaded } { db1 eval "SELECT * FROM sqlite_master" }
    if { $db2_loaded } { db2 eval "SELECT * FROM sqlite_master" }

    db2 eval "BEGIN EXCLUSIVE"
    catchsql "ATTACH 'test.db2' AS two" db1
  } $result

  do_test notify3-2.$tn.2 {
    list [sqlite3_errcode db1] [sqlite3_extended_errcode db1]
  } [list $error1 $error2]

  do_test notify3-2.$tn.3 {
    db1 unlock_notify {set invoked 1}
    set invoked 0
    db2 eval commit
    set invoked
  } [lindex $result 0]
}

catch { db1 close }
catch { db2 close }


sqlite3_enable_shared_cache $esc
finish_test








>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>







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


sqlite3_enable_shared_cache $esc
finish_test

Changes to test/tester.tcl.

66
67
68
69
70
71
72

73
74
75
76
77
78
79
....
1145
1146
1147
1148
1149
1150
1151





1152
1153
1154
1155
1156
1157
1158
# Commands to help create test files that run with the "WAL" and other
# permutations (see file permutations.test):
#
#      wal_is_wal_mode
#      wal_set_journal_mode   ?DB?
#      wal_check_journal_mode TESTNAME?DB?
#      permutation

#

# Set the precision of FP arithmatic used by the interpreter. And 
# configure SQLite to take database file locks on the page that begins
# 64KB into the database file instead of the one 1GB in. This means
# the code that handles that special case can be tested without creating
# very large database files.
................................................................................
  }
}

proc permutation {} {
  set perm ""
  catch {set perm $::G(perm:name)}
  set perm





}

#-------------------------------------------------------------------------
#
proc slave_test_script {script} {

  # Create the interpreter used to run the test script.







>







 







>
>
>
>
>







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
....
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
# Commands to help create test files that run with the "WAL" and other
# permutations (see file permutations.test):
#
#      wal_is_wal_mode
#      wal_set_journal_mode   ?DB?
#      wal_check_journal_mode TESTNAME?DB?
#      permutation
#      presql
#

# Set the precision of FP arithmatic used by the interpreter. And 
# configure SQLite to take database file locks on the page that begins
# 64KB into the database file instead of the one 1GB in. This means
# the code that handles that special case can be tested without creating
# very large database files.
................................................................................
  }
}

proc permutation {} {
  set perm ""
  catch {set perm $::G(perm:name)}
  set perm
}
proc presql {} {
  set presql ""
  catch {set presql $::G(perm:presql)}
  set presql
}

#-------------------------------------------------------------------------
#
proc slave_test_script {script} {

  # Create the interpreter used to run the test script.