diff --git a/manifest b/manifest index 43d28496ce..7edb5ed8a5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C More\suntested\schanges\sfor\swince\scontributed\sby\susers.\s\sTicket\s#2702.\s(CVS\s4479) -D 2007-10-08T15:06:04 +C Fixes\sto\sthe\stest\ssuite\s(no\scode\schanges)\sso\sthat\squick.test\sruns\swith\sOMIT_ATTACH\sbuilds.\s#2706.\s(CVS\s4480) +D 2007-10-09T08:29:32 F Makefile.in 75b729d562e9525d57d9890ec598b38e1a8b02bc F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -177,21 +177,21 @@ F src/where.c 44042c8b9d0d054cc318c3a0df052215ebf49d2d F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/all.test b59d1bd8b0c1d4a08b845e8af48fd43926f01f11 -F test/alter.test c2a9402e17a731e5294ef370214bd9f88351d18d -F test/alter2.test 816574fd9302af05e95895758aff2811090c6c78 -F test/alter3.test a6eec8f454be9b6ce73d8d7dc711453675a10ce7 +F test/alter.test 908659f97a0f97504da2f71ebc14e84b440a52ab +F test/alter2.test 489140038c13f4f9c76a0a8243eb1249f44d4ce1 +F test/alter3.test 8ce6b9c5605b3cfe7b901f454ecaf174c4f93e31 F test/altermalloc.test 29d4a8400277efb4ba8ffe90804c6dc2fdfbf063 F test/analyze.test 2f55535aa335785db1a2f97d3f3831c16c09f8b0 F test/async.test ae370c6169e314f0f82dcbe59fbc8589b23dfc2f F test/async2.test e56affa75ed822424a6f9b12b22db8031433bb7c F test/async3.test 08ea0217083e4866eb1b0147158298f2a2cd1346 -F test/attach.test 8880661ee05a7fdeb2d3868e66c08aab21cec8f1 -F test/attach2.test 78bc1a25ea8785c7571b44f5947ada2bd5d78127 -F test/attach3.test eafcafb107585aecc2ed1569a77914138eef46a9 -F test/attachmalloc.test 475c95e9d5756318f62226e2d2299e64ecdbc543 -F test/auth.test 66923137cf78475f5671b5e6e6274935e055aea0 +F test/attach.test 72529edb04115675894a7399609983ea46b73ba6 +F test/attach2.test 099e46a9a753035ff1b8ec0954e18ea50a934df3 +F test/attach3.test 7b92dc8e40c1ebca9732ca6f2d3fefbd46f196df +F test/attachmalloc.test 56c5e55563dba6d64641ef2f70ce06900df16912 +F test/auth.test 6d98da67f40475ff9eba99b4a74954c123ba1792 F test/auth2.test 8da06f0ffcfd98154dda78e0f3b35a6503c27b64 -F test/autoinc.test 60005a676e3e4e17dfa9dbd08aa0b76587ff97e3 +F test/autoinc.test 0e67964f4855081e3a325e484adfebaab41f23a1 F test/autovacuum.test 4339e66003b9cf813dd667a83aed2dee27c4c36d F test/autovacuum_crash.test 05a63b8805b20cfba7ace82856ce4ccdda075a31 F test/autovacuum_ioerr.test c46a76869cb6eddbbb40b419b2b6c4c001766b1f @@ -234,7 +234,7 @@ F test/corrupt.test 18c7a995b1af76a8c8600b996257f2c7b7bff083 F test/corrupt2.test 572f8df0303d0ce63ddad5c5c9101a83a345ae46 F test/corrupt3.test 263e8bb04e2728df832fddf6973cf54c91db0c32 F test/corrupt4.test acdb01afaedf529004b70e55de1a6f5a05ae7fff -F test/crash.test 24020168cc42977a4dd83ff78d2b5eb6577715db +F test/crash.test e8b9385771789851f030045c68fdf369ca030fc6 F test/crash2.test 26d7a4c5520201e5de2c696ea51ab946b59dc0e9 F test/crash3.test 0b09687ae1a3ccbcefdfaeb4b963e26e36255d76 F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2 @@ -250,9 +250,9 @@ F test/descidx3.test 3a55b8d73bc3e9ad084e0da7fec781cf0d2a0356 F test/diskfull.test 34ef53e88372c5b5e488ad1581514559a224c2b1 F test/distinctagg.test 2b89d1c5220d966a30ba4b40430338669301188b F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea -F test/enc2.test 45710bacfa9df29720bc84c067dfdf8c8ddfb797 +F test/enc2.test 6d91a5286f59add0cfcbb2d0da913b76f2242398 F test/enc3.test 9331988b9d72decec96995c90637e87b00d747a5 -F test/exclusive.test 00d5328b243083ccda7729f275eedc6c4e02ae29 +F test/exclusive.test ebaf72ce9ff8f7ab3a09bf8f58fd65393dfff386 F test/exclusive2.test d13bf66753dca46e61241d35d36ab7c868b0d313 F test/exclusive3.test 0e49c35b7e7cb8e7280b4ce3f0359d30b207d2ff F test/expr.test dc50ec4e69f1168eece91f9c18dcff59b718e44c @@ -311,14 +311,14 @@ F test/fuzz.test 62fc19dd36a427777fd671b569df07166548628a F test/fuzz2.test ea38692ce2da99ad79fe0be5eb1a452c1c4d37bb F test/fuzz_common.tcl ff4bc2dfc465f6878f8e2d819620914365382731 F test/fuzz_malloc.test 166b58dfd77cc04f6afeeaef0cfc1087abf134d1 -F test/hook.test 7e7645fd9a033f79cce8fdff151e32715e7ec50a +F test/hook.test 3870abead2ee75d2c03585c916256ca8b5584679 F test/icu.test e6bfae7f625c88fd14df6f540fe835bdfc1e4329 F test/in.test 369cb2aa1eab02296b4ec470732fe8c131260b1d F test/in2.test b1f447f4f0f67e9f83ff931e7e2e30873f9ea055 -F test/incrblob.test daad09b0d18eb419ac824c9896b7432882f9c0a5 +F test/incrblob.test 602dbfa956904d6e58c45635b58850ad0f02d927 F test/incrblob_err.test 5273097dc7c97f9b7008423a6ffd5c80d21923cb F test/incrvacuum.test 985bc94a7ff544db09aec3a0c93c779280da9415 -F test/incrvacuum2.test 82397ceb5941cbe852fd29bb33fcdf5665bc80c2 +F test/incrvacuum2.test a958e378c193c4012cb3787804d863487f1dfad1 F test/incrvacuum_ioerr.test cb331403b8dea3c5bae6163861ff25037b0df56a F test/index.test e65df12bed94b2903ee89987115e1578687e9266 F test/index2.test ee83c6b5e3173a3d7137140d945d9a5d4fdfb9d6 @@ -326,11 +326,11 @@ F test/index3.test f66718cd92ce1216819d47e6a156755e4b2c4ca1 F test/insert.test aef273dd1cee84cc92407469e6bd1b3cdcb76908 F test/insert2.test 5a20e1ace5fa0800b58d28284212290189b49aed F test/insert3.test 9a4ef3526fd3cca8b05278020ec3100448b4c677 -F test/insert4.test d7d256791e549de24e0a27a213405e1204e7a4dd +F test/insert4.test ac36af0ea9e6a2447f0d9b65da512498018a7743 F test/interrupt.test 81555fb0f8179bb2d0dc7151fd75428223f93cf2 F test/intpkey.test af4fd826c4784ec5c93b444de07adea0254d0d30 -F test/io.test a5923f1c45144d167e4faa8b16dc83348038eed0 -F test/ioerr.test 4b175825ed42b04f935e00f57cfb2a9f0c13de7d +F test/io.test 835b0ec66166312ff743e2fd11a878c65068de9f +F test/ioerr.test ae429185a3a11a318aa7ec64e2188e6119e43bca F test/ioerr2.test e3d52c40f43f9b61da9b38951a737e7b84ebae96 F test/join.test af0443185378b64878750aa1cf4b83c216f246b4 F test/join2.test f2171c265e57ee298a27e57e7051d22962f9f324 @@ -349,9 +349,9 @@ F test/lock2.test 5f9557b775662c2a5ee435378f39e10d64f65cb3 F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9 F test/lock4.test f358fa835dff485d462072eee991111f09e87441 F test/main.test 05f585bb70c05caac3e047903b517cbb319ed204 -F test/malloc.test fc062a1233cc0d139a6058caf1b2129bb73f86a1 +F test/malloc.test 16ee55742216e3d0fdadb695fb90ad229f46b32c F test/malloc2.test 1506ab3a4490b38b8850a6fa3e12591235179872 -F test/malloc3.test cf2efe9d16194276f227f34ac341019e013fb17d +F test/malloc3.test 3d690cbd66c93a3d41606ed8cfcbe1c9853e9d83 F test/malloc4.test f0e5e0f639f61e2776a6c3f5308f836b3ad8b3c7 F test/malloc5.test 18f3f71756e775a17ce4d0c49d76fb0027dda066 F test/malloc6.test d05fd71ef3c5983d10e0a6d728ea4a502a45a9e4 @@ -361,7 +361,7 @@ F test/malloc9.test 95d7069ad4fa262bf33bc4c5ca0a46f2bb2391cb F test/mallocA.test f474c5bdbef4070e11c89d01ba1b0e78f955b97a F test/mallocB.test 83bdbea443cc81758a57b0287807b0941218819a F test/mallocC.test 6f02fa2b4baa943bc6d6db323d5d07067967e728 -F test/mallocD.test 473db9092f962685ca5710a153d2abbe3428bb9e +F test/mallocD.test d638fb8f214b47fd31edfae8af738b92bd943dc0 F test/malloc_common.tcl b47137fb36e95fdafb0267745afefcd6b0a5b9dc F test/manydb.test 8de36b8d33aab5ef295b11d9e95310aeded31af8 F test/memdb.test a67bda4ff90a38f2b19f6c7f95aa7289e051d893 @@ -385,8 +385,8 @@ F test/pager2.test c025f91b75fe65e85febda64d9416428b8a5cab5 F test/pager3.test 2323bf27fd5bd887b580247e5bce500ceee994b4 F test/pageropt.test 51e3c091bc2992f5098f7576e3594e1908988939 F test/pagesize.test e0a8b3fe80f8b8e808d94a00734c7a18c76c407e -F test/pragma.test b0e73879206934a835856a8b8c4cc884cd8562f3 -F test/pragma2.test 5e063bf1d4dfd6baa885cd1809fcd5b2609e9dab +F test/pragma.test ab9ba0fb289ae25982b20bdfa9b4f009de82d49f +F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47 F test/printf.test 6bf1a86c6a1e45536f72d782bf44c8e3c76510f8 F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301 x F test/ptrchng.test 38ae1806833d72d9a81a6121322e274f24937e18 @@ -397,8 +397,8 @@ F test/reindex.test 38b138abe36bf9a08c791ed44d9f76cd6b97b78b F test/rollback.test 0bd29070ba2f76da939347773fbda53337ebd61c F test/rowid.test d125991eea1ffdea800d48471afd8fc4acc10b01 F test/safety.test 4a06934e45d03b8b50ebcd8d174eb0367d2fd851 -F test/schema.test 401585200727464ef6bb0b3ba0f085f99a87cdce -F test/schema2.test b438d2c7fd627227f405887c2328b4aed5dad012 +F test/schema.test a8b000723375fd42c68d310091bdbd744fde647c +F test/schema2.test 35e1c9696443d6694c8980c411497c2b5190d32e F test/select1.test 7603a4d406ea00516233e26539d2fac0cc85e732 F test/select2.test f3c2678c3a9f3cf08ec4988a3845bda64be6d9e3 F test/select3.test 47439f28862489626b483b0c718cfb0562e6f6d5 @@ -407,7 +407,7 @@ F test/select5.test 0b47058d3e916c1fc9fe81f44b438e02bade21ce F test/select6.test 399f14b9ba37b768afe5d2cd8c12e4f340a69db8 F test/select7.test 7906735805cfbee4dddc0bed4c14e68d7f5f9c5f F test/server1.test f5b790d4c0498179151ca8a7715a65a7802c859c -F test/shared.test 3f27bca85ba3c032c346f895d42d4110cb5288e6 +F test/shared.test 56d006ab6a9f1ed9a0dcc642e34ed6d366c3c90f F test/shared2.test 0ee9de8964d70e451936a48c41cb161d9134ccf4 F test/shared3.test 01e3e124dbb3859788aabc7cfb82f7ea04421749 F test/shared_err.test bfe49fbbf26746a3c05255b1dc7230744182b744 @@ -417,19 +417,19 @@ F test/softheap1.test 29cbdb847e63ffef3af5da1e3cd15f44ee11d770 F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5 F test/speed1.test 22e1b27af0683ed44dcd2f93ed817a9c3e65084a F test/speed2.test 53177056baf6556dcbdcf032bbdfc41c1aa74ded -F test/speed3.test 688fe59ea7b4eabf62b955447aa6cc3249d69d7d -F test/sqllimits1.test 2495508114bd84f6fc9ece34d5a7bb3dc69359bc +F test/speed3.test e312d7e442a5047d730569fdae2ba99bc94e1a13 +F test/sqllimits1.test 3b08a538c9828041a5c1454293594d922602044d F test/subquery.test 8203f85db56ba022a57a0589890090c8feed4e59 F test/subselect.test 974e87f8fc91c5f00dd565316d396a5a6c3106c4 F test/substr.test d36c864a238e1f51e7829af660906f05d47b5e32 -F test/sync.test d05397b8f89f423dd6dba528692019ab036bc1c3 -F test/table.test dbdfd06aef054ad5aed8e57a782137d57d5c5528 +F test/sync.test ded6b39d8d8ca3c0c5518516c6371b3316d3e3a3 +F test/table.test 13b1c2e2fb4727b35ee1fb7641fc469214fd2455 F test/tableapi.test 92651a95c23cf955e92407928e640536402fa3cc F test/tclsqlite.test c7feea1985c3e8a1ed134ba342347d47fa762e43 -F test/temptable.test d9208644207cf205437907d994004f636309ccc7 +F test/temptable.test 19b851b9e3e64d91e9867619b2a3f5fffee6e125 F test/tester.tcl 913a808f05b0aed2fbb16481a423b1a5a118bdf0 F test/thread001.test 8fbd9559da0bbdc273e00318c7fd66c162020af7 -F test/thread002.test 1b886bc4cb396e2bba94be8996f159b2b5b605bc +F test/thread002.test 2c4ad2c386f60f6fe268cd91c769ee35b3c1fd0b F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35 F test/thread2.test 6d7b30102d600f51b4055ee3a5a19228799049fb F test/thread_common.tcl 8a9d7a4500dfdbbd36679c977831b62c130b76b1 @@ -448,7 +448,7 @@ F test/tkt1537.test e3a14332de9770be8ff14bd15c19a49cbec10808 F test/tkt1567.test 18023cc3626a365f0118e17b66decedec93b1a6f F test/tkt1644.test 80b6a2bb17885f3cf1cb886d97cdad13232bb869 F test/tkt1667.test ef52c857940755ea5eab24d68f808826e7dcdc94 -F test/tkt1873.test 7159a1c1bf627bbb03f11362e4ad4de11d6ff316 +F test/tkt1873.test 255a002b9afdcf8b0fa3188984e2c964202340e9 F test/tkt2141.test f543d96f50d5a5dc0bc744f7db74ea166720ce46 F test/tkt2192.test d213199a51528feb2a0f80b5ee60d1e2abfd9679 F test/tkt2213.test 8cf7c446e1fcd0627fffe7fc19046eb24ac7333b @@ -464,7 +464,7 @@ F test/tkt2643.test 3f3ebb743da00d4fed4fcf6daed92a0e18e57813 F test/tkt2686.test 8815c3eeae7c8363bd7c2889349ec39e8bc8000d F test/trace.test 75ffc1b992c780d054748a656e3e7fd674f18567 F test/trans.test b73289992b46d38d9479ecc4fdc03d8edb2413dc -F test/trigger1.test b361161cf20614024cc1e52ea0bdec250776b2ae +F test/trigger1.test 7c13f39ca36f529bf856e05c7d004fc0531d48b4 F test/trigger2.test 33bf8ae9b788013be194efe5f66c04a202facbb4 F test/trigger3.test 9102fd3933db294dc654b5aee9edfe9e94f2b9e2 F test/trigger4.test 8e90ee98cba940cd5f96493f82e55083806ab8a0 @@ -482,14 +482,14 @@ F test/utf16align.test 7360e84472095518c56746f76b1f9d4dce99fb4d F test/vacuum.test cf839fc3ff24d601057319bbb5c700ce9c8e0fb0 F test/vacuum2.test e198d81a1cbc3f3f6b8aeee27cadfffea8995d42 F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102 -F test/view.test 852bd4101e6d171c46ad682eb5c5faf662b2eba4 -F test/vtab1.test 2f0afae624babc671af2052e88e98b4ac4aafd1e +F test/view.test 7e15fa1ba3267ddaa9ae96b6daf519f23f95b43e +F test/vtab1.test 3271e7c5128f17a16fee795f273c4658da97c168 F test/vtab2.test 94bb3bf691ac10e34cf7dad46b1cf94b861d513c F test/vtab3.test f38d6d7d19f08bffdadce4d5b8cba078f8118587 F test/vtab4.test a9d7104d41a787754a734740d7aa61c807a69f87 F test/vtab5.test 26bc7a0a52c5c2bcfa849ba327f8a0d4abccdb23 F test/vtab6.test ec0036f29f8a803da9935206f2d9d1b6a8026392 -F test/vtab7.test 5f9ef9fb84733e928d5d0267c821072561b198d5 +F test/vtab7.test 9249e8e31f4f1a44f07984b402d12ce3e63be4f3 F test/vtab8.test e19fa4a538fcd1bb66c22825fa8f71618fb13583 F test/vtab9.test ea58d2b95d61955f87226381716b2d0b1d4e4f9b F test/vtabA.test 9cb6b1afead6fdd91bbdf1ca65c44ccfd9b10936 @@ -581,7 +581,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P 27346fa55ed9b5c20016d07a37268fbd42dc097f -R 2ac64ff791413acc80640b875cdb23e3 -U drh -Z 64719b764c78c200eccd02a7c4303411 +P ccd709e1791b1c1091a61139633b972b378c1816 +R 6c6a7773faeda4091116a43ab452b402 +U danielk1977 +Z a91cdcc7bf556827c74c0b09ee7b03b3 diff --git a/manifest.uuid b/manifest.uuid index 4f0a11adc6..58781ae33e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ccd709e1791b1c1091a61139633b972b378c1816 \ No newline at end of file +07c00fffe50e8380748f7ae02328531a75d64610 \ No newline at end of file diff --git a/test/alter.test b/test/alter.test index c013cc0cea..58b42980a4 100644 --- a/test/alter.test +++ b/test/alter.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this script is testing the ALTER TABLE statement. # -# $Id: alter.test,v 1.25 2007/05/15 16:51:37 drh Exp $ +# $Id: alter.test,v 1.26 2007/10/09 08:29:32 danielk1977 Exp $ # set testdir [file dirname $argv0] @@ -203,50 +203,52 @@ do_test alter-1.7 { # Check that ALTER TABLE works on attached databases. # -do_test alter-1.8.1 { - file delete -force test2.db - file delete -force test2.db-journal - execsql { - ATTACH 'test2.db' AS aux; - } -} {} -do_test alter-1.8.2 { - execsql { - CREATE TABLE t4(a PRIMARY KEY, b, c); - CREATE TABLE aux.t4(a PRIMARY KEY, b, c); - CREATE INDEX i4 ON t4(b); - CREATE INDEX aux.i4 ON t4(b); - } -} {} -do_test alter-1.8.3 { - execsql { - INSERT INTO t4 VALUES('main', 'main', 'main'); - INSERT INTO aux.t4 VALUES('aux', 'aux', 'aux'); - SELECT * FROM t4 WHERE a = 'main'; - } -} {main main main} -do_test alter-1.8.4 { - execsql { - ALTER TABLE t4 RENAME TO t5; - SELECT * FROM t4 WHERE a = 'aux'; - } -} {aux aux aux} -do_test alter-1.8.5 { - execsql { - SELECT * FROM t5; - } -} {main main main} -do_test alter-1.8.6 { - execsql { - SELECT * FROM t5 WHERE b = 'main'; - } -} {main main main} -do_test alter-1.8.7 { - execsql { - ALTER TABLE aux.t4 RENAME TO t5; - SELECT * FROM aux.t5 WHERE b = 'aux'; - } -} {aux aux aux} +ifcapable attach { + do_test alter-1.8.1 { + file delete -force test2.db + file delete -force test2.db-journal + execsql { + ATTACH 'test2.db' AS aux; + } + } {} + do_test alter-1.8.2 { + execsql { + CREATE TABLE t4(a PRIMARY KEY, b, c); + CREATE TABLE aux.t4(a PRIMARY KEY, b, c); + CREATE INDEX i4 ON t4(b); + CREATE INDEX aux.i4 ON t4(b); + } + } {} + do_test alter-1.8.3 { + execsql { + INSERT INTO t4 VALUES('main', 'main', 'main'); + INSERT INTO aux.t4 VALUES('aux', 'aux', 'aux'); + SELECT * FROM t4 WHERE a = 'main'; + } + } {main main main} + do_test alter-1.8.4 { + execsql { + ALTER TABLE t4 RENAME TO t5; + SELECT * FROM t4 WHERE a = 'aux'; + } + } {aux aux aux} + do_test alter-1.8.5 { + execsql { + SELECT * FROM t5; + } + } {main main main} + do_test alter-1.8.6 { + execsql { + SELECT * FROM t5 WHERE b = 'main'; + } + } {main main main} + do_test alter-1.8.7 { + execsql { + ALTER TABLE aux.t4 RENAME TO t5; + SELECT * FROM aux.t5 WHERE b = 'aux'; + } + } {aux aux aux} +} do_test alter-1.9.1 { execsql { @@ -396,36 +398,38 @@ do_test alter-3.1.8 { # quoting. Otherwise the sqlite_alter_trigger() function might not work. file delete -force test3.db file delete -force test3.db-journal -do_test alter-3.2.1 { - catchsql { - ATTACH 'test3.db' AS ON; - } -} {1 {near "ON": syntax error}} -do_test alter-3.2.2 { - catchsql { - ATTACH 'test3.db' AS 'ON'; - } -} {0 {}} -do_test alter-3.2.3 { - catchsql { - CREATE TABLE ON.t1(a, b, c); - } -} {1 {near "ON": syntax error}} -do_test alter-3.2.4 { - catchsql { - CREATE TABLE 'ON'.t1(a, b, c); - } -} {0 {}} -do_test alter-3.2.4 { - catchsql { - CREATE TABLE 'ON'.ON(a, b, c); - } -} {1 {near "ON": syntax error}} -do_test alter-3.2.5 { - catchsql { - CREATE TABLE 'ON'.'ON'(a, b, c); - } -} {0 {}} +ifcapable attach { + do_test alter-3.2.1 { + catchsql { + ATTACH 'test3.db' AS ON; + } + } {1 {near "ON": syntax error}} + do_test alter-3.2.2 { + catchsql { + ATTACH 'test3.db' AS 'ON'; + } + } {0 {}} + do_test alter-3.2.3 { + catchsql { + CREATE TABLE ON.t1(a, b, c); + } + } {1 {near "ON": syntax error}} + do_test alter-3.2.4 { + catchsql { + CREATE TABLE 'ON'.t1(a, b, c); + } + } {0 {}} + do_test alter-3.2.4 { + catchsql { + CREATE TABLE 'ON'.ON(a, b, c); + } + } {1 {near "ON": syntax error}} + do_test alter-3.2.5 { + catchsql { + CREATE TABLE 'ON'.'ON'(a, b, c); + } + } {0 {}} +} do_test alter-3.2.6 { catchsql { CREATE TABLE t10(a, ON, c); @@ -441,11 +445,13 @@ do_test alter-3.2.8 { CREATE TRIGGER trig4 AFTER INSERT ON ON BEGIN SELECT 1; END; } } {1 {near "ON": syntax error}} -do_test alter-3.2.9 { - catchsql { - CREATE TRIGGER 'on'.trig4 AFTER INSERT ON 'ON' BEGIN SELECT 1; END; - } -} {0 {}} +ifcapable attach { + do_test alter-3.2.9 { + catchsql { + CREATE TRIGGER 'on'.trig4 AFTER INSERT ON 'ON' BEGIN SELECT 1; END; + } + } {0 {}} +} do_test alter-3.2.10 { execsql { DROP TABLE t10; diff --git a/test/alter2.test b/test/alter2.test index 9c73992001..e0c667e44f 100644 --- a/test/alter2.test +++ b/test/alter2.test @@ -13,7 +13,7 @@ # file format change that may be used in the future to implement # "ALTER TABLE ... ADD COLUMN". # -# $Id: alter2.test,v 1.9 2007/09/12 17:01:45 danielk1977 Exp $ +# $Id: alter2.test,v 1.10 2007/10/09 08:29:32 danielk1977 Exp $ # set testdir [file dirname $argv0] @@ -287,15 +287,17 @@ do_test alter2-6.1 { set ::DB [sqlite3_connection_pointer db] get_file_format } {2} -do_test alter2-6.2 { - file delete -force test2.db-journal - file delete -force test2.db - execsql { - ATTACH 'test2.db' AS aux; - CREATE TABLE aux.t1(a, b); - } - get_file_format test2.db -} $default_file_format +ifcapable attach { + do_test alter2-6.2 { + file delete -force test2.db-journal + file delete -force test2.db + execsql { + ATTACH 'test2.db' AS aux; + CREATE TABLE aux.t1(a, b); + } + get_file_format test2.db + } $default_file_format +} do_test alter2-6.3 { execsql { CREATE TABLE t1(a, b); diff --git a/test/alter3.test b/test/alter3.test index a9aa02e4f1..0c51940031 100644 --- a/test/alter3.test +++ b/test/alter3.test @@ -13,7 +13,7 @@ # file format change that may be used in the future to implement # "ALTER TABLE ... ADD COLUMN". # -# $Id: alter3.test,v 1.9 2006/01/17 09:35:02 danielk1977 Exp $ +# $Id: alter3.test,v 1.10 2007/10/09 08:29:32 danielk1977 Exp $ # set testdir [file dirname $argv0] @@ -236,71 +236,73 @@ do_test alter3-4.99 { } } {} -do_test alter3-5.1 { - file delete -force test2.db - file delete -force test2.db-journal - execsql { - CREATE TABLE t1(a, b); - INSERT INTO t1 VALUES(1, 'one'); - INSERT INTO t1 VALUES(2, 'two'); - ATTACH 'test2.db' AS aux; - CREATE TABLE aux.t1 AS SELECT * FROM t1; - PRAGMA aux.schema_version = 30; - SELECT sql FROM aux.sqlite_master; - } -} {{CREATE TABLE t1(a,b)}} -do_test alter3-5.2 { - execsql { - ALTER TABLE aux.t1 ADD COLUMN c VARCHAR(128); - SELECT sql FROM aux.sqlite_master; - } -} {{CREATE TABLE t1(a,b, c VARCHAR(128))}} -do_test alter3-5.3 { - execsql { - SELECT * FROM aux.t1; - } -} {1 one {} 2 two {}} -ifcapable schema_version { - do_test alter3-5.4 { +ifcapable attach { + do_test alter3-5.1 { + file delete -force test2.db + file delete -force test2.db-journal execsql { - PRAGMA aux.schema_version; - } - } {31} -} -if {!$has_codec} { - do_test alter3-5.5 { - list [get_file_format test2.db] [get_file_format] - } {2 3} -} -do_test alter3-5.6 { - execsql { - ALTER TABLE aux.t1 ADD COLUMN d DEFAULT 1000; - SELECT sql FROM aux.sqlite_master; - } -} {{CREATE TABLE t1(a,b, c VARCHAR(128), d DEFAULT 1000)}} -do_test alter3-5.7 { - execsql { - SELECT * FROM aux.t1; - } -} {1 one {} 1000 2 two {} 1000} -ifcapable schema_version { - do_test alter3-5.8 { + CREATE TABLE t1(a, b); + INSERT INTO t1 VALUES(1, 'one'); + INSERT INTO t1 VALUES(2, 'two'); + ATTACH 'test2.db' AS aux; + CREATE TABLE aux.t1 AS SELECT * FROM t1; + PRAGMA aux.schema_version = 30; + SELECT sql FROM aux.sqlite_master; + } + } {{CREATE TABLE t1(a,b)}} + do_test alter3-5.2 { execsql { - PRAGMA aux.schema_version; + ALTER TABLE aux.t1 ADD COLUMN c VARCHAR(128); + SELECT sql FROM aux.sqlite_master; } - } {32} + } {{CREATE TABLE t1(a,b, c VARCHAR(128))}} + do_test alter3-5.3 { + execsql { + SELECT * FROM aux.t1; + } + } {1 one {} 2 two {}} + ifcapable schema_version { + do_test alter3-5.4 { + execsql { + PRAGMA aux.schema_version; + } + } {31} + } + if {!$has_codec} { + do_test alter3-5.5 { + list [get_file_format test2.db] [get_file_format] + } {2 3} + } + do_test alter3-5.6 { + execsql { + ALTER TABLE aux.t1 ADD COLUMN d DEFAULT 1000; + SELECT sql FROM aux.sqlite_master; + } + } {{CREATE TABLE t1(a,b, c VARCHAR(128), d DEFAULT 1000)}} + do_test alter3-5.7 { + execsql { + SELECT * FROM aux.t1; + } + } {1 one {} 1000 2 two {} 1000} + ifcapable schema_version { + do_test alter3-5.8 { + execsql { + PRAGMA aux.schema_version; + } + } {32} + } + do_test alter3-5.9 { + execsql { + SELECT * FROM t1; + } + } {1 one 2 two} + do_test alter3-5.99 { + execsql { + DROP TABLE aux.t1; + DROP TABLE t1; + } + } {} } -do_test alter3-5.9 { - execsql { - SELECT * FROM t1; - } -} {1 one 2 two} -do_test alter3-5.99 { - execsql { - DROP TABLE aux.t1; - DROP TABLE t1; - } -} {} #---------------------------------------------------------------- # Test that the table schema is correctly reloaded when a column diff --git a/test/attach.test b/test/attach.test index 2fb6d7727e..096bb85fae 100644 --- a/test/attach.test +++ b/test/attach.test @@ -12,12 +12,17 @@ # focus of this script is testing the ATTACH and DETACH commands # and related functionality. # -# $Id: attach.test,v 1.46 2007/09/12 17:01:45 danielk1977 Exp $ +# $Id: attach.test,v 1.47 2007/10/09 08:29:32 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl +ifcapable !attach { + finish_test + return +} + for {set i 2} {$i<=15} {incr i} { file delete -force test$i.db file delete -force test$i.db-journal diff --git a/test/attach2.test b/test/attach2.test index 6e79f29946..e859eb4e9e 100644 --- a/test/attach2.test +++ b/test/attach2.test @@ -12,12 +12,17 @@ # focus of this script is testing the ATTACH and DETACH commands # and related functionality. # -# $Id: attach2.test,v 1.36 2007/08/10 19:46:14 drh Exp $ +# $Id: attach2.test,v 1.37 2007/10/09 08:29:32 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl +ifcapable !attach { + finish_test + return +} + # Ticket #354 # # Databases test.db and test2.db contain identical schemas. Make diff --git a/test/attach3.test b/test/attach3.test index d0702dfddd..98ad347002 100644 --- a/test/attach3.test +++ b/test/attach3.test @@ -12,13 +12,17 @@ # focus of this script is testing the ATTACH and DETACH commands # and schema changes to attached databases. # -# $Id: attach3.test,v 1.17 2006/06/20 11:01:09 danielk1977 Exp $ +# $Id: attach3.test,v 1.18 2007/10/09 08:29:32 danielk1977 Exp $ # - set testdir [file dirname $argv0] source $testdir/tester.tcl +ifcapable !attach { + finish_test + return +} + # Create tables t1 and t2 in the main database execsql { CREATE TABLE t1(a, b); diff --git a/test/attachmalloc.test b/test/attachmalloc.test index 38778ca08a..56553d06c6 100644 --- a/test/attachmalloc.test +++ b/test/attachmalloc.test @@ -12,13 +12,13 @@ # focus of this script is testing the ATTACH statement and # specifically out-of-memory conditions within that command. # -# $Id: attachmalloc.test,v 1.6 2007/10/03 08:46:45 danielk1977 Exp $ +# $Id: attachmalloc.test,v 1.7 2007/10/09 08:29:32 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl -ifcapable !memdebug { +ifcapable !memdebug||!attach { finish_test return } diff --git a/test/auth.test b/test/auth.test index 0c6440475a..2614d9a7bf 100644 --- a/test/auth.test +++ b/test/auth.test @@ -12,7 +12,7 @@ # focus of this script is testing the sqlite3_set_authorizer() API # and related functionality. # -# $Id: auth.test,v 1.37 2006/08/24 14:59:46 drh Exp $ +# $Id: auth.test,v 1.38 2007/10/09 08:29:32 danielk1977 Exp $ # set testdir [file dirname $argv0] @@ -305,11 +305,13 @@ do_test auth-1.35.1 { } catchsql {SELECT * FROM t2} } {1 {access to t2.b is prohibited}} -do_test auth-1.35.2 { - execsql {ATTACH DATABASE 'test.db' AS two} - catchsql {SELECT * FROM two.t2} -} {1 {access to two.t2.b is prohibited}} -execsql {DETACH DATABASE two} +ifcapable attach { + do_test auth-1.35.2 { + execsql {ATTACH DATABASE 'test.db' AS two} + catchsql {SELECT * FROM two.t2} + } {1 {access to two.t2.b is prohibited}} + execsql {DETACH DATABASE two} +} do_test auth-1.36 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="b"} { @@ -1610,174 +1612,176 @@ do_test auth-1.250 { # ticket #340 - authorization for ATTACH and DETACH. # -do_test auth-1.251 { - db authorizer ::auth - proc auth {code arg1 arg2 arg3 arg4} { - if {$code=="SQLITE_ATTACH"} { - set ::authargs [list $arg1 $arg2 $arg3 $arg4] - } - return SQLITE_OK - } - catchsql { - ATTACH DATABASE ':memory:' AS test1 - } -} {0 {}} -do_test auth-1.252 { - set ::authargs -} {:memory: {} {} {}} -do_test auth-1.253 { - catchsql {DETACH DATABASE test1} - proc auth {code arg1 arg2 arg3 arg4} { - if {$code=="SQLITE_ATTACH"} { - set ::authargs [list $arg1 $arg2 $arg3 $arg4] - return SQLITE_DENY - } - return SQLITE_OK - } - catchsql { - ATTACH DATABASE ':memory:' AS test1; - } -} {1 {not authorized}} -do_test auth-1.254 { - lindex [execsql {PRAGMA database_list}] 7 -} {} -do_test auth-1.255 { - catchsql {DETACH DATABASE test1} - proc auth {code arg1 arg2 arg3 arg4} { - if {$code=="SQLITE_ATTACH"} { - set ::authargs [list $arg1 $arg2 $arg3 $arg4] - return SQLITE_IGNORE - } - return SQLITE_OK - } - catchsql { - ATTACH DATABASE ':memory:' AS test1; - } -} {0 {}} -do_test auth-1.256 { - lindex [execsql {PRAGMA database_list}] 7 -} {} -do_test auth-1.257 { - proc auth {code arg1 arg2 arg3 arg4} { - if {$code=="SQLITE_DETACH"} { - set ::authargs [list $arg1 $arg2 $arg3 $arg4] +ifcapable attach { + do_test auth-1.251 { + db authorizer ::auth + proc auth {code arg1 arg2 arg3 arg4} { + if {$code=="SQLITE_ATTACH"} { + set ::authargs [list $arg1 $arg2 $arg3 $arg4] + } return SQLITE_OK } - return SQLITE_OK - } - execsql {ATTACH DATABASE ':memory:' AS test1} - catchsql { - DETACH DATABASE test1; - } -} {0 {}} -do_test auth-1.258 { - lindex [execsql {PRAGMA database_list}] 7 -} {} -do_test auth-1.259 { - execsql {ATTACH DATABASE ':memory:' AS test1} - proc auth {code arg1 arg2 arg3 arg4} { - if {$code=="SQLITE_DETACH"} { - set ::authargs [list $arg1 $arg2 $arg3 $arg4] - return SQLITE_IGNORE + catchsql { + ATTACH DATABASE ':memory:' AS test1 } - return SQLITE_OK - } - catchsql { - DETACH DATABASE test1; - } -} {0 {}} -ifcapable tempdb { - ifcapable schema_pragmas { - do_test auth-1.260 { - lindex [execsql {PRAGMA database_list}] 7 - } {test1} - } ;# ifcapable schema_pragmas - do_test auth-1.261 { + } {0 {}} + do_test auth-1.252 { + set ::authargs + } {:memory: {} {} {}} + do_test auth-1.253 { + catchsql {DETACH DATABASE test1} proc auth {code arg1 arg2 arg3 arg4} { - if {$code=="SQLITE_DETACH"} { + if {$code=="SQLITE_ATTACH"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql { - DETACH DATABASE test1; + ATTACH DATABASE ':memory:' AS test1; } } {1 {not authorized}} - ifcapable schema_pragmas { - do_test auth-1.262 { + do_test auth-1.254 { lindex [execsql {PRAGMA database_list}] 7 - } {test1} - } ;# ifcapable schema_pragmas - db authorizer {} - execsql {DETACH DATABASE test1} - db authorizer ::auth - - # Authorization for ALTER TABLE. These tests are omitted if the library - # was built without ALTER TABLE support. - ifcapable altertable { - - do_test auth-1.263 { - proc auth {code arg1 arg2 arg3 arg4} { - if {$code=="SQLITE_ALTER_TABLE"} { - set ::authargs [list $arg1 $arg2 $arg3 $arg4] - return SQLITE_OK - } + } {} + do_test auth-1.255 { + catchsql {DETACH DATABASE test1} + proc auth {code arg1 arg2 arg3 arg4} { + if {$code=="SQLITE_ATTACH"} { + set ::authargs [list $arg1 $arg2 $arg3 $arg4] + return SQLITE_IGNORE + } + return SQLITE_OK + } + catchsql { + ATTACH DATABASE ':memory:' AS test1; + } + } {0 {}} + do_test auth-1.256 { + lindex [execsql {PRAGMA database_list}] 7 + } {} + do_test auth-1.257 { + proc auth {code arg1 arg2 arg3 arg4} { + if {$code=="SQLITE_DETACH"} { + set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_OK } - catchsql { - ALTER TABLE t1 RENAME TO t1x + return SQLITE_OK + } + execsql {ATTACH DATABASE ':memory:' AS test1} + catchsql { + DETACH DATABASE test1; + } + } {0 {}} + do_test auth-1.258 { + lindex [execsql {PRAGMA database_list}] 7 + } {} + do_test auth-1.259 { + execsql {ATTACH DATABASE ':memory:' AS test1} + proc auth {code arg1 arg2 arg3 arg4} { + if {$code=="SQLITE_DETACH"} { + set ::authargs [list $arg1 $arg2 $arg3 $arg4] + return SQLITE_IGNORE } - } {0 {}} - do_test auth-1.264 { - execsql {SELECT name FROM sqlite_temp_master WHERE type='table'} - } {t1x} - do_test auth-1.265 { - set authargs - } {temp t1 {} {}} - do_test auth-1.266 { + return SQLITE_OK + } + catchsql { + DETACH DATABASE test1; + } + } {0 {}} + ifcapable tempdb { + ifcapable schema_pragmas { + do_test auth-1.260 { + lindex [execsql {PRAGMA database_list}] 7 + } {test1} + } ;# ifcapable schema_pragmas + do_test auth-1.261 { proc auth {code arg1 arg2 arg3 arg4} { - if {$code=="SQLITE_ALTER_TABLE"} { - set ::authargs [list $arg1 $arg2 $arg3 $arg4] - return SQLITE_IGNORE - } - return SQLITE_OK - } - catchsql { - ALTER TABLE t1x RENAME TO t1 - } - } {0 {}} - do_test auth-1.267 { - execsql {SELECT name FROM sqlite_temp_master WHERE type='table'} - } {t1x} - do_test auth-1.268 { - set authargs - } {temp t1x {} {}} - do_test auth-1.269 { - proc auth {code arg1 arg2 arg3 arg4} { - if {$code=="SQLITE_ALTER_TABLE"} { + if {$code=="SQLITE_DETACH"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] return SQLITE_DENY } return SQLITE_OK } catchsql { - ALTER TABLE t1x RENAME TO t1 + DETACH DATABASE test1; } } {1 {not authorized}} - do_test auth-1.270 { - execsql {SELECT name FROM sqlite_temp_master WHERE type='table'} - } {t1x} - - do_test auth-1.271 { - set authargs - } {temp t1x {} {}} - } ;# ifcapable altertable - -} else { - db authorizer {} - db eval { - DETACH DATABASE test1; + ifcapable schema_pragmas { + do_test auth-1.262 { + lindex [execsql {PRAGMA database_list}] 7 + } {test1} + } ;# ifcapable schema_pragmas + db authorizer {} + execsql {DETACH DATABASE test1} + db authorizer ::auth + + # Authorization for ALTER TABLE. These tests are omitted if the library + # was built without ALTER TABLE support. + ifcapable altertable { + + do_test auth-1.263 { + proc auth {code arg1 arg2 arg3 arg4} { + if {$code=="SQLITE_ALTER_TABLE"} { + set ::authargs [list $arg1 $arg2 $arg3 $arg4] + return SQLITE_OK + } + return SQLITE_OK + } + catchsql { + ALTER TABLE t1 RENAME TO t1x + } + } {0 {}} + do_test auth-1.264 { + execsql {SELECT name FROM sqlite_temp_master WHERE type='table'} + } {t1x} + do_test auth-1.265 { + set authargs + } {temp t1 {} {}} + do_test auth-1.266 { + proc auth {code arg1 arg2 arg3 arg4} { + if {$code=="SQLITE_ALTER_TABLE"} { + set ::authargs [list $arg1 $arg2 $arg3 $arg4] + return SQLITE_IGNORE + } + return SQLITE_OK + } + catchsql { + ALTER TABLE t1x RENAME TO t1 + } + } {0 {}} + do_test auth-1.267 { + execsql {SELECT name FROM sqlite_temp_master WHERE type='table'} + } {t1x} + do_test auth-1.268 { + set authargs + } {temp t1x {} {}} + do_test auth-1.269 { + proc auth {code arg1 arg2 arg3 arg4} { + if {$code=="SQLITE_ALTER_TABLE"} { + set ::authargs [list $arg1 $arg2 $arg3 $arg4] + return SQLITE_DENY + } + return SQLITE_OK + } + catchsql { + ALTER TABLE t1x RENAME TO t1 + } + } {1 {not authorized}} + do_test auth-1.270 { + execsql {SELECT name FROM sqlite_temp_master WHERE type='table'} + } {t1x} + + do_test auth-1.271 { + set authargs + } {temp t1x {} {}} + } ;# ifcapable altertable + + } else { + db authorizer {} + db eval { + DETACH DATABASE test1; + } } } diff --git a/test/autoinc.test b/test/autoinc.test index 134b4d8287..a9735f1b9a 100644 --- a/test/autoinc.test +++ b/test/autoinc.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this script is testing the AUTOINCREMENT features. # -# $Id: autoinc.test,v 1.9 2006/01/03 00:33:50 drh Exp $ +# $Id: autoinc.test,v 1.10 2007/10/09 08:29:32 danielk1977 Exp $ # set testdir [file dirname $argv0] @@ -416,7 +416,7 @@ ifcapable tempdb { # Make sure AUTOINCREMENT works on ATTACH-ed tables. # -ifcapable tempdb { +ifcapable tempdb&&attach { do_test autoinc-5.1 { file delete -force test2.db file delete -force test2.db-journal diff --git a/test/crash.test b/test/crash.test index 0d58f84a56..6a216be9b5 100644 --- a/test/crash.test +++ b/test/crash.test @@ -17,7 +17,7 @@ # These routines allow us to simulate the kind of file damage that # occurs after a power failure. # -# $Id: crash.test,v 1.25 2007/08/20 14:23:44 danielk1977 Exp $ +# $Id: crash.test,v 1.26 2007/10/09 08:29:32 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -209,98 +209,100 @@ for {set i 1} {$i < $repeats} {incr i} { # crash-4.3.*: Test recovery when crash occurs during sync() of the master # journal file. # -do_test crash-4.0 { - file delete -force test2.db - file delete -force test2.db-journal - execsql { - ATTACH 'test2.db' AS aux; - PRAGMA aux.default_cache_size = 10; - CREATE TABLE aux.abc2 AS SELECT 2*a as a, 2*b as b, 2*c as c FROM abc; +ifcapable attach { + do_test crash-4.0 { + file delete -force test2.db + file delete -force test2.db-journal + execsql { + ATTACH 'test2.db' AS aux; + PRAGMA aux.default_cache_size = 10; + CREATE TABLE aux.abc2 AS SELECT 2*a as a, 2*b as b, 2*c as c FROM abc; + } + expr ([file size test2.db] / 1024) > 450 + } {1} + + set fin 0 + for {set i 1} {$i<$repeats} {incr i} { + set sig [signature] + set sig2 [signature2] + do_test crash-4.1.$i.1 { + set c [crashsql -delay $i -file test.db-journal " + ATTACH 'test2.db' AS aux; + BEGIN; + SELECT randstr($i,$i) FROM abc LIMIT $i; + INSERT INTO abc VALUES(randstr(10,10), 0, 0); + DELETE FROM abc WHERE random()%10!=0; + INSERT INTO abc2 VALUES(randstr(10,10), 0, 0); + DELETE FROM abc2 WHERE random()%10!=0; + COMMIT; + "] + if { $c == {0 {}} } { + set ::fin 1 + set c {1 {child process exited abnormally}} + } + set c + } {1 {child process exited abnormally}} + if {$::fin} break + do_test crash-4.1.$i.2 { + signature + } $sig + do_test crash-4.1.$i.3 { + signature2 + } $sig2 + } + set i 0 + set fin 0 + while {[incr i]} { + set sig [signature] + set sig2 [signature2] + set ::fin 0 + do_test crash-4.2.$i.1 { + set c [crashsql -delay $i -file test2.db-journal " + ATTACH 'test2.db' AS aux; + BEGIN; + SELECT randstr($i,$i) FROM abc LIMIT $i; + INSERT INTO abc VALUES(randstr(10,10), 0, 0); + DELETE FROM abc WHERE random()%10!=0; + INSERT INTO abc2 VALUES(randstr(10,10), 0, 0); + DELETE FROM abc2 WHERE random()%10!=0; + COMMIT; + "] + if { $c == {0 {}} } { + set ::fin 1 + set c {1 {child process exited abnormally}} + } + set c + } {1 {child process exited abnormally}} + if { $::fin } break + do_test crash-4.2.$i.2 { + signature + } $sig + do_test crash-4.2.$i.3 { + signature2 + } $sig2 + } + for {set i 1} {$i < 5} {incr i} { + set sig [signature] + set sig2 [signature2] + do_test crash-4.3.$i.1 { + crashsql -delay 1 -file test.db-mj* " + ATTACH 'test2.db' AS aux; + BEGIN; + SELECT random() FROM abc LIMIT $i; + INSERT INTO abc VALUES(randstr(10,10), 0, 0); + DELETE FROM abc WHERE random()%10!=0; + INSERT INTO abc2 VALUES(randstr(10,10), 0, 0); + DELETE FROM abc2 WHERE random()%10!=0; + COMMIT; + " + } {1 {child process exited abnormally}} + do_test crash-4.3.$i.2 { + signature + } $sig + do_test crash-4.3.$i.3 { + signature2 + } $sig2 } - expr ([file size test2.db] / 1024) > 450 -} {1} - -set fin 0 -for {set i 1} {$i<$repeats} {incr i} { - set sig [signature] - set sig2 [signature2] - do_test crash-4.1.$i.1 { - set c [crashsql -delay $i -file test.db-journal " - ATTACH 'test2.db' AS aux; - BEGIN; - SELECT randstr($i,$i) FROM abc LIMIT $i; - INSERT INTO abc VALUES(randstr(10,10), 0, 0); - DELETE FROM abc WHERE random()%10!=0; - INSERT INTO abc2 VALUES(randstr(10,10), 0, 0); - DELETE FROM abc2 WHERE random()%10!=0; - COMMIT; - "] - if { $c == {0 {}} } { - set ::fin 1 - set c {1 {child process exited abnormally}} - } - set c - } {1 {child process exited abnormally}} - if {$::fin} break - do_test crash-4.1.$i.2 { - signature - } $sig - do_test crash-4.1.$i.3 { - signature2 - } $sig2 -} -set i 0 -set fin 0 -while {[incr i]} { - set sig [signature] - set sig2 [signature2] - set ::fin 0 - do_test crash-4.2.$i.1 { - set c [crashsql -delay $i -file test2.db-journal " - ATTACH 'test2.db' AS aux; - BEGIN; - SELECT randstr($i,$i) FROM abc LIMIT $i; - INSERT INTO abc VALUES(randstr(10,10), 0, 0); - DELETE FROM abc WHERE random()%10!=0; - INSERT INTO abc2 VALUES(randstr(10,10), 0, 0); - DELETE FROM abc2 WHERE random()%10!=0; - COMMIT; - "] - if { $c == {0 {}} } { - set ::fin 1 - set c {1 {child process exited abnormally}} - } - set c - } {1 {child process exited abnormally}} - if { $::fin } break - do_test crash-4.2.$i.2 { - signature - } $sig - do_test crash-4.2.$i.3 { - signature2 - } $sig2 -} -for {set i 1} {$i < 5} {incr i} { - set sig [signature] - set sig2 [signature2] - do_test crash-4.3.$i.1 { - crashsql -delay 1 -file test.db-mj* " - ATTACH 'test2.db' AS aux; - BEGIN; - SELECT random() FROM abc LIMIT $i; - INSERT INTO abc VALUES(randstr(10,10), 0, 0); - DELETE FROM abc WHERE random()%10!=0; - INSERT INTO abc2 VALUES(randstr(10,10), 0, 0); - DELETE FROM abc2 WHERE random()%10!=0; - COMMIT; - " - } {1 {child process exited abnormally}} - do_test crash-4.3.$i.2 { - signature - } $sig - do_test crash-4.3.$i.3 { - signature2 - } $sig2 } #-------------------------------------------------------------------------- diff --git a/test/enc2.test b/test/enc2.test index 03d4cbd798..ce25bf3956 100644 --- a/test/enc2.test +++ b/test/enc2.test @@ -13,7 +13,7 @@ # various suported unicode encodings (UTF-8, UTF-16, UTF-16le and # UTF-16be). # -# $Id: enc2.test,v 1.28 2006/09/23 20:36:03 drh Exp $ +# $Id: enc2.test,v 1.29 2007/10/09 08:29:32 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -170,26 +170,27 @@ foreach enc $encodings { # Test that it is an error to try to attach a database with a different # encoding to the main database. -do_test enc2-4.1 { - file delete -force test.db - sqlite3 db test.db - db eval "PRAGMA encoding = 'UTF-8'" - db eval "CREATE TABLE abc(a, b, c);" -} {} -do_test enc2-4.2 { - file delete -force test2.db - sqlite3 db2 test2.db - db2 eval "PRAGMA encoding = 'UTF-16'" - db2 eval "CREATE TABLE abc(a, b, c);" -} {} -do_test enc2-4.3 { - catchsql { - ATTACH 'test2.db' as aux; - } -} {1 {attached databases must use the same text encoding as main database}} - -db2 close -db close +ifcapable attach { + do_test enc2-4.1 { + file delete -force test.db + sqlite3 db test.db + db eval "PRAGMA encoding = 'UTF-8'" + db eval "CREATE TABLE abc(a, b, c);" + } {} + do_test enc2-4.2 { + file delete -force test2.db + sqlite3 db2 test2.db + db2 eval "PRAGMA encoding = 'UTF-16'" + db2 eval "CREATE TABLE abc(a, b, c);" + } {} + do_test enc2-4.3 { + catchsql { + ATTACH 'test2.db' as aux; + } + } {1 {attached databases must use the same text encoding as main database}} + db2 close + db close +} # The following tests - enc2-5.* - test that SQLite selects the correct # collation sequence when more than one is available. diff --git a/test/exclusive.test b/test/exclusive.test index 20e012f8bc..26048863fc 100644 --- a/test/exclusive.test +++ b/test/exclusive.test @@ -12,7 +12,7 @@ # of these tests is exclusive access mode (i.e. the thing activated by # "PRAGMA locking_mode = EXCLUSIVE"). # -# $Id: exclusive.test,v 1.6 2007/08/12 20:07:59 drh Exp $ +# $Id: exclusive.test,v 1.7 2007/10/09 08:29:32 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -84,82 +84,84 @@ do_test exclusive-1.6 { pragma temp.locking_mode; } } [list normal normal $temp_mode] -do_test exclusive-1.7 { - execsql { - pragma locking_mode = exclusive; - ATTACH 'test2.db' as aux; - } - execsql { - pragma main.locking_mode; - pragma aux.locking_mode; - } -} {exclusive exclusive} -do_test exclusive-1.8 { - execsql { - pragma main.locking_mode = normal; - } - execsql { - pragma main.locking_mode; - pragma temp.locking_mode; - pragma aux.locking_mode; - } -} [list normal $temp_mode exclusive] -do_test exclusive-1.9 { - execsql { - pragma locking_mode; - } -} {exclusive} -do_test exclusive-1.10 { - execsql { - ATTACH 'test3.db' as aux2; - } - execsql { - pragma main.locking_mode; - pragma aux.locking_mode; - pragma aux2.locking_mode; - } -} {normal exclusive exclusive} -do_test exclusive-1.11 { - execsql { - pragma aux.locking_mode = normal; - } - execsql { - pragma main.locking_mode; - pragma aux.locking_mode; - pragma aux2.locking_mode; - } -} {normal normal exclusive} -do_test exclusive-1.12 { - execsql { - pragma locking_mode = normal; - } - execsql { - pragma main.locking_mode; - pragma temp.locking_mode; - pragma aux.locking_mode; - pragma aux2.locking_mode; - } -} [list normal $temp_mode normal normal] -do_test exclusive-1.13 { - execsql { - ATTACH 'test4.db' as aux3; - } - execsql { - pragma main.locking_mode; - pragma temp.locking_mode; - pragma aux.locking_mode; - pragma aux2.locking_mode; - pragma aux3.locking_mode; - } -} [list normal $temp_mode normal normal normal] - -do_test exclusive-1.99 { - execsql { - DETACH aux; - DETACH aux2; - DETACH aux3; - } -} {} +ifcapable attach { + do_test exclusive-1.7 { + execsql { + pragma locking_mode = exclusive; + ATTACH 'test2.db' as aux; + } + execsql { + pragma main.locking_mode; + pragma aux.locking_mode; + } + } {exclusive exclusive} + do_test exclusive-1.8 { + execsql { + pragma main.locking_mode = normal; + } + execsql { + pragma main.locking_mode; + pragma temp.locking_mode; + pragma aux.locking_mode; + } + } [list normal $temp_mode exclusive] + do_test exclusive-1.9 { + execsql { + pragma locking_mode; + } + } {exclusive} + do_test exclusive-1.10 { + execsql { + ATTACH 'test3.db' as aux2; + } + execsql { + pragma main.locking_mode; + pragma aux.locking_mode; + pragma aux2.locking_mode; + } + } {normal exclusive exclusive} + do_test exclusive-1.11 { + execsql { + pragma aux.locking_mode = normal; + } + execsql { + pragma main.locking_mode; + pragma aux.locking_mode; + pragma aux2.locking_mode; + } + } {normal normal exclusive} + do_test exclusive-1.12 { + execsql { + pragma locking_mode = normal; + } + execsql { + pragma main.locking_mode; + pragma temp.locking_mode; + pragma aux.locking_mode; + pragma aux2.locking_mode; + } + } [list normal $temp_mode normal normal] + do_test exclusive-1.13 { + execsql { + ATTACH 'test4.db' as aux3; + } + execsql { + pragma main.locking_mode; + pragma temp.locking_mode; + pragma aux.locking_mode; + pragma aux2.locking_mode; + pragma aux3.locking_mode; + } + } [list normal $temp_mode normal normal normal] + + do_test exclusive-1.99 { + execsql { + DETACH aux; + DETACH aux2; + DETACH aux3; + } + } {} +} #---------------------------------------------------------------------- # Test cases exclusive-2.X verify that connections in exclusive diff --git a/test/hook.test b/test/hook.test index 1bbd6fb1a2..f70a73df24 100644 --- a/test/hook.test +++ b/test/hook.test @@ -17,7 +17,7 @@ # sqlite_update_hook (tests hook-4-*) # sqlite_rollback_hook (tests hook-5.*) # -# $Id: hook.test,v 1.11 2006/01/17 09:35:02 danielk1977 Exp $ +# $Id: hook.test,v 1.12 2007/10/09 08:29:32 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -177,23 +177,25 @@ ifcapable trigger { # Update-hook + ATTACH set ::update_hook {} -do_test hook-4.2.3 { - file delete -force test2.db - execsql { - ATTACH 'test2.db' AS aux; - CREATE TABLE aux.t3(a INTEGER PRIMARY KEY, b); - INSERT INTO aux.t3 SELECT * FROM t1; - UPDATE t3 SET b = 'two or so' WHERE a = 2; - DELETE FROM t3 WHERE 1; -- Avoid the truncate optimization (for now) - } - set ::update_hook -} [list \ - INSERT aux t3 1 \ - INSERT aux t3 2 \ - UPDATE aux t3 2 \ - DELETE aux t3 1 \ - DELETE aux t3 2 \ -] +ifcapable attach { + do_test hook-4.2.3 { + file delete -force test2.db + execsql { + ATTACH 'test2.db' AS aux; + CREATE TABLE aux.t3(a INTEGER PRIMARY KEY, b); + INSERT INTO aux.t3 SELECT * FROM t1; + UPDATE t3 SET b = 'two or so' WHERE a = 2; + DELETE FROM t3 WHERE 1; -- Avoid the truncate optimization (for now) + } + set ::update_hook + } [list \ + INSERT aux t3 1 \ + INSERT aux t3 2 \ + UPDATE aux t3 2 \ + DELETE aux t3 1 \ + DELETE aux t3 2 \ + ] +} ifcapable trigger { execsql { @@ -221,7 +223,7 @@ do_test hook-4.3.1 { DELETE main t1 3 \ ] set ::update_hook {} -ifcapable compound { +ifcapable compound&&attach { do_test hook-4.3.2 { execsql { SELECT * FROM t1 UNION SELECT * FROM t3; diff --git a/test/incrblob.test b/test/incrblob.test index 28d7132e9c..46f86e2e59 100644 --- a/test/incrblob.test +++ b/test/incrblob.test @@ -9,7 +9,7 @@ # #*********************************************************************** # -# $Id: incrblob.test,v 1.16 2007/09/03 16:45:36 drh Exp $ +# $Id: incrblob.test,v 1.17 2007/10/09 08:29:32 danielk1977 Exp $ # set testdir [file dirname $argv0] @@ -341,35 +341,37 @@ do_test incrblob-4.11 { # # Test that opening a blob in an attached database works. # -do_test incrblob-5.1 { - file delete -force test2.db test2.db-journal - set ::size [expr [file size [info script]]] - execsql { - ATTACH 'test2.db' AS aux; - CREATE TABLE aux.files(name, text); - INSERT INTO aux.files VALUES('this one', zeroblob($::size)); - } - set fd [db incrblob aux files text 1] - fconfigure $fd -translation binary - set fd2 [open [info script]] - fconfigure $fd2 -translation binary - puts -nonewline $fd [read $fd2] - close $fd - close $fd2 - set ::text [db one {select text from aux.files}] - string length $::text -} [file size [info script]] -do_test incrblob-5.2 { - set fd2 [open [info script]] - fconfigure $fd2 -translation binary - set ::data [read $fd2] - close $fd2 - set ::data -} $::text +ifcapable attach { + do_test incrblob-5.1 { + file delete -force test2.db test2.db-journal + set ::size [expr [file size [info script]]] + execsql { + ATTACH 'test2.db' AS aux; + CREATE TABLE aux.files(name, text); + INSERT INTO aux.files VALUES('this one', zeroblob($::size)); + } + set fd [db incrblob aux files text 1] + fconfigure $fd -translation binary + set fd2 [open [info script]] + fconfigure $fd2 -translation binary + puts -nonewline $fd [read $fd2] + close $fd + close $fd2 + set ::text [db one {select text from aux.files}] + string length $::text + } [file size [info script]] + do_test incrblob-5.2 { + set fd2 [open [info script]] + fconfigure $fd2 -translation binary + set ::data [read $fd2] + close $fd2 + set ::data + } $::text +} # free memory -unset ::data -unset ::text +unset -nocomplain ::data +unset -nocomplain ::text #------------------------------------------------------------------------ # incrblob-6.*: diff --git a/test/incrvacuum2.test b/test/incrvacuum2.test index 50da7a2056..dc16b6e681 100644 --- a/test/incrvacuum2.test +++ b/test/incrvacuum2.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the incremental vacuum feature. # -# $Id: incrvacuum2.test,v 1.3 2007/05/17 06:44:28 danielk1977 Exp $ +# $Id: incrvacuum2.test,v 1.4 2007/10/09 08:29:32 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -76,49 +76,51 @@ do_test incrvacuum2-1.4 { # Make sure incremental vacuum works on attached databases. # -do_test incrvacuum2-2.1 { - file delete -force test2.db test2.db-journal - execsql { - ATTACH DATABASE 'test2.db' AS aux; - PRAGMA aux.auto_vacuum=incremental; - CREATE TABLE aux.t2(x); - INSERT INTO t2 VALUES(zeroblob(30000)); - INSERT INTO t1 SELECT * FROM t2; - DELETE FROM t2; - DELETE FROM t1; - } - list [file size test.db] [file size test2.db] -} {32768 32768} -do_test incrvacuum2-2.2 { - execsql { - PRAGMA aux.incremental_vacuum(1) - } - list [file size test.db] [file size test2.db] -} {32768 31744} -do_test incrvacuum2-2.3 { - execsql { - PRAGMA aux.incremental_vacuum(5) - } - list [file size test.db] [file size test2.db] -} {32768 26624} -do_test incrvacuum2-2.4 { - execsql { - PRAGMA main.incremental_vacuum(5) - } - list [file size test.db] [file size test2.db] -} {27648 26624} -do_test incrvacuum2-2.5 { - execsql { - PRAGMA aux.incremental_vacuum - } - list [file size test.db] [file size test2.db] -} {27648 3072} -do_test incrvacuum2-2.6 { - execsql { - PRAGMA incremental_vacuum(1) - } - list [file size test.db] [file size test2.db] -} {26624 3072} +ifcapable attach { + do_test incrvacuum2-2.1 { + file delete -force test2.db test2.db-journal + execsql { + ATTACH DATABASE 'test2.db' AS aux; + PRAGMA aux.auto_vacuum=incremental; + CREATE TABLE aux.t2(x); + INSERT INTO t2 VALUES(zeroblob(30000)); + INSERT INTO t1 SELECT * FROM t2; + DELETE FROM t2; + DELETE FROM t1; + } + list [file size test.db] [file size test2.db] + } {32768 32768} + do_test incrvacuum2-2.2 { + execsql { + PRAGMA aux.incremental_vacuum(1) + } + list [file size test.db] [file size test2.db] + } {32768 31744} + do_test incrvacuum2-2.3 { + execsql { + PRAGMA aux.incremental_vacuum(5) + } + list [file size test.db] [file size test2.db] + } {32768 26624} + do_test incrvacuum2-2.4 { + execsql { + PRAGMA main.incremental_vacuum(5) + } + list [file size test.db] [file size test2.db] + } {27648 26624} + do_test incrvacuum2-2.5 { + execsql { + PRAGMA aux.incremental_vacuum + } + list [file size test.db] [file size test2.db] + } {27648 3072} + do_test incrvacuum2-2.6 { + execsql { + PRAGMA incremental_vacuum(1) + } + list [file size test.db] [file size test2.db] + } {26624 3072} +} diff --git a/test/insert4.test b/test/insert4.test index d85fec3e11..9d8c78e7c5 100644 --- a/test/insert4.test +++ b/test/insert4.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the INSERT transfer optimization. # -# $Id: insert4.test,v 1.7 2007/09/12 17:01:45 danielk1977 Exp $ +# $Id: insert4.test,v 1.8 2007/10/09 08:29:32 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -234,15 +234,20 @@ xfer_check insert4-3.22 1 {1 9} \ # Ticket #2291. # -do_test insert4-4.1 { - execsql { - CREATE TABLE t4(a, b, UNIQUE(a,b)); - INSERT INTO t4 VALUES(NULL,0); - INSERT INTO t4 VALUES(NULL,1); - INSERT INTO t4 VALUES(NULL,1); - VACUUM; - } + +do_test insert4-4.1a { + execsql {CREATE TABLE t4(a, b, UNIQUE(a,b))} } {} +ifcapable vacuum { + do_test insert4-4.1b { + execsql { + INSERT INTO t4 VALUES(NULL,0); + INSERT INTO t4 VALUES(NULL,1); + INSERT INTO t4 VALUES(NULL,1); + VACUUM; + } + } {} +} # Check some error conditions: # diff --git a/test/io.test b/test/io.test index 74fb0e8999..398a76538d 100644 --- a/test/io.test +++ b/test/io.test @@ -13,7 +13,7 @@ # IO traffic generated by SQLite (making sure SQLite is not writing out # more database pages than it has to, stuff like that). # -# $Id: io.test,v 1.11 2007/10/03 21:18:20 drh Exp $ +# $Id: io.test,v 1.12 2007/10/09 08:29:32 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -229,36 +229,38 @@ do_test io-2.6.4 { # use the same technique to check that it is created as in the above # block. file delete -force test2.db test2.db-journal -do_test io-2.7.1 { - execsql { - ATTACH 'test2.db' AS aux; - PRAGMA aux.page_size = 1024; - CREATE TABLE aux.abc2(a, b); - BEGIN; - INSERT INTO abc VALUES(9, 10); - } - file exists test.db-journal -} {0} -do_test io-2.7.2 { - execsql { INSERT INTO abc2 SELECT * FROM abc } - file exists test2.db-journal -} {0} -do_test io-2.7.3 { - execsql { SELECT * FROM abc UNION ALL SELECT * FROM abc2 } -} {1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10} -do_test io-2.7.4 { - set fd [open test2.db-journal w] - puts $fd "This is not a journal file" - close $fd - catchsql { COMMIT } -} {1 {unable to open database file}} -do_test io-2.7.5 { - file delete -force test2.db-journal - catchsql { COMMIT } -} {1 {cannot commit - no transaction is active}} -do_test io-2.7.6 { - execsql { SELECT * FROM abc UNION ALL SELECT * FROM abc2 } -} {1 2 3 4 5 6 7 8} +ifcapable attach { + do_test io-2.7.1 { + execsql { + ATTACH 'test2.db' AS aux; + PRAGMA aux.page_size = 1024; + CREATE TABLE aux.abc2(a, b); + BEGIN; + INSERT INTO abc VALUES(9, 10); + } + file exists test.db-journal + } {0} + do_test io-2.7.2 { + execsql { INSERT INTO abc2 SELECT * FROM abc } + file exists test2.db-journal + } {0} + do_test io-2.7.3 { + execsql { SELECT * FROM abc UNION ALL SELECT * FROM abc2 } + } {1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10} + do_test io-2.7.4 { + set fd [open test2.db-journal w] + puts $fd "This is not a journal file" + close $fd + catchsql { COMMIT } + } {1 {unable to open database file}} + do_test io-2.7.5 { + file delete -force test2.db-journal + catchsql { COMMIT } + } {1 {cannot commit - no transaction is active}} + do_test io-2.7.6 { + execsql { SELECT * FROM abc UNION ALL SELECT * FROM abc2 } + } {1 2 3 4 5 6 7 8} +} # Try an explicit ROLLBACK before the journal file is created. # diff --git a/test/ioerr.test b/test/ioerr.test index 9fb2668b09..41a04614bb 100644 --- a/test/ioerr.test +++ b/test/ioerr.test @@ -15,7 +15,7 @@ # The tests in this file use special facilities that are only # available in the SQLite test fixture. # -# $Id: ioerr.test,v 1.32 2007/09/01 17:00:13 danielk1977 Exp $ +# $Id: ioerr.test,v 1.33 2007/10/09 08:29:32 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -118,22 +118,24 @@ do_ioerr_test ioerr-4 -tclprep { # # Tests 8 and 17 are excluded when auto-vacuum is enabled for the same # reason as in test cases ioerr-1.XXX -set ex "" -if {[string match [execsql {pragma auto_vacuum}] 1]} { - set ex [list 4 17] +ifcapable attach { + set ex "" + if {[string match [execsql {pragma auto_vacuum}] 1]} { + set ex [list 4 17] + } + do_ioerr_test ioerr-5 -sqlprep { + ATTACH 'test2.db' AS test2; + } -sqlbody { + BEGIN; + CREATE TABLE t1(a,b,c); + CREATE TABLE test2.t2(a,b,c); + COMMIT; + } -exclude $ex } -do_ioerr_test ioerr-5 -sqlprep { - ATTACH 'test2.db' AS test2; -} -sqlbody { - BEGIN; - CREATE TABLE t1(a,b,c); - CREATE TABLE test2.t2(a,b,c); - COMMIT; -} -exclude $ex # Test IO errors when replaying two hot journals from a 2-file # transaction. This test only runs on UNIX. -ifcapable crashtest { +ifcapable crashtest&&attach { if {![catch {sqlite3 -has_codec} r] && !$r} { do_ioerr_test ioerr-6 -tclprep { execsql { diff --git a/test/malloc.test b/test/malloc.test index 379dd46268..e99854f419 100644 --- a/test/malloc.test +++ b/test/malloc.test @@ -16,7 +16,7 @@ # to see what happens in the library if a malloc were to really fail # due to an out-of-memory situation. # -# $Id: malloc.test,v 1.50 2007/10/03 15:02:40 danielk1977 Exp $ +# $Id: malloc.test,v 1.51 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -293,7 +293,7 @@ do_malloc_test 12 -tclbody { # Test malloc errors when replaying two hot journals from a 2-file # transaction. -ifcapable crashtest { +ifcapable crashtest&&attach { do_malloc_test 13 -tclprep { set rc [crashsql -delay 1 -file test2.db { ATTACH 'test2.db' as aux; @@ -477,23 +477,25 @@ unset static_string # Make sure SQLITE_NOMEM is reported out on an ATTACH failure even # when the malloc failure occurs within the nested parse. # -do_malloc_test 20 -tclprep { - db close - file delete -force test2.db test2.db-journal - sqlite3 db test2.db - sqlite3_extended_result_codes db 1 - db eval {CREATE TABLE t1(x);} - db close -} -tclbody { - if {[catch {sqlite3 db test.db}]} { - error "out of memory" - } - sqlite3_extended_result_codes db 1 -} -sqlbody { - ATTACH DATABASE 'test2.db' AS t2; - SELECT * FROM t1; - DETACH DATABASE t2; -} +ifcapable attach { + do_malloc_test 20 -tclprep { + db close + file delete -force test2.db test2.db-journal + sqlite3 db test2.db + sqlite3_extended_result_codes db 1 + db eval {CREATE TABLE t1(x);} + db close + } -tclbody { + if {[catch {sqlite3 db test.db}]} { + error "out of memory" + } + sqlite3_extended_result_codes db 1 + } -sqlbody { + ATTACH DATABASE 'test2.db' AS t2; + SELECT * FROM t1; + DETACH DATABASE t2; + } +} # Test malloc failure whilst installing a foreign key. # diff --git a/test/malloc3.test b/test/malloc3.test index 864a2191b1..9c2c96baa8 100644 --- a/test/malloc3.test +++ b/test/malloc3.test @@ -13,7 +13,7 @@ # correctly. The emphasis of these tests are the _prepare(), _step() and # _finalize() calls. # -# $Id: malloc3.test,v 1.16 2007/10/03 08:46:45 danielk1977 Exp $ +# $Id: malloc3.test,v 1.17 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -462,25 +462,27 @@ TEST 29 { # Test a simple multi-file transaction # file delete -force test2.db -SQL {ATTACH 'test2.db' AS aux;} -SQL {BEGIN} -SQL {CREATE TABLE aux.tbl2(x, y, z)} -SQL {INSERT INTO tbl2 VALUES(1, 2, 3)} -SQL {INSERT INTO def VALUES(4, 5, 6)} -TEST 30 { - do_test $testid { - execsql { - SELECT * FROM tbl2, def WHERE d = x; - } - } {1 2 3 1 2 3} -} -SQL {COMMIT} -TEST 31 { - do_test $testid { - execsql { - SELECT * FROM tbl2, def WHERE d = x; - } - } {1 2 3 1 2 3} +ifcapable attach { + SQL {ATTACH 'test2.db' AS aux;} + SQL {BEGIN} + SQL {CREATE TABLE aux.tbl2(x, y, z)} + SQL {INSERT INTO tbl2 VALUES(1, 2, 3)} + SQL {INSERT INTO def VALUES(4, 5, 6)} + TEST 30 { + do_test $testid { + execsql { + SELECT * FROM tbl2, def WHERE d = x; + } + } {1 2 3 1 2 3} + } + SQL {COMMIT} + TEST 31 { + do_test $testid { + execsql { + SELECT * FROM tbl2, def WHERE d = x; + } + } {1 2 3 1 2 3} + } } # Test what happens when a malloc() fails while there are other active diff --git a/test/mallocD.test b/test/mallocD.test index f816bdc52a..074224b2e4 100644 --- a/test/mallocD.test +++ b/test/mallocD.test @@ -9,7 +9,7 @@ # #*********************************************************************** # -# $Id: mallocD.test,v 1.3 2007/09/03 17:02:50 drh Exp $ +# $Id: mallocD.test,v 1.4 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -48,12 +48,14 @@ do_malloc_test mallocD-3 -sqlprep $PREP -sqlbody { COMMIT; } -do_malloc_test mallocD-4 -sqlprep $PREP -sqlbody { - ATTACH 'test2.db' AS aux; - BEGIN; - CREATE TABLE aux.def(d, e, f); - INSERT INTO abc VALUES(4, 5, 6); - COMMIT; +ifcapable attach { + do_malloc_test mallocD-4 -sqlprep $PREP -sqlbody { + ATTACH 'test2.db' AS aux; + BEGIN; + CREATE TABLE aux.def(d, e, f); + INSERT INTO abc VALUES(4, 5, 6); + COMMIT; + } } sqlite3_simulate_device -char {} diff --git a/test/pragma.test b/test/pragma.test index 501c60820a..fdf5d6cd5d 100644 --- a/test/pragma.test +++ b/test/pragma.test @@ -12,7 +12,7 @@ # # This file implements tests for the PRAGMA command. # -# $Id: pragma.test,v 1.54 2007/05/17 16:38:30 danielk1977 Exp $ +# $Id: pragma.test,v 1.55 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -210,33 +210,33 @@ do_test pragma-1.18 { } {} # Test modifying the safety_level of an attached database. -do_test pragma-2.1 { - file delete -force test2.db - file delete -force test2.db-journal - execsql { - ATTACH 'test2.db' AS aux; - } -} {} -ifcapable pager_pragmas { -do_test pragma-2.2 { - execsql { - pragma aux.synchronous; - } -} {2} -do_test pragma-2.3 { - execsql { - pragma aux.synchronous = OFF; - pragma aux.synchronous; - pragma synchronous; - } -} {0 2} -do_test pragma-2.4 { - execsql { - pragma aux.synchronous = ON; - pragma synchronous; - pragma aux.synchronous; - } -} {2 1} +ifcapable pager_pragmas&&attach { + do_test pragma-2.1 { + file delete -force test2.db + file delete -force test2.db-journal + execsql { + ATTACH 'test2.db' AS aux; + } + } {} + do_test pragma-2.2 { + execsql { + pragma aux.synchronous; + } + } {2} + do_test pragma-2.3 { + execsql { + pragma aux.synchronous = OFF; + pragma aux.synchronous; + pragma synchronous; + } + } {0 2} + do_test pragma-2.4 { + execsql { + pragma aux.synchronous = ON; + pragma synchronous; + pragma aux.synchronous; + } + } {2 1} } ;# ifcapable pager_pragmas # Construct a corrupted index and make sure the integrity_check @@ -259,158 +259,160 @@ do_test pragma-3.1 { SELECT rowid, * from t2; } } {1 11 2 3 2 22 3 4} -if {![sqlite3 -has-codec] && $sqlite_options(integrityck)} { - do_test pragma-3.2 { - set rootpage [execsql {SELECT rootpage FROM sqlite_master WHERE name='i2'}] - set db [btree_open test.db 100 0] - btree_begin_transaction $db - set c [btree_cursor $db $rootpage 1] - btree_first $c - btree_delete $c - btree_commit $db - btree_close $db - execsql {PRAGMA integrity_check} - } {{rowid 1 missing from index i2} {wrong # of entries in index i2}} - do_test pragma-3.3 { - execsql {PRAGMA integrity_check=1} - } {{rowid 1 missing from index i2}} - do_test pragma-3.4 { - execsql { - ATTACH DATABASE 'test.db' AS t2; - PRAGMA integrity_check - } - } {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {wrong # of entries in index i2}} - do_test pragma-3.5 { - execsql { - PRAGMA integrity_check=3 - } - } {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2}} - do_test pragma-3.6 { - execsql { - PRAGMA integrity_check=xyz - } - } {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {wrong # of entries in index i2}} - do_test pragma-3.7 { - execsql { - PRAGMA integrity_check=0 - } - } {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {wrong # of entries in index i2}} - - # Add additional corruption by appending unused pages to the end of - # the database file testerr.db - # - do_test pragma-3.8 { - execsql {DETACH t2} - file delete -force testerr.db testerr.db-journal - set out [open testerr.db w] - fconfigure $out -translation binary - set in [open test.db r] - fconfigure $in -translation binary - puts -nonewline $out [read $in] - seek $in 0 - puts -nonewline $out [read $in] - close $in - close $out - execsql {REINDEX t2} - execsql {PRAGMA integrity_check} - } {ok} - do_test pragma-3.9 { - execsql { - ATTACH 'testerr.db' AS t2; - PRAGMA integrity_check - } - } {{*** in database t2 *** +ifcapable attach { + if {![sqlite3 -has-codec] && $sqlite_options(integrityck)} { + do_test pragma-3.2 { + set rootpage [execsql {SELECT rootpage FROM sqlite_master WHERE name='i2'}] + set db [btree_open test.db 100 0] + btree_begin_transaction $db + set c [btree_cursor $db $rootpage 1] + btree_first $c + btree_delete $c + btree_commit $db + btree_close $db + execsql {PRAGMA integrity_check} + } {{rowid 1 missing from index i2} {wrong # of entries in index i2}} + do_test pragma-3.3 { + execsql {PRAGMA integrity_check=1} + } {{rowid 1 missing from index i2}} + do_test pragma-3.4 { + execsql { + ATTACH DATABASE 'test.db' AS t2; + PRAGMA integrity_check + } + } {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {wrong # of entries in index i2}} + do_test pragma-3.5 { + execsql { + PRAGMA integrity_check=3 + } + } {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2}} + do_test pragma-3.6 { + execsql { + PRAGMA integrity_check=xyz + } + } {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {wrong # of entries in index i2}} + do_test pragma-3.7 { + execsql { + PRAGMA integrity_check=0 + } + } {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {wrong # of entries in index i2}} + + # Add additional corruption by appending unused pages to the end of + # the database file testerr.db + # + do_test pragma-3.8 { + execsql {DETACH t2} + file delete -force testerr.db testerr.db-journal + set out [open testerr.db w] + fconfigure $out -translation binary + set in [open test.db r] + fconfigure $in -translation binary + puts -nonewline $out [read $in] + seek $in 0 + puts -nonewline $out [read $in] + close $in + close $out + execsql {REINDEX t2} + execsql {PRAGMA integrity_check} + } {ok} + do_test pragma-3.9 { + execsql { + ATTACH 'testerr.db' AS t2; + PRAGMA integrity_check + } + } {{*** in database t2 *** Page 4 is never used Page 5 is never used Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2}} - do_test pragma-3.10 { - execsql { - PRAGMA integrity_check=1 - } - } {{*** in database t2 *** + do_test pragma-3.10 { + execsql { + PRAGMA integrity_check=1 + } + } {{*** in database t2 *** Page 4 is never used}} - do_test pragma-3.11 { - execsql { - PRAGMA integrity_check=5 - } - } {{*** in database t2 *** + do_test pragma-3.11 { + execsql { + PRAGMA integrity_check=5 + } + } {{*** in database t2 *** Page 4 is never used Page 5 is never used Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2}} - do_test pragma-3.12 { - execsql { - PRAGMA integrity_check=4 - } - } {{*** in database t2 *** + do_test pragma-3.12 { + execsql { + PRAGMA integrity_check=4 + } + } {{*** in database t2 *** Page 4 is never used Page 5 is never used Page 6 is never used} {rowid 1 missing from index i2}} - do_test pragma-3.13 { - execsql { - PRAGMA integrity_check=3 - } - } {{*** in database t2 *** + do_test pragma-3.13 { + execsql { + PRAGMA integrity_check=3 + } + } {{*** in database t2 *** Page 4 is never used Page 5 is never used Page 6 is never used}} - do_test pragma-3.14 { - execsql { - PRAGMA integrity_check(2) - } - } {{*** in database t2 *** + do_test pragma-3.14 { + execsql { + PRAGMA integrity_check(2) + } + } {{*** in database t2 *** Page 4 is never used Page 5 is never used}} - do_test pragma-3.15 { - execsql { - ATTACH 'testerr.db' AS t3; - PRAGMA integrity_check - } - } {{*** in database t2 *** + do_test pragma-3.15 { + execsql { + ATTACH 'testerr.db' AS t3; + PRAGMA integrity_check + } + } {{*** in database t2 *** Page 4 is never used Page 5 is never used Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2} {*** in database t3 *** Page 4 is never used Page 5 is never used Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2}} - do_test pragma-3.16 { - execsql { - PRAGMA integrity_check(9) - } - } {{*** in database t2 *** + do_test pragma-3.16 { + execsql { + PRAGMA integrity_check(9) + } + } {{*** in database t2 *** Page 4 is never used Page 5 is never used Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2} {*** in database t3 *** Page 4 is never used Page 5 is never used Page 6 is never used} {rowid 1 missing from index i2}} - do_test pragma-3.17 { - execsql { - PRAGMA integrity_check=7 - } - } {{*** in database t2 *** + do_test pragma-3.17 { + execsql { + PRAGMA integrity_check=7 + } + } {{*** in database t2 *** Page 4 is never used Page 5 is never used Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2} {*** in database t3 *** Page 4 is never used Page 5 is never used}} - do_test pragma-3.18 { - execsql { - PRAGMA integrity_check=4 - } - } {{*** in database t2 *** + do_test pragma-3.18 { + execsql { + PRAGMA integrity_check=4 + } + } {{*** in database t2 *** Page 4 is never used Page 5 is never used Page 6 is never used} {rowid 1 missing from index i2}} + } + do_test pragma-3.99 { + catchsql {DETACH t3} + catchsql {DETACH t2} + file delete -force testerr.db testerr.db-journal + catchsql {DROP INDEX i2} + } {0 {}} } -do_test pragma-3.99 { - catchsql {DETACH t3} - catchsql {DETACH t2} - file delete -force testerr.db testerr.db-journal - catchsql {DROP INDEX i2} -} {0 {}} # Test modifying the cache_size of an attached database. -ifcapable pager_pragmas { +ifcapable pager_pragmas&&attach { do_test pragma-4.1 { execsql { ATTACH 'test2.db' AS aux; @@ -481,7 +483,7 @@ catchsql {COMMIT;} # Test schema-query pragmas # ifcapable schema_pragmas { -ifcapable tempdb { +ifcapable tempdb&&attach { do_test pragma-6.1 { set res {} execsql {SELECT * FROM sqlite_temp_master} @@ -647,18 +649,20 @@ do_test pragma-8.1.10 { # Make sure the schema-version can be manipulated in an attached database. file delete -force test2.db file delete -force test2.db-journal -do_test pragma-8.1.11 { - execsql { - ATTACH 'test2.db' AS aux; - CREATE TABLE aux.t1(a, b, c); - PRAGMA aux.schema_version = 205; - } -} {} -do_test pragma-8.1.12 { - execsql { - PRAGMA aux.schema_version; - } -} 205 +ifcapable attach { + do_test pragma-8.1.11 { + execsql { + ATTACH 'test2.db' AS aux; + CREATE TABLE aux.t1(a, b, c); + PRAGMA aux.schema_version = 205; + } + } {} + do_test pragma-8.1.12 { + execsql { + PRAGMA aux.schema_version; + } + } 205 +} do_test pragma-8.1.13 { execsql { PRAGMA schema_version; @@ -667,28 +671,30 @@ do_test pragma-8.1.13 { # And check that modifying the schema-version in an attached database # forces the second connection to reload the schema. -do_test pragma-8.1.14 { - sqlite3 db2 test.db; set ::DB2 [sqlite3_connection_pointer db2] - execsql { - ATTACH 'test2.db' AS aux; - SELECT * FROM aux.t1; - } db2 -} {} -do_test pragma-8.1.15 { - execsql { - PRAGMA aux.schema_version = 206; - } -} {} -do_test pragma-8.1.16 { - set ::STMT [sqlite3_prepare $::DB2 "SELECT * FROM aux.t1" -1 DUMMY] - sqlite3_step $::STMT -} SQLITE_ERROR -do_test pragma-8.1.17 { - sqlite3_finalize $::STMT -} SQLITE_SCHEMA -do_test pragma-8.1.18 { - db2 close -} {} +ifcapable attach { + do_test pragma-8.1.14 { + sqlite3 db2 test.db; set ::DB2 [sqlite3_connection_pointer db2] + execsql { + ATTACH 'test2.db' AS aux; + SELECT * FROM aux.t1; + } db2 + } {} + do_test pragma-8.1.15 { + execsql { + PRAGMA aux.schema_version = 206; + } + } {} + do_test pragma-8.1.16 { + set ::STMT [sqlite3_prepare $::DB2 "SELECT * FROM aux.t1" -1 DUMMY] + sqlite3_step $::STMT + } SQLITE_ERROR + do_test pragma-8.1.17 { + sqlite3_finalize $::STMT + } SQLITE_SCHEMA + do_test pragma-8.1.18 { + db2 close + } {} +} # Now test that the user-version can be read and written (and that we aren't # accidentally manipulating the schema-version instead). @@ -732,61 +738,64 @@ ifcapable vacuum { } } {109} } -db eval {ATTACH 'test2.db' AS aux} -# Check that the user-version in the auxilary database can be manipulated ( -# and that we aren't accidentally manipulating the same in the main db). -do_test pragma-8.2.5 { - execsql { - PRAGMA aux.user_version; - } -} {0} -do_test pragma-8.2.6 { - execsql { - PRAGMA aux.user_version = 3; - } -} {} -do_test pragma-8.2.7 { - execsql { - PRAGMA aux.user_version; - } -} {3} -do_test pragma-8.2.8 { - execsql { - PRAGMA main.user_version; - } -} {2} - -# Now check that a ROLLBACK resets the user-version if it has been modified -# within a transaction. -do_test pragma-8.2.9 { - execsql { - BEGIN; - PRAGMA aux.user_version = 10; - PRAGMA user_version = 11; - } -} {} -do_test pragma-8.2.10 { - execsql { - PRAGMA aux.user_version; - } -} {10} -do_test pragma-8.2.11 { - execsql { - PRAGMA main.user_version; - } -} {11} -do_test pragma-8.2.12 { - execsql { - ROLLBACK; - PRAGMA aux.user_version; - } -} {3} -do_test pragma-8.2.13 { - execsql { - PRAGMA main.user_version; - } -} {2} +ifcapable attach { + db eval {ATTACH 'test2.db' AS aux} + + # Check that the user-version in the auxilary database can be manipulated ( + # and that we aren't accidentally manipulating the same in the main db). + do_test pragma-8.2.5 { + execsql { + PRAGMA aux.user_version; + } + } {0} + do_test pragma-8.2.6 { + execsql { + PRAGMA aux.user_version = 3; + } + } {} + do_test pragma-8.2.7 { + execsql { + PRAGMA aux.user_version; + } + } {3} + do_test pragma-8.2.8 { + execsql { + PRAGMA main.user_version; + } + } {2} + + # Now check that a ROLLBACK resets the user-version if it has been modified + # within a transaction. + do_test pragma-8.2.9 { + execsql { + BEGIN; + PRAGMA aux.user_version = 10; + PRAGMA user_version = 11; + } + } {} + do_test pragma-8.2.10 { + execsql { + PRAGMA aux.user_version; + } + } {10} + do_test pragma-8.2.11 { + execsql { + PRAGMA main.user_version; + } + } {11} + do_test pragma-8.2.12 { + execsql { + ROLLBACK; + PRAGMA aux.user_version; + } + } {3} + do_test pragma-8.2.13 { + execsql { + PRAGMA main.user_version; + } + } {2} +} # Try a negative value for the user-version do_test pragma-8.2.14 { diff --git a/test/pragma2.test b/test/pragma2.test index faf04c0827..87c3c5d04e 100644 --- a/test/pragma2.test +++ b/test/pragma2.test @@ -12,7 +12,7 @@ # # This file implements tests for the PRAGMA command. # -# $Id: pragma2.test,v 1.3 2007/09/12 17:01:45 danielk1977 Exp $ +# $Id: pragma2.test,v 1.4 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -64,54 +64,56 @@ do_test pragma2-1.4 { file delete -force test2.db file delete -force test2.db-journal -do_test pragma2-2.1 { - execsql { - ATTACH 'test2.db' AS aux; - PRAGMA aux.auto_vacuum=OFF; - PRAGMA aux.freelist_count; - } -} {0} -do_test pragma2-2.2 { - execsql { - CREATE TABLE aux.abc(a, b, c); - PRAGMA aux.freelist_count; - } -} {0} -do_test pragma2-2.3 { - set ::val [string repeat 0123456789 1000] - execsql { - INSERT INTO aux.abc VALUES(1, 2, $::val); - PRAGMA aux.freelist_count; - } -} {0} -do_test pragma2-2.4 { - expr {[file size test2.db] / 1024} -} {11} -do_test pragma2-2.5 { - execsql { - DELETE FROM aux.abc; - PRAGMA aux.freelist_count; - } -} {9} - -do_test pragma2-3.1 { - execsql { - PRAGMA aux.freelist_count; - PRAGMA main.freelist_count; - PRAGMA freelist_count; - } -} {9 1 1} -do_test pragma2-3.2 { - execsql { - PRAGMA freelist_count = 500; - PRAGMA freelist_count; - } -} {1 1} -do_test pragma2-3.3 { - execsql { - PRAGMA aux.freelist_count = 500; - PRAGMA aux.freelist_count; - } -} {9 9} +ifcapable attach { + do_test pragma2-2.1 { + execsql { + ATTACH 'test2.db' AS aux; + PRAGMA aux.auto_vacuum=OFF; + PRAGMA aux.freelist_count; + } + } {0} + do_test pragma2-2.2 { + execsql { + CREATE TABLE aux.abc(a, b, c); + PRAGMA aux.freelist_count; + } + } {0} + do_test pragma2-2.3 { + set ::val [string repeat 0123456789 1000] + execsql { + INSERT INTO aux.abc VALUES(1, 2, $::val); + PRAGMA aux.freelist_count; + } + } {0} + do_test pragma2-2.4 { + expr {[file size test2.db] / 1024} + } {11} + do_test pragma2-2.5 { + execsql { + DELETE FROM aux.abc; + PRAGMA aux.freelist_count; + } + } {9} + + do_test pragma2-3.1 { + execsql { + PRAGMA aux.freelist_count; + PRAGMA main.freelist_count; + PRAGMA freelist_count; + } + } {9 1 1} + do_test pragma2-3.2 { + execsql { + PRAGMA freelist_count = 500; + PRAGMA freelist_count; + } + } {1 1} + do_test pragma2-3.3 { + execsql { + PRAGMA aux.freelist_count = 500; + PRAGMA aux.freelist_count; + } + } {9 9} +} finish_test diff --git a/test/schema.test b/test/schema.test index 7adda55cb8..25779a1f81 100644 --- a/test/schema.test +++ b/test/schema.test @@ -13,7 +13,7 @@ # This file tests the various conditions under which an SQLITE_SCHEMA # error should be returned. # -# $Id: schema.test,v 1.7 2007/08/13 15:28:35 danielk1977 Exp $ +# $Id: schema.test,v 1.8 2007/10/09 08:29:33 danielk1977 Exp $ #--------------------------------------------------------------------- # When any of the following types of SQL statements or actions are @@ -141,26 +141,28 @@ do_test schema-4.4 { # Tests 5.1 to 5.4 check that prepared statements are invalidated when # a database is DETACHed (but not when one is ATTACHed). # -do_test schema-5.1 { - set sql {SELECT * FROM abc;} - set ::STMT [sqlite3_prepare $::DB $sql -1 TAIL] - execsql { - ATTACH 'test2.db' AS aux; - } - sqlite3_step $::STMT -} {SQLITE_DONE} -do_test schema-5.2 { - sqlite3_reset $::STMT -} {SQLITE_OK} -do_test schema-5.3 { - execsql { - DETACH aux; - } - sqlite3_step $::STMT -} {SQLITE_ERROR} -do_test schema-5.4 { - sqlite3_finalize $::STMT -} {SQLITE_SCHEMA} +ifcapable attach { + do_test schema-5.1 { + set sql {SELECT * FROM abc;} + set ::STMT [sqlite3_prepare $::DB $sql -1 TAIL] + execsql { + ATTACH 'test2.db' AS aux; + } + sqlite3_step $::STMT + } {SQLITE_DONE} + do_test schema-5.2 { + sqlite3_reset $::STMT + } {SQLITE_OK} + do_test schema-5.3 { + execsql { + DETACH aux; + } + sqlite3_step $::STMT + } {SQLITE_ERROR} + do_test schema-5.4 { + sqlite3_finalize $::STMT + } {SQLITE_SCHEMA} +} #--------------------------------------------------------------------- # Tests 6.* check that prepared statements are invalidated when diff --git a/test/schema2.test b/test/schema2.test index 593c80d6f1..63e58a0a03 100644 --- a/test/schema2.test +++ b/test/schema2.test @@ -14,7 +14,7 @@ # error should be returned. This is a copy of schema.test that # has been altered to use sqlite3_prepare_v2 instead of sqlite3_prepare # -# $Id: schema2.test,v 1.2 2007/05/02 17:54:56 drh Exp $ +# $Id: schema2.test,v 1.3 2007/10/09 08:29:33 danielk1977 Exp $ #--------------------------------------------------------------------- # When any of the following types of SQL statements or actions are @@ -142,26 +142,28 @@ do_test schema2-4.4 { # Tests 5.1 to 5.4 check that prepared statements are invalidated when # a database is DETACHed (but not when one is ATTACHed). # -do_test schema2-5.1 { - set sql {SELECT * FROM abc;} - set ::STMT [sqlite3_prepare_v2 $::DB $sql -1 TAIL] - execsql { - ATTACH 'test2.db' AS aux; - } - sqlite3_step $::STMT -} {SQLITE_DONE} -do_test schema2-5.2 { - sqlite3_reset $::STMT -} {SQLITE_OK} -do_test schema2-5.3 { - execsql { - DETACH aux; - } - sqlite3_step $::STMT -} {SQLITE_DONE} -do_test schema2-5.4 { - sqlite3_finalize $::STMT -} {SQLITE_OK} +ifcapable attach { + do_test schema2-5.1 { + set sql {SELECT * FROM abc;} + set ::STMT [sqlite3_prepare_v2 $::DB $sql -1 TAIL] + execsql { + ATTACH 'test2.db' AS aux; + } + sqlite3_step $::STMT + } {SQLITE_DONE} + do_test schema2-5.2 { + sqlite3_reset $::STMT + } {SQLITE_OK} + do_test schema2-5.3 { + execsql { + DETACH aux; + } + sqlite3_step $::STMT + } {SQLITE_DONE} + do_test schema2-5.4 { + sqlite3_finalize $::STMT + } {SQLITE_OK} +} #--------------------------------------------------------------------- # Tests 6.* check that prepared statements are invalidated when diff --git a/test/shared.test b/test/shared.test index a69774f888..3d949bb754 100644 --- a/test/shared.test +++ b/test/shared.test @@ -9,13 +9,15 @@ # #*********************************************************************** # -# $Id: shared.test,v 1.27 2007/09/12 17:01:45 danielk1977 Exp $ +# $Id: shared.test,v 1.28 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl db close -ifcapable !shared_cache { +# These tests cannot be run without the ATTACH command. +# +ifcapable !shared_cache||!attach { finish_test return } diff --git a/test/speed3.test b/test/speed3.test index b43cfaabe4..db0d2a9156 100644 --- a/test/speed3.test +++ b/test/speed3.test @@ -12,7 +12,7 @@ # focus of this script is testing that the overflow-page related # enhancements added after version 3.3.17 speed things up. # -# $Id: speed3.test,v 1.4 2007/09/12 17:01:45 danielk1977 Exp $ +# $Id: speed3.test,v 1.5 2007/10/09 08:29:33 danielk1977 Exp $ # #--------------------------------------------------------------------- @@ -35,7 +35,7 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl -ifcapable !tclvar { +ifcapable !tclvar||!attach { finish_test return } diff --git a/test/sqllimits1.test b/test/sqllimits1.test index 6641e08edd..81e10c8959 100644 --- a/test/sqllimits1.test +++ b/test/sqllimits1.test @@ -12,7 +12,7 @@ # This file contains tests to verify that the limits defined in # sqlite source file limits.h are enforced. # -# $Id: sqllimits1.test,v 1.18 2007/09/06 23:39:37 drh Exp $ +# $Id: sqllimits1.test,v 1.19 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -440,23 +440,24 @@ do_test sqllimits-1.7.2 { #-------------------------------------------------------------------- # Test cases sqllimits-8.*: Test the SQLITE_MAX_ATTACHED limit. # -# TODO -do_test sqllimits-1.8.1 { - set max $::SQLITE_MAX_ATTACHED - for {set i 0} {$i < ($max)} {incr i} { - file delete -force test${i}.db test${i}.db-journal - } - for {set i 0} {$i < ($max)} {incr i} { - execsql "ATTACH 'test${i}.db' AS aux${i}" - } - catchsql "ATTACH 'test${i}.db' AS aux${i}" -} "1 {too many attached databases - max $::SQLITE_MAX_ATTACHED}" -do_test sqllimits-1.8.2 { - set max $::SQLITE_MAX_ATTACHED - for {set i 0} {$i < ($max)} {incr i} { - execsql "DETACH aux${i}" - } -} {} +ifcapable attach { + do_test sqllimits-1.8.1 { + set max $::SQLITE_MAX_ATTACHED + for {set i 0} {$i < ($max)} {incr i} { + file delete -force test${i}.db test${i}.db-journal + } + for {set i 0} {$i < ($max)} {incr i} { + execsql "ATTACH 'test${i}.db' AS aux${i}" + } + catchsql "ATTACH 'test${i}.db' AS aux${i}" + } "1 {too many attached databases - max $::SQLITE_MAX_ATTACHED}" + do_test sqllimits-1.8.2 { + set max $::SQLITE_MAX_ATTACHED + for {set i 0} {$i < ($max)} {incr i} { + execsql "DETACH aux${i}" + } + } {} +} #-------------------------------------------------------------------- # Test cases sqllimits-9.*: Check that the SQLITE_MAX_VARIABLE_NUMBER diff --git a/test/sync.test b/test/sync.test index 88a1b7d02d..98aa7731e7 100644 --- a/test/sync.test +++ b/test/sync.test @@ -13,20 +13,21 @@ # This file implements tests to verify that fsync is disabled when # pragma synchronous=off even for multi-database commits. # -# $Id: sync.test,v 1.5 2006/02/11 01:25:51 drh Exp $ +# $Id: sync.test,v 1.6 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # # These tests are only applicable on unix when pager pragma are -# enabled. +# enabled. Also, since every test uses an ATTACHed database, they +# are only run when ATTACH is enabled. # if {$::tcl_platform(platform)!="unix"} { finish_test return } -ifcapable !pager_pragmas { +ifcapable !pager_pragmas||!attach { finish_test return } diff --git a/test/table.test b/test/table.test index 718f1715e5..02fc9095e7 100644 --- a/test/table.test +++ b/test/table.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the CREATE TABLE statement. # -# $Id: table.test,v 1.47 2007/05/02 17:54:56 drh Exp $ +# $Id: table.test,v 1.48 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -612,7 +612,7 @@ do_test table-14.1 { } {0 {}} # Try to drop a table from within a callback: -do_test table-14.3 { +do_test table-14.2 { set rc [ catch { db eval {SELECT * FROM tablet8 LIMIT 1} {} { @@ -623,33 +623,35 @@ do_test table-14.3 { set result [list $rc $msg] } {1 {database table is locked}} -# Now attach a database and ensure that a table can be created in the -# attached database whilst in a callback from a query on the main database. -do_test table-14.4 { - file delete -force test2.db - file delete -force test2.db-journal - execsql { - attach 'test2.db' as aux; - } - db eval {SELECT * FROM tablet8 LIMIT 1} {} { - db eval {CREATE TABLE aux.t1(a, b, c)} - } -} {} - -# On the other hand, it should be impossible to drop a table when any VMs -# are active. This is because VerifyCookie instructions may have already -# been executed, and btree root-pages may not move after this (which a -# delete table might do). -do_test table-14.4 { - set rc [ - catch { - db eval {SELECT * FROM tablet8 LIMIT 1} {} { - db eval {DROP TABLE aux.t1;} - } - } msg - ] - set result [list $rc $msg] -} {1 {database table is locked}} +ifcapable attach { + # Now attach a database and ensure that a table can be created in the + # attached database whilst in a callback from a query on the main database. + do_test table-14.3 { + file delete -force test2.db + file delete -force test2.db-journal + execsql { + ATTACH 'test2.db' as aux; + } + db eval {SELECT * FROM tablet8 LIMIT 1} {} { + db eval {CREATE TABLE aux.t1(a, b, c)} + } + } {} + + # On the other hand, it should be impossible to drop a table when any VMs + # are active. This is because VerifyCookie instructions may have already + # been executed, and btree root-pages may not move after this (which a + # delete table might do). + do_test table-14.4 { + set rc [ + catch { + db eval {SELECT * FROM tablet8 LIMIT 1} {} { + db eval {DROP TABLE aux.t1;} + } + } msg + ] + set result [list $rc $msg] + } {1 {database table is locked}} +} # Create and drop 2000 tables. This is to check that the balance_shallow() # routine works correctly on the sqlite_master table. At one point it diff --git a/test/temptable.test b/test/temptable.test index d1d0b86277..5fc40c4db0 100644 --- a/test/temptable.test +++ b/test/temptable.test @@ -12,7 +12,7 @@ # # This file implements tests for temporary tables and indices. # -# $Id: temptable.test,v 1.18 2007/10/05 15:53:29 danielk1977 Exp $ +# $Id: temptable.test,v 1.19 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -404,12 +404,14 @@ do_test temptable-6.8 { } {1 {no such table: t9}} file delete -force test2.db test2.db-journal -do_test temptable-7.1 { - catchsql { - ATTACH 'test2.db' AS two; - CREATE TEMP TABLE two.abc(x,y); - } -} {1 {temporary table name must be unqualified}} +ifcapable attach { + do_test temptable-7.1 { + catchsql { + ATTACH 'test2.db' AS two; + CREATE TEMP TABLE two.abc(x,y); + } + } {1 {temporary table name must be unqualified}} +} # Need to do the following for tcl 8.5 on mac. On that configuration, the # -readonly flag is taken so seriously that a subsequent [file delete -force] diff --git a/test/thread002.test b/test/thread002.test index 94141be040..5b84518ea2 100644 --- a/test/thread002.test +++ b/test/thread002.test @@ -12,13 +12,18 @@ # This test attempts to deadlock SQLite in shared-cache mode. # # -# $Id: thread002.test,v 1.1 2007/09/10 10:53:02 danielk1977 Exp $ +# $Id: thread002.test,v 1.2 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl source $testdir/thread_common.tcl if {[info commands sqlthread] eq ""} { + finish_test + return +} +ifcapable !attach { + finish_test return } diff --git a/test/tkt1873.test b/test/tkt1873.test index 0eca230568..85a52832dd 100644 --- a/test/tkt1873.test +++ b/test/tkt1873.test @@ -14,11 +14,16 @@ # fixed. # # -# $Id: tkt1873.test,v 1.1 2006/06/27 16:34:58 danielk1977 Exp $ +# $Id: tkt1873.test,v 1.2 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl +ifcapable !attach { + finish_test + return +} + file delete -force test2.db test2.db-journal do_test tkt1873-1.1 { diff --git a/test/trigger1.test b/test/trigger1.test index c1cb755821..c4e330a6d0 100644 --- a/test/trigger1.test +++ b/test/trigger1.test @@ -532,7 +532,7 @@ ifcapable conflict { # Also verify that references within trigger programs are resolved at # statement compile time, not trigger installation time. This means, for # example, that you can drop and re-create tables referenced by triggers. -ifcapable tempdb { +ifcapable tempdb&&attach { do_test trigger1-10.0 { file delete -force test2.db file delete -force test2.db-journal diff --git a/test/view.test b/test/view.test index 83ffec2567..3f58f30792 100644 --- a/test/view.test +++ b/test/view.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing VIEW statements. # -# $Id: view.test,v 1.33 2006/09/11 23:45:50 drh Exp $ +# $Id: view.test,v 1.34 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -450,14 +450,16 @@ do_test view-12.1 { } } {1 {parameters are not allowed in views}} -do_test view-13.1 { - file delete -force test2.db - catchsql { - ATTACH 'test2.db' AS two; - CREATE TABLE two.t2(x,y); - CREATE VIEW v13 AS SELECT y FROM two.t2; - } -} {1 {view v13 cannot reference objects in database two}} +ifcapable attach { + do_test view-13.1 { + file delete -force test2.db + catchsql { + ATTACH 'test2.db' AS two; + CREATE TABLE two.t2(x,y); + CREATE VIEW v13 AS SELECT y FROM two.t2; + } + } {1 {view v13 cannot reference objects in database two}} +} # Ticket #1658 # diff --git a/test/vtab1.test b/test/vtab1.test index b86ca4aa41..e24b6cbb6f 100644 --- a/test/vtab1.test +++ b/test/vtab1.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is creating and dropping virtual tables. # -# $Id: vtab1.test,v 1.46 2007/09/03 15:03:21 danielk1977 Exp $ +# $Id: vtab1.test,v 1.47 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -762,20 +762,24 @@ do_test vtab1.7-13 { } } {} -do_test vtab1.8-1 { - set echo_module "" - execsql { - ATTACH 'test2.db' AS aux; - CREATE VIRTUAL TABLE aux.e2 USING echo(real_abc); - } - set echo_module -} [list xCreate echo aux e2 real_abc \ - xSync echo(real_abc) \ - xCommit echo(real_abc) \ -] +ifcapable attach { + do_test vtab1.8-1 { + set echo_module "" + execsql { + ATTACH 'test2.db' AS aux; + CREATE VIRTUAL TABLE aux.e2 USING echo(real_abc); + } + set echo_module + } [list xCreate echo aux e2 real_abc \ + xSync echo(real_abc) \ + xCommit echo(real_abc) \ + ] +} do_test vtab1.8-2 { - execsql { + catchsql { DROP TABLE aux.e2; + } + execsql { DROP TABLE treal; DROP TABLE techo; DROP TABLE echo_abc; diff --git a/test/vtab7.test b/test/vtab7.test index 5aeb66cd16..69864a928b 100644 --- a/test/vtab7.test +++ b/test/vtab7.test @@ -12,7 +12,7 @@ # of this test is reading and writing to the database from within a # virtual table xSync() callback. # -# $Id: vtab7.test,v 1.2 2006/07/26 16:22:16 danielk1977 Exp $ +# $Id: vtab7.test,v 1.3 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -125,21 +125,23 @@ do_test vtab7-2.6 { } {abc abc2 log} # Write to an attached database from xSync(). -do_test vtab7-3.1 { - file delete -force test2.db - file delete -force test2.db-journal - execsql { - ATTACH 'test2.db' AS db2; - CREATE TABLE db2.stuff(description, shape, color); - } - set ::callbacks(xSync,abc) { - execsql { INSERT INTO db2.stuff VALUES('abc', 'square', 'green'); } - } - execsql { - INSERT INTO abc2 VALUES(1, 2, 3); - SELECT * from stuff; - } -} {abc square green} +ifcapable attach { + do_test vtab7-3.1 { + file delete -force test2.db + file delete -force test2.db-journal + execsql { + ATTACH 'test2.db' AS db2; + CREATE TABLE db2.stuff(description, shape, color); + } + set ::callbacks(xSync,abc) { + execsql { INSERT INTO db2.stuff VALUES('abc', 'square', 'green'); } + } + execsql { + INSERT INTO abc2 VALUES(1, 2, 3); + SELECT * from stuff; + } + } {abc square green} +} # UPDATE: The next test passes, but leaks memory. So leave it out. #