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

Side by Side Diff: third_party/sqlite/src/test/lock_common.tcl

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/lock.test ('k') | third_party/sqlite/src/test/lookaside.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 # 2010 April 14 1 # 2010 April 14
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 }] 79 }]
80 if {$rc} { 80 if {$rc} {
81 testfixture $chan "set ::sqlite_pending_byte $::sqlite_pending_byte" 81 testfixture $chan "set ::sqlite_pending_byte $::sqlite_pending_byte"
82 } 82 }
83 return $chan 83 return $chan
84 } 84 }
85 85
86 # Execute a command in a child testfixture process, connected by two-way 86 # Execute a command in a child testfixture process, connected by two-way
87 # channel $chan. Return the result of the command, or an error message. 87 # channel $chan. Return the result of the command, or an error message.
88 # 88 #
89 proc testfixture {chan cmd} { 89 proc testfixture {chan cmd args} {
90 puts $chan $cmd 90
91 puts $chan OVER 91 if {[llength $args] == 0} {
92 set r "" 92 fconfigure $chan -blocking 1
93 while { 1 } { 93 puts $chan $cmd
94 set line [gets $chan] 94 puts $chan OVER
95 if { $line == "OVER" } { 95
96 set res [lindex $r 1] 96 set r ""
97 if { [lindex $r 0] } { error $res } 97 while { 1 } {
98 return $res 98 set line [gets $chan]
99 if { $line == "OVER" } {
100 set res [lindex $r 1]
101 if { [lindex $r 0] } { error $res }
102 return $res
103 }
104 if {[eof $chan]} {
105 return "ERROR: Child process hung up"
106 }
107 append r $line
99 } 108 }
100 if {[eof $chan]} { 109 return $r
101 return "ERROR: Child process hung up" 110 } else {
102 } 111 set ::tfnb($chan) ""
103 append r $line 112 fconfigure $chan -blocking 0 -buffering none
113 puts $chan $cmd
114 puts $chan OVER
115 fileevent $chan readable [list testfixture_script_cb $chan [lindex $args 0]]
116 return ""
104 } 117 }
105 } 118 }
106 119
120 proc testfixture_script_cb {chan script} {
121 if {[eof $chan]} {
122 append ::tfnb($chan) "ERROR: Child process hung up"
123 set line "OVER"
124 } else {
125 set line [gets $chan]
126 }
127
128 if { $line == "OVER" } {
129 uplevel #0 $script [list [lindex $::tfnb($chan) 1]]
130 unset ::tfnb($chan)
131 fileevent $chan readable ""
132 } else {
133 append ::tfnb($chan) $line
134 }
135 }
136
107 proc testfixture_nb_cb {varname chan} { 137 proc testfixture_nb_cb {varname chan} {
108 if {[eof $chan]} { 138 if {[eof $chan]} {
109 append ::tfnb($chan) "ERROR: Child process hung up" 139 append ::tfnb($chan) "ERROR: Child process hung up"
110 set line "OVER" 140 set line "OVER"
111 } else { 141 } else {
112 set line [gets $chan] 142 set line [gets $chan]
113 } 143 }
114 144
115 if { $line == "OVER" } { 145 if { $line == "OVER" } {
116 set $varname [lindex $::tfnb($chan) 1] 146 set $varname [lindex $::tfnb($chan) 1]
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } else { 195 } else {
166 append script $line 196 append script $line
167 append script "\n" 197 append script "\n"
168 } 198 }
169 } 199 }
170 }] 200 }]
171 close $fd 201 close $fd
172 set main_loop_written 1 202 set main_loop_written 1
173 } 203 }
174 204
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/lock.test ('k') | third_party/sqlite/src/test/lookaside.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698