Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: third_party/sqlite/src/test/mutex1.test

Issue 1610963002: Import SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/sqlite/src/test/multiplex4.test ('k') | third_party/sqlite/src/test/notify2.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # 2008 June 17 1 # 2008 June 17
2 # 2 #
3 # The author disclaims copyright to this source code. In place of 3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing: 4 # a legal notice, here is a blessing:
5 # 5 #
6 # May you do good and not evil. 6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others. 7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give. 8 # May you share freely, never taking more than you give.
9 # 9 #
10 #*********************************************************************** 10 #***********************************************************************
(...skipping 19 matching lines...) Expand all
30 upvar $varname var 30 upvar $varname var
31 set var(total) 0 31 set var(total) 0
32 foreach {name value} [read_mutex_counters] { 32 foreach {name value} [read_mutex_counters] {
33 set var($name) $value 33 set var($name) $value
34 incr var(total) $value 34 incr var(total) $value
35 } 35 }
36 } 36 }
37 37
38 #------------------------------------------------------------------------- 38 #-------------------------------------------------------------------------
39 # Tests mutex1-1.* test that sqlite3_config() returns SQLITE_MISUSE if 39 # Tests mutex1-1.* test that sqlite3_config() returns SQLITE_MISUSE if
40 # is called at the wrong time. And that the first time sqlite3_initialize 40 # is called at the wrong time. And that the first time sqlite3_initialize
41 # is called it obtains the 'static_master' mutex 3 times and a recursive 41 # is called it obtains the 'static_master' mutex 3 times and a recursive
42 # mutex (sqlite3Config.pInitMutex) twice. Subsequent calls are no-ops 42 # mutex (sqlite3Config.pInitMutex) twice. Subsequent calls are no-ops
43 # that do not require any mutexes. 43 # that do not require any mutexes.
44 # 44 #
45 do_test mutex1-1.0 { 45 do_test mutex1-1.0 {
46 install_mutex_counters 1 46 install_mutex_counters 1
47 } {SQLITE_MISUSE} 47 } {SQLITE_MISUSE}
48 48
49 do_test mutex1-1.1 { 49 do_test mutex1-1.1 {
50 db close 50 db close
51 install_mutex_counters 1 51 install_mutex_counters 1
52 } {SQLITE_MISUSE} 52 } {SQLITE_MISUSE}
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 # 95 #
96 # * Serialized mode, 96 # * Serialized mode,
97 # * Multi-threaded mode, 97 # * Multi-threaded mode,
98 # * Single-threaded mode. 98 # * Single-threaded mode.
99 # 99 #
100 ifcapable threadsafe&&shared_cache { 100 ifcapable threadsafe&&shared_cache {
101 set enable_shared_cache [sqlite3_enable_shared_cache 1] 101 set enable_shared_cache [sqlite3_enable_shared_cache 1]
102 foreach {mode mutexes} { 102 foreach {mode mutexes} {
103 singlethread {} 103 singlethread {}
104 multithread { 104 multithread {
105 fast static_lru static_master static_mem static_open static_prng 105 fast static_app1 static_app2 static_app3
106 static_pmem 106 static_lru static_master static_mem static_open
107 static_prng static_pmem static_vfs1 static_vfs2
108 static_vfs3
107 } 109 }
108 serialized { 110 serialized {
109 fast recursive static_lru static_master static_mem static_open 111 fast recursive static_app1 static_app2
110 static_prng static_pmem 112 static_app3 static_lru static_master static_mem
113 static_open static_prng static_pmem static_vfs1
114 static_vfs2 static_vfs3
111 } 115 }
112 } { 116 } {
113 117
114 do_test mutex1.2.$mode.1 { 118 do_test mutex1.2.$mode.1 {
115 catch {db close} 119 catch {db close}
116 sqlite3_shutdown 120 sqlite3_shutdown
117 sqlite3_config $mode 121 sqlite3_config $mode
118 } SQLITE_OK 122 } SQLITE_OK
119 123
120 do_test mutex1.2.$mode.2 { 124 do_test mutex1.2.$mode.2 {
121 sqlite3_initialize 125 sqlite3_initialize
122 clear_mutex_counters 126 clear_mutex_counters
123 sqlite3 db test.db -nomutex 0 -fullmutex 0 127 sqlite3 db test.db -nomutex 0 -fullmutex 0
124 catchsql { CREATE TABLE abc(a, b, c) } 128 catchsql { CREATE TABLE abc(a, b, c) }
125 db eval { 129 db eval {
126 INSERT INTO abc VALUES(1, 2, 3); 130 INSERT INTO abc VALUES(1, 2, 3);
127 } 131 }
128 } {} 132 } {}
129 ifcapable !memorymanage { 133 ifcapable !memorymanage {
130 regsub { static_lru} $mutexes {} mutexes 134 regsub { static_lru} $mutexes {} mutexes
131 } 135 }
132 do_test mutex1.2.$mode.3 { 136 if {$mode ne "singlethread"} {
137 do_test mutex1.2.$mode.3 {
138 #
139 # NOTE: Make sure all the app and vfs mutexes get used.
140 #
141 enter_static_mutex static_app1
142 leave_static_mutex static_app1
143 enter_static_mutex static_app2
144 leave_static_mutex static_app2
145 enter_static_mutex static_app3
146 leave_static_mutex static_app3
147 enter_static_mutex static_vfs1
148 leave_static_mutex static_vfs1
149 enter_static_mutex static_vfs2
150 leave_static_mutex static_vfs2
151 enter_static_mutex static_vfs3
152 leave_static_mutex static_vfs3
153 } {}
154 }
155 do_test mutex1.2.$mode.4 {
133 mutex_counters counters 156 mutex_counters counters
134 157
135 set res [list] 158 set res [list]
136 foreach {key value} [array get counters] { 159 foreach {key value} [array get counters] {
137 if {$key ne "total" && $value > 0} { 160 if {$key ne "total" && $value > 0} {
138 lappend res $key 161 lappend res $key
139 } 162 }
140 } 163 }
141 lsort $res 164 lsort $res
142 } [lsort $mutexes] 165 } [lsort $mutexes]
143 } 166 }
144 sqlite3_enable_shared_cache $enable_shared_cache 167 sqlite3_enable_shared_cache $enable_shared_cache
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 do_test mutex1-X { 206 do_test mutex1-X {
184 catch {db close} 207 catch {db close}
185 sqlite3_shutdown 208 sqlite3_shutdown
186 clear_mutex_counters 209 clear_mutex_counters
187 install_mutex_counters 0 210 install_mutex_counters 0
188 sqlite3_initialize 211 sqlite3_initialize
189 } {SQLITE_OK} 212 } {SQLITE_OK}
190 213
191 autoinstall_test_functions 214 autoinstall_test_functions
192 finish_test 215 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/multiplex4.test ('k') | third_party/sqlite/src/test/notify2.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698