From: danielk1977 Date: Mon, 9 Jun 2008 15:51:26 +0000 (+0000) Subject: Add test file incrblob2.test to test opening two blob handles on a single database... X-Git-Tag: version-3.6.10~981 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=55edca5c178061ae9095fc839624f7faf6a50823;p=thirdparty%2Fsqlite.git Add test file incrblob2.test to test opening two blob handles on a single database blob. (CVS 5196) FossilOrigin-Name: c1d877feb530b5cdaad55da3dbbb7c2596a10c49 --- diff --git a/manifest b/manifest index 29e0588d4d..3f5376046f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sthe\ssignature\sof\ssqlite3PagerPagecount()\sso\sthat\sit\scan\sreturn\san\serror\scode.\s(CVS\s5195) -D 2008-06-07T08:58:22 +C Add\stest\sfile\sincrblob2.test\sto\stest\sopening\stwo\sblob\shandles\son\sa\ssingle\sdatabase\sblob.\s(CVS\s5196) +D 2008-06-09T15:51:27 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7 F Makefile.in ce92ea8dc7adfb743757794f51c10d1b0d9c55e4 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -338,6 +338,7 @@ F test/in.test 763a29007a4850d611ac4441bfa488fb9969ad30 F test/in2.test b1f447f4f0f67e9f83ff931e7e2e30873f9ea055 F test/in3.test dc62b080ed79898121c61c91118b4d1e111f1438 F test/incrblob.test 4455fffd08b2f9418a9257e18b135d72273eff3e +F test/incrblob2.test f5b70f9531f8f879ef49516b5205395b2d5ac3c9 F test/incrblob_err.test 00a8bcb25cb493d53f4efed0f5cf09c386534940 F test/incrvacuum.test 1a2b0bddc76629afeb41e3d8ea3e4563982d16b9 F test/incrvacuum2.test 46ef65f377e3937cfd1ba66e818309dab46f590d @@ -591,7 +592,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1 F tool/speedtest8inst1.c c65494ca99d1e09c246dfe37a7ca7a354af9990f -P 9f5cbe29226151113e4565fcf8170317afe1b8c6 -R c5a7106bdebe8d6a8255cc886f35d9c1 +P e9f01c01866d302d81bf9ebc484ea6351cbc0f60 +R dd9a63ff4b4fc60007b0c2db37c9a684 U danielk1977 -Z 439ab2cd9536726e391f52e67ee1840b +Z c121a7e48caf86ba6a00e5828d755c0c diff --git a/manifest.uuid b/manifest.uuid index 553cfc6d4a..cd76364c0d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e9f01c01866d302d81bf9ebc484ea6351cbc0f60 \ No newline at end of file +c1d877feb530b5cdaad55da3dbbb7c2596a10c49 \ No newline at end of file diff --git a/test/incrblob2.test b/test/incrblob2.test new file mode 100644 index 0000000000..71c476e4a9 --- /dev/null +++ b/test/incrblob2.test @@ -0,0 +1,131 @@ +# 2008 June 9 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# +# Test that it is possible to have two open blob handles on a single +# blob object. +# +# $Id: incrblob2.test,v 1.1 2008/06/09 15:51:27 danielk1977 Exp $ +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +ifcapable {!autovacuum || !pragma || !incrblob} { + finish_test + return +} + +do_test incrblob2-1.0 { + execsql { + CREATE TABLE blobs(id INTEGER PRIMARY KEY, data BLOB); + INSERT INTO blobs VALUES(0, zeroblob(10240)); + INSERT INTO blobs VALUES(1, zeroblob(10240)); + INSERT INTO blobs VALUES(2, zeroblob(10240)); + } +} {} + +foreach iOffset [list 0 256 4094] { + do_test incrblob2-1.$iOffset.1 { + set fd [db incrblob blobs data 1] + puts $fd "[string repeat x $iOffset]SQLite version 3.6.0" + close $fd + } {} + + do_test incrblob2-1.$iOffset.2 { + set fd1 [db incrblob blobs data 1] + set fd2 [db incrblob blobs data 1] + fconfigure $fd1 -buffering none + fconfigure $fd2 -buffering none + if {$iOffset != 0} { + seek $fd2 $iOffset start + seek $fd1 $iOffset start + } + read $fd1 6 + } {SQLite} + + do_test incrblob2-1.$iOffset.3 { + read $fd2 6 + } {SQLite} + + do_test incrblob2-1.$iOffset.4 { + seek $fd2 $iOffset start + seek $fd1 $iOffset start + puts -nonewline $fd2 "etiLQS" + } {} + + + do_test incrblob2-1.$iOffset.5 { + seek $fd1 $iOffset start + read $fd1 6 + } {etiLQS} + + do_test incrblob2-1.$iOffset.6 { + seek $fd2 $iOffset start + read $fd2 6 + } {etiLQS} + + do_test incrblob2-1.$iOffset.7 { + seek $fd1 $iOffset start + read $fd1 6 + } {etiLQS} + + do_test incrblob2-1.$iOffset.8 { + close $fd1 + close $fd2 + } {} +} + +#-------------------------------------------------------------------------- + +foreach iOffset [list 0 256 4094] { + + do_test incrblob2-2.$iOffset.1 { + set fd1 [db incrblob blobs data 1] + seek $fd1 [expr $iOffset - 10240] end + fconfigure $fd1 -buffering none + + set fd2 [db incrblob blobs data 1] + seek $fd2 [expr $iOffset - 10240] end + fconfigure $fd2 -buffering none + + puts -nonewline $fd1 "123456" + } {} + + do_test incrblob2-2.$iOffset.2 { + read $fd2 6 + } {123456} + + do_test incrblob2-2.$iOffset.3 { + close $fd1 + close $fd2 + } {} +} + +do_test incrblob2-3.1 { + set fd1 [db incrblob blobs data 1] + fconfigure $fd1 -buffering none +} {} +do_test incrblob2-3.2 { + execsql { + INSERT INTO blobs VALUES(4, zeroblob(10240)); + } +} {} +do_test incrblob2-3.3 { + set rc [catch { read $fd1 6 } msg] + list $rc $msg +} "1 {error reading \"$fd1\": interrupted system call}" +do_test incrblob2-3.4 { + close $fd1 +} {} + + +finish_test +