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

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

Issue 694353003: Get `gn gen` to succeed on Windows (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: remove GYP_DEFINES code Created 6 years, 1 month 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
OLDNEW
(Empty)
1 # 2007 May 1
2 #
3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
5 #
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
9 #
10 #***********************************************************************
11 #
12 # $Id: incrblob_err.test,v 1.14 2008/07/18 17:16:27 drh Exp $
13 #
14
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
17
18 ifcapable {!incrblob || !memdebug || !tclvar} {
19 finish_test
20 return
21 }
22
23 source $testdir/malloc_common.tcl
24
25 unset -nocomplain ::fd ::data
26 set ::fd [open [info script]]
27 set ::data [read $::fd]
28 close $::fd
29
30 do_malloc_test 1 -tclprep {
31 set bytes [file size [info script]]
32 execsql {
33 CREATE TABLE blobs(k, v BLOB);
34 INSERT INTO blobs VALUES(1, zeroblob($::bytes));
35 }
36 } -tclbody {
37 set ::blob [db incrblob blobs v 1]
38 set rc [catch {puts -nonewline $::blob $::data}]
39 if {$rc} { error "out of memory" }
40 }
41
42 do_malloc_test 2 -tclprep {
43 execsql {
44 CREATE TABLE blobs(k, v BLOB);
45 INSERT INTO blobs VALUES(1, $::data);
46 }
47 } -tclbody {
48 set ::blob [db incrblob blobs v 1]
49 set rc [catch {set ::r [read $::blob]}]
50 if {$rc} {
51 error "out of memory"
52 } elseif {$::r ne $::data} {
53 error "Bad data read..."
54 }
55 }
56
57 do_malloc_test 3 -tclprep {
58 execsql {
59 CREATE TABLE blobs(k, v BLOB);
60 INSERT INTO blobs VALUES(1, $::data);
61 }
62 } -tclbody {
63 set ::blob [db incrblob blobs v 1]
64 set rc [catch {set ::r [read $::blob]}]
65 if {$rc} {
66 error "out of memory"
67 } elseif {$::r ne $::data} {
68 error "Bad data read..."
69 }
70 set rc [catch {close $::blob}]
71 if {$rc} {
72 error "out of memory"
73 }
74 }
75
76
77 do_ioerr_test incrblob_err-4 -cksum 1 -sqlprep {
78 CREATE TABLE blobs(k, v BLOB);
79 INSERT INTO blobs VALUES(1, $::data);
80 } -tclbody {
81 set ::blob [db incrblob blobs v 1]
82 read $::blob
83 }
84
85 do_ioerr_test incrblob_err-5 -cksum 1 -sqlprep {
86 CREATE TABLE blobs(k, v BLOB);
87 INSERT INTO blobs VALUES(1, zeroblob(length(CAST($::data AS BLOB))));
88 } -tclbody {
89 set ::blob [db incrblob blobs v 1]
90 puts -nonewline $::blob $::data
91 close $::blob
92 }
93
94 do_ioerr_test incrblob_err-6 -cksum 1 -sqlprep {
95 CREATE TABLE blobs(k, v BLOB);
96 INSERT INTO blobs VALUES(1, $::data || $::data || $::data);
97 } -tclbody {
98 set ::blob [db incrblob blobs v 1]
99 seek $::blob -20 end
100 puts -nonewline $::blob "12345678900987654321"
101 close $::blob
102 }
103
104 do_ioerr_test incrblob_err-7 -cksum 1 -sqlprep {
105 PRAGMA auto_vacuum = 1;
106 CREATE TABLE blobs(k INTEGER PRIMARY KEY, v BLOB);
107 INSERT INTO blobs VALUES(1, zeroblob(500 * 1020));
108 } -tclbody {
109 # Read some data from the end of the large blob inserted into table
110 # "blobs". This forces the IO error to occur while reading a pointer
111 # map page for the purposes of seeking to the end of the blob.
112 #
113 sqlite3 db2 test.db
114 set ::blob [db2 incrblob blobs v 1]
115 sqlite3_blob_read $::blob [expr 500*1020-20] 20
116 close $::blob
117 }
118 catch {db2 close}
119
120 do_ioerr_test incrblob_err-8 -cksum 1 -sqlprep {
121 PRAGMA auto_vacuum = 1;
122 CREATE TABLE blobs(k INTEGER PRIMARY KEY, v BLOB);
123 INSERT INTO blobs VALUES(1, zeroblob(500 * 1020));
124 } -tclbody {
125 # Read some data from the end of the large blob inserted into table
126 # "blobs". This forces the IO error to occur while reading a pointer
127 # map page for the purposes of seeking to the end of the blob.
128 #
129 sqlite3 db2 test.db
130 set ::blob [db2 incrblob blobs v 1]
131 sqlite3_blob_write $::blob [expr 500*1020-20] 12345678900987654321
132 close $::blob
133 }
134
135 catch {db2 close}
136
137 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/incrblob3.test ('k') | third_party/sqlite/src/test/incrblobfault.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698