From: dan Date: Wed, 27 Mar 2013 19:53:55 +0000 (+0000) Subject: Modify various test cases so that they work if the file is extended in units of the... X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=38360da27fa36d579c7bdc7f5c69c3124b887b40;p=thirdparty%2Fsqlite.git Modify various test cases so that they work if the file is extended in units of the system page-size. FossilOrigin-Name: 0e3d5119273fd8e3512b3aa4272a873847e7ca40 --- diff --git a/manifest b/manifest index 462355c5d2..1f2e6a4c84 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sos_unix.c\sto\suse\seither\sone\sor\stwo\smappings\sinternally. -D 2013-03-26T20:32:39.622 +C Modify\svarious\stest\scases\sso\sthat\sthey\swork\sif\sthe\sfile\sis\sextended\sin\sunits\sof\sthe\ssystem\spage-size. +D 2013-03-27T19:53:55.881 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in df3e48659d80e1b7765785d8d66c86b320f72cc7 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -160,7 +160,7 @@ F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30 F src/os.c 809d0707cec693e1b9b376ab229271ad74c3d35d F src/os.h ae08bcc5f6ec6b339f4a2adf3931bb88cc14c3e4 F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 -F src/os_unix.c d37ec5f108f1369d15099ca3583d4e305226cac5 +F src/os_unix.c 3894d0620bfdc1bb00edbfd9ad773141ec0369ee F src/os_win.c e4f17ddf79f2a9373e33ed70565e765d65324589 F src/pager.c 30009ae5800f80e21da1f118fabfc72b34d8c722 F src/pager.h 5cb78b8e1adfd5451e600be7719f5a99d87ac3b1 @@ -249,7 +249,7 @@ F src/vdbemem.c 833005f1cbbf447289f1973dba2a0c2228c7b8ab F src/vdbesort.c 4fad64071ae120c25f39dcac572d716b9cadeb7f F src/vdbetrace.c 8bd5da325fc90f28464335e4cc4ad1407fe30835 F src/vtab.c b05e5f1f4902461ba9f5fc49bb7eb7c3a0741a83 -F src/wal.c e84eff498c57ec2d79ca4496a3f4a638af378fb3 +F src/wal.c 04029f2691e937d7f5dd638580679a560fec93bf F src/wal.h a4d3da523d55a226a0b28e9058ef88d0a8051887 F src/walker.c 3d75ba73de15e0f8cd0737643badbeb0e002f07b F src/where.c 9a16c0b84bbeb054d11fda96e9e037ae310bd54e @@ -286,13 +286,13 @@ F test/auth2.test a2a371aa6df15f8b0c8109b33d3d7f0f73e4c9aa F test/auth3.test a4755e6a2a2fea547ffe63c874eb569e60a28eb5 F test/autoinc.test bd30d372d00045252f6c2e41b5f41455e1975acf F test/autoindex1.test f88146c4c889ea0afbb620e49d83b5fbf5ee4d06 -F test/autovacuum.test 9f22a7733f39c56ef6a5665d10145ac25d8cb574 +F test/autovacuum.test ad9f74649caf108dbb9208aa0bcbdd22eed51ad0 F test/autovacuum_ioerr2.test 8a367b224183ad801e0e24dcb7d1501f45f244b4 F test/avtrans.test 0252654f4295ddda3b2cce0e894812259e655a85 F test/backcompat.test ecd841f3a3bfb81518721879cc56a760670e3198 -F test/backup.test c9cdd23a495864b9edf75a9fa66f5cb7e10fcf62 +F test/backup.test 66a716403ec014d763910d1de20c8dab5f17527e F test/backup2.test 34986ef926ea522911a51dfdb2f8e99b7b75ebcf -F test/backup4.test 4d90389daeb781fe718816a4fc836ad1b06791d8 +F test/backup4.test 20a100140fea819d383920de02efe64b981d2414 F test/backup_ioerr.test 4c3c7147cee85b024ecf6e150e090c32fdbb5135 F test/backup_malloc.test 7162d604ec2b4683c4b3799a48657fb8b5e2d450 F test/badutf.test d5360fc31f643d37a973ab0d8b4fb85799c3169f @@ -339,12 +339,12 @@ F test/colmeta.test 087c42997754b8c648819832241daf724f813322 F test/colname.test 08948a4809d22817e0e5de89c7c0a8bd90cb551b F test/conflict.test 0b3922d2304a14a47e3ccd61bbd6824327af659b F test/corrupt.test 4aabd06cff3fe759e3e658bcc17b71789710665e -F test/corrupt2.test 9c0ab4becd50e9050bc1ebb8675456a4e5587bf0 -F test/corrupt3.test 889d7cdb811800303aa722d7813fe8a4299cf726 +F test/corrupt2.test 7db8c262e76115745c7c1607374c4de34f92f4d3 +F test/corrupt3.test 77c3da3229f32843fdc5d89599b49e49ce901850 F test/corrupt4.test b963f9e01e0f92d15c76fb0747876fd4b96dc30a F test/corrupt5.test c23da7bfb20917cc7fdbb13ee25c7cc4e9fffeff -F test/corrupt6.test 4e4161aef1f30b9f34582bb4142334b7f47eacae -F test/corrupt7.test a90caf89c7d7cb7893ea4d92529bd0c129317ee4 +F test/corrupt6.test 4d509a36a237f4826a79ddb22ac966b7d0d05cc7 +F test/corrupt7.test ff767cdf4ceb019d113c654ab21e41a4bd51f1de F test/corrupt8.test 48eb37ffb9a03bceada62219e2bd4c92f4b0cb75 F test/corrupt9.test 959179e68dc0b7b99f424cf3e0381c86dcdd0112 F test/corruptA.test fafa652aa585753be4f6b62ff0bb250266eaf7ce @@ -352,7 +352,7 @@ F test/corruptB.test 20d4a20cbed23958888c3e8995b424a47223d647 F test/corruptC.test 62a767fe64acb1975f58cc6171192839c783edbb F test/corruptD.test 3b09903a2e2fe07ecafe775fea94177f8a4bb34f F test/corruptE.test d3a3d7e864a95978195741744dda4abfd8286018 -F test/corruptF.test 984b1706c9c0e4248141b056c21124612628d12e +F test/corruptF.test e8c366f5784105e57284d99c88b2e8dcfd87a01f F test/count.test 454e1ce985c94d13efeac405ce54439f49336163 F test/coveridxscan.test cdb47d01acc4a634a34fd25abe85189e0d0f1e62 F test/crash.test fb9dc4a02dcba30d4aa5c2c226f98b220b2b959f @@ -364,12 +364,12 @@ F test/crash6.test 4c56f1e40d0291e1110790a99807aa875b1647ba F test/crash7.test 1a194c4900a255258cf94b7fcbfd29536db572df F test/crash8.test 38767cb504bbe491de6be4a7006b154973a2309f F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2 -F test/createtab.test b5de160630b209c4b8925bdcbbaf48cc90b67fe8 +F test/createtab.test 45e9710fac5140be87f64f0c3eff960f37bfe212 F test/cse.test 277350a26264495e86b1785f34d2d0c8600e021c F test/ctime.test 7bd009071e242aac4f18521581536b652b789a47 F test/date.test f3228180c87bbe5d39c9397bf001c0095c3821b9 F test/dbstatus.test 207e5b63fcb7b9c3bb8e1fdf38ebd4654ad0e54b -F test/dbstatus2.test f329941d5f4a8bc0ba6ec5735897ef0cf34e2f5f +F test/dbstatus2.test f46fdca3ffa01eb7d662f6dafb45d8bd2709dc0d F test/default.test 6faf23ccb300114924353007795aa9a8ec0aa9dc F test/delete.test a065b05d2ebf60fd16639c579a4adfb7c381c701 F test/delete2.test 3a03f2cca1f9a67ec469915cb8babd6485db43fa @@ -394,7 +394,7 @@ F test/e_select.test d5af998a402740d8f0488158d22075df2b6f88fa F test/e_select2.test 5c3d3da19c7b3e90ae444579db2b70098599ab92 F test/e_update.test 161d5dc6a3ed9dd08f5264d13e20735d7a89f00c F test/e_uri.test 8f2f56b29456a3f846276fa4e0993d4ef8a15b79 -F test/e_vacuum.test 331da289ae186656cf5f2eb27f577a89c0c221af +F test/e_vacuum.test 617227d2cad5bf829197a00968d9788ffc1bcbd2 F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea F test/enc2.test 83437a79ba1545a55fb549309175c683fb334473 F test/enc3.test 90683ad0e6ea587b9d5542ca93568af9a9858c40 @@ -409,14 +409,14 @@ F test/exists.test 8f7b27b61c2fbe5822f0a1f899c715d14e416e30 F test/expr.test 67c9fd6f8f829e239dc8b0f4a08a73c08b09196d F test/fallocate.test b5d34437bd7ab01d41b1464b8117aefd4d32160e F test/filectrl.test 14fa712e42c4cb791e09dfd58a6a03efb47ef13a -F test/filefmt.test dbee33e57818249cdffbbb7b13464635217beff1 +F test/filefmt.test dcd6eae426b64cc398d95c786ad7e8763b8c2982 F test/fkey1.test 01c7de578e11747e720c2d9aeef27f239853c4da F test/fkey2.test 06e0b4cc9e1b3271ae2ae6feeb19755468432111 F test/fkey3.test 5ec899d12b13bcf1e9ef40eff7fb692fdb91392e F test/fkey4.test 86446017011273aad8f9a99c1a65019e7bd9ca9d F test/fkey5.test 0bf64f2d19ad80433ca0b24edbf604a18b353d5f F test/fkey_malloc.test bb74c9cb8f8fceed03b58f8a7ef2df98520bbd51 -F test/format4.test 1f0cac8ff3895e9359ed87e41aaabee982a812eb +F test/format4.test c7600a7c96388b8e19af5c7fe18399953cb748c3 F test/fts-9fd058691.test 78b887e30ae6816df0e1fed6259de4b5a64ad33c F test/fts1a.test 46090311f85da51bb33bd5ce84f7948359c6d8d7 F test/fts1b.test 5d8a01aefbecc8b7442b36c94c05eb7a845462d5 @@ -526,13 +526,13 @@ F test/in2.test 5d4c61d17493c832f7d2d32bef785119e87bde75 F test/in3.test 3cbf58c87f4052cee3a58b37b6389777505aa0c0 F test/in4.test 64f3cc1acde1b9161ccdd8e5bde3daefdb5b2617 F test/in5.test 99f9a40af01711b06d2d614ecfe96129f334fba3 -F test/incrblob.test 2100cb8964e4a106e5ca9bf80e2c5c3e8be33f77 +F test/incrblob.test 983a3c15f674892e502627662289f9d969209600 F test/incrblob2.test edc3a96e557bd61fb39acc8d2edd43371fbbaa19 F test/incrblob3.test aedbb35ea1b6450c33b98f2b6ed98e5020be8dc7 F test/incrblob4.test 09be37d3dd996a31ea6993bba7837ece549414a8 F test/incrblob_err.test d2562d2771ebffd4b3af89ef64c140dd44371597 F test/incrblobfault.test 917c0292224c64a56ef7215fd633a3a82f805be0 -F test/incrvacuum.test d2a6ddf5e429720b5fe502766af747915ccf6c32 +F test/incrvacuum.test cfd733917fdcc06b8d4218145112167e89cc60ad F test/incrvacuum2.test 379eeb8740b0ef60c372c439ad4cbea20b34bb9b F test/incrvacuum3.test 2ffa9e4a23f072bd7902b9ae6471f8822a6522a7 F test/incrvacuum_ioerr.test 6ae2f783424e47a0033304808fe27789cf93e635 @@ -553,7 +553,7 @@ F test/instr.test a34e1d46a9eefb098a7167ef0e730a4a3d82fba0 F test/intarray.test 066b7d7ac38d25bf96f87f1b017bfc687551cdd4 F test/interrupt.test dfe9a67a94b0b2d8f70545ba1a6cca10780d71cc F test/intpkey.test 7af30f6ae852d8d1c2b70e4bf1551946742e92d8 -F test/io.test a4be25a446a99a0604ceecc039ee7363c56e4185 +F test/io.test 1d3862c25017cf01ef6d0db682bc7ca87ab43387 F test/ioerr.test 40bb2cfcab63fb6aa7424cd97812a84bc16b5fb8 F test/ioerr2.test 9d71166f8466eda510f1af6137bdabaa82b5408d F test/ioerr3.test d3cec5e1a11ad6d27527d0d38573fbff14c71bdd @@ -569,7 +569,7 @@ F test/join6.test cfe6503791ceb0cbb509966740286ec423cbf10b F test/journal1.test 69abc726c51b4a0409189f9a85191205297c0577 F test/journal2.test ae06f566c28552c313ded3fee79a6c69e6d049b1 F test/journal3.test ff8af941f9e06161d3db1b46bb9f965ff0e7f307 -F test/jrnlmode.test 9ee3a78f53d52cca737db69293d15dc41c0cbd36 +F test/jrnlmode.test 06a8d5771bb6ed9b8754e171519e7fc9f025db55 F test/jrnlmode2.test 81610545a4e6ed239ea8fa661891893385e23a1d F test/jrnlmode3.test 556b447a05be0e0963f4311e95ab1632b11c9eaa F test/keyword1.test a2400977a2e4fde43bf33754c2929fda34dbca05 @@ -583,7 +583,7 @@ F test/loadext2.test 0bcaeb4d81cd5b6e883fdfea3c1bdbe1f173cbca F test/lock.test 87af515b0c4cf928576d0f89946d67d7c265dfb4 F test/lock2.test 5242d8ac4e2d59c403aebff606af449b455aceff F test/lock3.test f271375930711ae044080f4fe6d6eda930870d00 -F test/lock4.test e175ae13865bc87680607563bafba21f31a26f12 +F test/lock4.test 8c191b10540128fb28cfd4194aeb9e61e1db007f F test/lock5.test 5ad6a1f536036ff1be915cfdd41481aeafda3273 F test/lock6.test ad5b387a3a8096afd3c68a55b9535056431b0cf5 F test/lock7.test 64006c84c1c616657e237c7ad6532b765611cf64 @@ -648,25 +648,25 @@ F test/orderby1.test f33968647da5c546528fe4d2bf86c6a6a2e5a7ae F test/orderby2.test bc11009f7cd99d96b1b11e57b199b00633eb5b04 F test/orderby3.test 8619d06a3debdcd80a27c0fdea5c40b468854b99 F test/oserror.test 50417780d0e0d7cd23cf12a8277bb44024765df3 -F test/pager1.test 31c04bec797dda1bde337810b52efa08d1f1f08e +F test/pager1.test aa819efb5c58cef7afd0504849f3ab27eaa926a3 F test/pager2.test 745b911dde3d1f24ae0870bd433dfa83d7c658c1 F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f F test/pagerfault.test 452f2cc23e3bfcfa935f4442aec1da4fe1dc0442 F test/pagerfault2.test 1f79ea40d1133b2683a2f811b00f2399f7ec2401 F test/pagerfault3.test f16e2efcb5fc9996d1356f7cbc44c998318ae1d7 F test/pageropt.test 32cb5a6ed7ccddf8e8c842cb44240bd9340223ce -F test/pagesize.test 1dd51367e752e742f58e861e65ed7390603827a0 +F test/pagesize.test a8890ca1b19a5a25b1f0d8f6982bbdeb2ae045b5 F test/pcache.test 065aa286e722ab24f2e51792c1f093bf60656b16 F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025 F test/permutations.test b6cb45ce4d3193b831231025c9d30c77317dd240 -F test/pragma.test 60d29cd3d8098a2c20bf4c072810f99e3bf2757a -F test/pragma2.test 3a55f82b954242c642f8342b17dffc8b47472947 +F test/pragma.test ffcad56b3058c8661a4cf54205ce44894f7263e2 +F test/pragma2.test dcb2dafab8b16268017879c84b5bf99034d40284 F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552 F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301 F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc F test/quick.test 1681febc928d686362d50057c642f77a02c62e57 F test/quota-glob.test 32901e9eed6705d68ca3faee2a06b73b57cb3c26 -F test/quota.test b5b3eec55a059e0fe493c66c6e27bd2c07676cfd +F test/quota.test cff65b46e98c65f10e853f2610748470ba3f50ff F test/quota2.test 6d2bd57e8a4da28817f46db9da18551211cd325f F test/quote.test 215897dbe8de1a6f701265836d6601cc6ed103e6 F test/randexpr1.tcl 40dec52119ed3a2b8b2a773bce24b63a3a746459 @@ -755,7 +755,7 @@ F test/tclsqlite.test 37a61c2da7e3bfe3b8c1a2867199f6b860df5d43 F test/tempdb.test 19d0f66e2e3eeffd68661a11c83ba5e6ace9128c F test/temptable.test d2c9b87a54147161bcd1822e30c1d1cd891e5b30 F test/temptrigger.test 26670ed7a39cf2296a7f0a9e0a1d7bdb7abe936d -F test/tester.tcl 0d95028653ad6782e17400b7a32a046b87c67a48 +F test/tester.tcl e96eee651b5cea4c3a1b6f504b218e1da95c6980 F test/thread001.test 9f22fd3525a307ff42a326b6bc7b0465be1745a5 F test/thread002.test e630504f8a06c00bf8bbe68528774dd96aeb2e58 F test/thread003.test ee4c9efc3b86a6a2767516a37bd64251272560a7 @@ -819,7 +819,7 @@ F test/tkt1444.test a9d72f9e942708bd82dde6c707da61c489e213e9 F test/tkt1449.test 93584a449752d52b07d2cfc280a69842b6e16ed5 F test/tkt1473.test 9d000af3e11a4450d4c596f5e58b4b0d24eb0f8b F test/tkt1501.test 2064f98e00871848af4b2f517e46c1a7fb2e32db -F test/tkt1512.test a1df1f66caf0b9122d6220c15dcee230298c2c2f +F test/tkt1512.test f791cd2a32b739e866e74613b20e9d096a7f3312 F test/tkt1514.test ddef38e34fea72eb1ab935ded9f17a3fb71dd9df F test/tkt1536.test 83ff7a7b6e248016f8d682d4f7a4ae114070d466 F test/tkt1537.test e3a14332de9770be8ff14bd15c19a49cbec10808 @@ -847,7 +847,7 @@ F test/tkt2820.test 39940276b3436d125deb7d8ebeee053e4cf13213 F test/tkt2822.test f391776423a7c0d0949edfce375708bfb0f3141e F test/tkt2832.test a9b0b74a02dca166a04d9e37739c414b10929caa F test/tkt2854.test e432965db29e27e16f539b2ba7f502eb2ccc49af -F test/tkt2920.test a8737380e4ae6424e00c0273dc12775704efbebf +F test/tkt2920.test ff4e3d02cca0786188bf717068815ebbbfa0e056 F test/tkt2927.test 4752868b9eeeb07a217f7f19f4cbaac98d6d086d F test/tkt2942.test c5c87d179799ca6d1fbe83c815510b87cd5ec7ce F test/tkt3080.test 1bca7579260920a66b4dd7e196e807c0f25ff804 @@ -951,25 +951,25 @@ F test/vtabF.test fd5ad376f5a34fe0891df1f3cddb4fe7c3eb077e F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5 F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8 F test/vtab_shared.test 82f463886e18d7f8395a4b6167c91815efe54839 -F test/wal.test bbd98ac09d8fbcaa80ec233757056eb1bbb7cd95 +F test/wal.test 0fe084a9fce3ec8e5196b3bfe3a5c2be337e7cac F test/wal2.test d4b470f13c87f6d8268b004380afa04c3c67cb90 F test/wal3.test b22eb662bcbc148c5f6d956eaf94b047f7afe9c0 F test/wal4.test 4744e155cd6299c6bd99d3eab1c82f77db9cdb3c -F test/wal5.test f4d0aee6a2cf09e326ed2459011d396b4fdf661a +F test/wal5.test 62fcd89a2007ca0cf91a874a2aa78546b0ce588e F test/wal6.test 2e3bc767d9c2ce35c47106148d43fcbd072a93b3 F test/wal7.test 2ae8f427d240099cc4b2dfef63cff44e2a68a1bd F test/wal8.test b3ee739fe8f7586aaebdc2367f477ebcf3e3b034 -F test/wal9.test 378e76a9ad09cd9bee06c172ad3547b0129a6750 +F test/wal9.test 400b87e93ab39cbc606f5cbf96f575f08c4ed92b F test/wal_common.tcl a98f17fba96206122eff624db0ab13ec377be4fe -F test/walbak.test b9f68e39646375c2b877be906babcc15d38b4877 +F test/walbak.test a0f59461081e396f521159671ad3ebd6b6a10ade F test/walbig.test f437473a16cfb314867c6b5d1dbcd519e73e3434 -F test/walcksum.test f5447800a157c9e2234fbb8e80243f0813941bde +F test/walcksum.test 40563d1d9dd3a946833ea122db4db5a6f37e0e1d F test/walcrash.test 4457436593be8c136f9148487c7dccd5e9013af2 F test/walcrash2.test 019d60b89d96c1937adb2b30b850ac7e86e5a142 F test/walcrash3.test 595e44c6197f0d0aa509fc135be2fd0209d11a2c F test/walfault.test 97394d8de82a99f7abf1c12ed229640607fd0ad2 -F test/walhook.test ed00a40ba7255da22d6b66433ab61fab16a63483 -F test/walmode.test 4022fe03ae6e830583672caa101f046438a0473c +F test/walhook.test ac9f04264f9e1807dec17dd74901bc9d331f9aff +F test/walmode.test 781becf1162c9fd161a8a49417e2a911a94dbb41 F test/walnoshm.test 84ca10c544632a756467336b7c3b864d493ee496 F test/walpersist.test 8c6b7e3ec1ba91b5e4dc4e0921d6d3f87cd356a6 F test/walro.test a31deb621033442a76c3a61e44929250d06f81b1 @@ -1040,10 +1040,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac -P 30c0a69363931a72d1c34e5be71646932398d172 -R a15bf82112549bf1a0784cca5aff9715 -T *branch * two-mappings -T *sym-two-mappings * -T -sym-experimental-mmap * +P e7698cba9bcffbfadd30d9319669add4d60fcc65 +R d25a34a1ec81e5ce1633847acb69238a U dan -Z 02c6777536dbe19d12e003e11a2e535e +Z 396bda74f7a9986ff7f7f3b4d6a84b50 diff --git a/manifest.uuid b/manifest.uuid index 029d1cc9b6..a701f4f3a7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e7698cba9bcffbfadd30d9319669add4d60fcc65 \ No newline at end of file +0e3d5119273fd8e3512b3aa4272a873847e7ca40 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 65891c38d2..9dca45e15c 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -321,8 +321,12 @@ struct unixFile { #define threadid 0 #endif +#if !defined(HAVE_MREMAP) #if defined(__linux__) && defined(_GNU_SOURCE) -# define HAVE_MREMAP +# define HAVE_MREMAP 1 +#else +# define HAVE_MREMAP 0 +#endif #endif /* @@ -462,7 +466,7 @@ static struct unix_syscall { { "munmap", (sqlite3_syscall_ptr)munmap, 0 }, #define osMunmap ((void*(*)(void*,size_t))aSyscall[22].pCurrent) -#if defined(HAVE_MREMAP) +#if HAVE_MREMAP { "mremap", (sqlite3_syscall_ptr)mremap, 0 }, #else { "mremap", (sqlite3_syscall_ptr)0, 0 }, @@ -4602,15 +4606,15 @@ static int unixMapfile(unixFile *pFd, i64 nByte){ void *pNew = 0; /* If the request is for a mapping zero bytes in size, or there are - ** currently already two mapping regions, or there is already a mapping - ** region that is not a multiple of the page-size in size, unmap - ** everything. */ + ** currently already two mapping regions, or there is already a mapping + ** region that is not a multiple of the page-size in size, unmap + ** everything. */ if( nMap==0 -#ifndef HAVE_MREMAP - || (pFd->aMmap[0].pMapRegion && pFd->aMmap[1].pMapRegion) - || (pFd->aMmap[0].mmapSize % pFd->szSyspage) +#if !HAVE_MREMAP + || (pFd->aMmap[0].pMapRegion && pFd->aMmap[1].pMapRegion) + || (pFd->aMmap[0].mmapSize % pFd->szSyspage) #endif - ){ + ){ unixUnmapfile(pFd); } assert( pFd->aMmap[1].pMapRegion==0 ); @@ -4629,7 +4633,7 @@ static int unixMapfile(unixFile *pFd, i64 nByte){ pFd->aMmap[0].mmapSize = nMap; pFd->aMmap[0].mmapOrigsize = nMap; } -#ifdef HAVE_MREMAP +#if HAVE_MREMAP /* If we have an mremap() call, resize the existing mapping. */ else{ unixMapping *pMap = &pFd->aMmap[0]; diff --git a/src/wal.c b/src/wal.c index 4602eb2c34..abbd7032f5 100644 --- a/src/wal.c +++ b/src/wal.c @@ -1208,7 +1208,7 @@ finished: */ if( pWal->hdr.nPage ){ sqlite3_log(SQLITE_OK, "Recovered %d frames from WAL file %s", - pWal->hdr.nPage, pWal->zWalName + pWal->hdr.mxFrame, pWal->zWalName ); } } diff --git a/test/autovacuum.test b/test/autovacuum.test index bba40e3013..b6946a9227 100644 --- a/test/autovacuum.test +++ b/test/autovacuum.test @@ -32,7 +32,7 @@ proc make_str {char len} { # Return the number of pages in the file test.db by looking at the file system. proc file_pages {} { - return [expr [file size test.db] / 1024] + file_page_count test.db } #------------------------------------------------------------------------- @@ -614,7 +614,7 @@ do_test autovacuum-7.1 { INSERT INTO t1 SELECT randstr(400,400), randstr(400,400) FROM t1; -- 32 } - expr {[file size test.db] / 1024} + file_page_count test.db } {73} do_test autovacuum-7.2 { @@ -628,7 +628,7 @@ do_test autovacuum-7.2 { CREATE TABLE t5(a, b, PRIMARY KEY(a, b)); INSERT INTO t5 SELECT randstr(400,400), randstr(400,400) FROM t1; -- 2 } - expr {[file size test.db] / 1024} + file_page_count test.db } {354} do_test autovacuum-7.3 { @@ -640,7 +640,7 @@ do_test autovacuum-7.3 { COMMIT; SELECT count(*) FROM t1; } - expr {[file size test.db] / 1024} + file_page_count test.db } {286} #------------------------------------------------------------------------ diff --git a/test/backup.test b/test/backup.test index 444619c68c..dee17edb33 100644 --- a/test/backup.test +++ b/test/backup.test @@ -661,7 +661,7 @@ do_test backup-6.1 { } } {} do_test backup-6.2 { - set nTotal [expr {[file size test.db]/1024}] + set nTotal [file_page_count test.db] sqlite3_backup B db2 main db main B step 1 } {SQLITE_OK} diff --git a/test/backup4.test b/test/backup4.test index a1a7735528..428272b0c5 100644 --- a/test/backup4.test +++ b/test/backup4.test @@ -63,7 +63,7 @@ do_execsql_test 2.1 { CREATE TABLE t1(a, b); CREATE INDEX i1 ON t1(a, b); } -do_test 2.2 { file size test.db } [expr $AUTOVACUUM ? 4096 : 3072] +do_test 2.2 { file_page_count test.db } [expr $AUTOVACUUM ? 4 : 3] do_test 2.3 { sqlite3 db1 test.db2 diff --git a/test/corrupt2.test b/test/corrupt2.test index 744a76ed04..0dae24fe49 100644 --- a/test/corrupt2.test +++ b/test/corrupt2.test @@ -334,7 +334,7 @@ ifcapable autovacuum { INSERT INTO t1 VALUES(3, randomblob(2500)); DELETE FROM t1 WHERE a = 1; } -corrupt { - set nPage [expr [file size corrupt.db] / 1024] + set nPage [file_page_count corrupt.db] hexio_write corrupt.db [expr 1024 + ($nPage-3)*5] 010000000 } -test { do_test corrupt2-6.3 { diff --git a/test/corrupt3.test b/test/corrupt3.test index a3827227b7..1f9d3bb963 100644 --- a/test/corrupt3.test +++ b/test/corrupt3.test @@ -40,8 +40,8 @@ do_test corrupt3-1.1 { CREATE TABLE t1(x); INSERT INTO t1 VALUES($bigstring); } - file size test.db -} [expr {1024*3}] + list [file_page_count test.db] [file_page_size test.db] +} {3 1024} # Verify that the file format is as we expect. The page size # should be 1024 bytes. The only record should have a single diff --git a/test/corrupt6.test b/test/corrupt6.test index c0dcedf3d9..6cd4d7290b 100644 --- a/test/corrupt6.test +++ b/test/corrupt6.test @@ -41,8 +41,8 @@ do_test corrupt6-1.1 { INSERT INTO t1(x) VALUES('varint32-01234567890123456789012345678901234567890123456789'); INSERT INTO t1(x) VALUES('varint32-01234567890123456789012345678901234567890123456789'); } - file size test.db -} [expr {1024*2}] + file_page_count test.db +} {2} # Verify that the file format is as we expect. The page size # should be 1024 bytes. diff --git a/test/corrupt7.test b/test/corrupt7.test index ad566560f7..7d87c8e5b2 100644 --- a/test/corrupt7.test +++ b/test/corrupt7.test @@ -44,8 +44,8 @@ do_test corrupt7-1.1 { INSERT INTO t1(x) SELECT x+4 FROM t1; INSERT INTO t1(x) SELECT x+8 FROM t1; } - file size test.db -} [expr {1024*2}] + file_page_count test.db +} {2} # Verify that the file format is as we expect. The page size # should be 1024 bytes. diff --git a/test/corruptF.test b/test/corruptF.test index 33eef39bdd..a6e4253391 100644 --- a/test/corruptF.test +++ b/test/corruptF.test @@ -56,7 +56,7 @@ do_test 1.1 { create_test_db } {} # Check the db is as we expect. 6 pages in total, with 3 and 4 on the free # list. Page 3 is the free list trunk and page 4 is a leaf. # -do_test 1.2 { file size test.db } [expr 6*1024] +do_test 1.2 { file_page_count test.db } 6 do_test 1.3 { hexio_read test.db 32 4 } 00000003 do_test 1.4 { hexio_read test.db [expr 2*1024] 12 } 000000000000000100000004 @@ -109,7 +109,7 @@ for {set i 0} {$i < 128} {incr i} { } do_test 2.1 { create_test_db } {} -do_test 2.2 { file size test.db } [expr 6*1024] +do_test 2.2 { file_page_count test.db } 6 do_test 2.3 { hexio_read test.db 32 4 } 00000003 do_test 2.4 { hexio_read test.db [expr 2*1024] 12 } 000000000000000100000004 diff --git a/test/createtab.test b/test/createtab.test index 01e0b6122e..10e8c7b187 100644 --- a/test/createtab.test +++ b/test/createtab.test @@ -52,8 +52,8 @@ for {set av 0} {$av<=$upperBound} {incr av} { } do_test createtab-$av.2 { - file size test.db - } [expr {1024*(4+($av!=0)+(${isUtf16}*2))}] + file_page_count test.db + } [expr {4+($av!=0)+(${isUtf16}*2)}] # Start reading the table # diff --git a/test/dbstatus2.test b/test/dbstatus2.test index c2d9164fa2..b97cdbae4a 100644 --- a/test/dbstatus2.test +++ b/test/dbstatus2.test @@ -20,6 +20,7 @@ set ::testprefix dbstatus2 do_execsql_test 1.0 { PRAGMA page_size = 1024; PRAGMA auto_vacuum = 0; + PRAGMA mmap_limit = 0; CREATE TABLE t1(a PRIMARY KEY, b); INSERT INTO t1 VALUES(1, randomblob(600)); diff --git a/test/e_vacuum.test b/test/e_vacuum.test index bad12d3c4d..bff3d57da0 100644 --- a/test/e_vacuum.test +++ b/test/e_vacuum.test @@ -42,7 +42,7 @@ proc create_db {{sql ""}} { } } - return [expr {[file size test.db] / 1024}] + return [file_page_count test.db] } # This proc returns the number of contiguous blocks of pages that make up diff --git a/test/filefmt.test b/test/filefmt.test index bc1af18e8b..7c71dae556 100644 --- a/test/filefmt.test +++ b/test/filefmt.test @@ -65,6 +65,7 @@ ifcapable pager_pragmas { db close forcedelete test.db sqlite3 db test.db + db eval "PRAGMA mmap_limit=0" db eval "PRAGMA auto_vacuum=OFF" db eval "PRAGMA page_size=$pagesize" db eval {CREATE TABLE t1(x)} @@ -215,6 +216,7 @@ do_execsql_test filefmt-3.3 { reset_db do_execsql_test filefmt-4.1 { + PRAGMA mmap_limit = 0; PRAGMA auto_vacuum = 1; CREATE TABLE t1(x, y); CREATE TABLE t2(x, y); diff --git a/test/format4.test b/test/format4.test index 14d794709b..b4d4d2b6ec 100644 --- a/test/format4.test +++ b/test/format4.test @@ -46,19 +46,19 @@ do_test format4-1.1 { INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT * FROM t1; } - file size test.db + expr {1024 * [file_page_count test.db]} } $small do_test format4-1.2 { execsql { UPDATE t1 SET x0=1, x1=1, x2=1, x3=1, x4=1, x5=1, x6=1, x7=1, x8=1, x9=1 } - file size test.db + expr {1024 * [file_page_count test.db]} } $small do_test format4-1.3 { execsql { UPDATE t1 SET x0=2, x1=2, x2=2, x3=2, x4=2, x5=2, x6=2, x7=2, x8=2, x9=2 } - file size test.db + expr {1024 * [file_page_count test.db]} } $large diff --git a/test/incrblob.test b/test/incrblob.test index fa564de0cf..0c4d39a3b9 100644 --- a/test/incrblob.test +++ b/test/incrblob.test @@ -619,7 +619,7 @@ do_test incrblob-7.3.1 { read $::b } $::otherdata do_test incrblob-7.3.2 { - expr [file size test.db]/1024 + file_page_count test.db } 30 do_test incrblob-7.3.3 { execsql { diff --git a/test/incrvacuum.test b/test/incrvacuum.test index 91f5c8e1e0..1e5812a5ef 100644 --- a/test/incrvacuum.test +++ b/test/incrvacuum.test @@ -149,21 +149,21 @@ do_test incrvacuum-3.2 { # 4 -> table tbl2 # 5 -> table tbl2 overflow page. # - expr {[file size test.db] / 1024} + file_page_count test.db } {5} do_test incrvacuum-3.3 { execsql { DROP TABLE abc; DELETE FROM tbl2; } - expr {[file size test.db] / 1024} + file_page_count test.db } {5} do_test incrvacuum-3.4 { execsql { PRAGMA auto_vacuum = 1; INSERT INTO tbl2 VALUES('hello world'); } - expr {[file size test.db] / 1024} + file_page_count test.db } {3} #--------------------------------------------------------------------- @@ -178,14 +178,14 @@ do_test incrvacuum-4.1 { INSERT INTO tbl2 VALUES($::str); CREATE TABLE tbl1(a, b, c); } - expr {[file size test.db] / 1024} + file_page_count test.db } {5} do_test incrvacuum-4.2 { execsql { DELETE FROM tbl2; DROP TABLE tbl1; } - expr {[file size test.db] / 1024} + file_page_count test.db } {5} do_test incrvacuum-4.3 { set ::nStep 0 @@ -221,7 +221,7 @@ do_test incrvacuum-5.2.1 { PRAGMA incremental_vacuum; -- this is a no-op. COMMIT; } - expr {[file size test.db] / 1024} + file_page_count test.db } {4} do_test incrvacuum-5.2.2 { set ::str [string repeat abcdefghij 110] @@ -232,7 +232,7 @@ do_test incrvacuum-5.2.2 { DELETE FROM tbl1 WHERE oid%2; -- Put 2 overflow pages on free-list. COMMIT; } - expr {[file size test.db] / 1024} + file_page_count test.db } {7} do_test incrvacuum-5.2.3 { execsql { @@ -242,7 +242,7 @@ do_test incrvacuum-5.2.3 { INSERT INTO tbl2 VALUES('a nice string'); COMMIT; } - expr {[file size test.db] / 1024} + file_page_count test.db } {6} do_test incrvacuum-5.2.4 { execsql { @@ -255,7 +255,7 @@ do_test incrvacuum-5.2.5 { DROP TABLE tbl2; PRAGMA incremental_vacuum; } - expr {[file size test.db] / 1024} + file_page_count test.db } {1} @@ -527,7 +527,7 @@ do_test incrvacuum-10.1 { DROP TABLE t1; DROP TABLE t2; } - expr [file size test.db] / 1024 + file_page_count test.db } {29} do_test incrvacuum-10.2 { diff --git a/test/io.test b/test/io.test index bf4d157275..92cc91cb76 100644 --- a/test/io.test +++ b/test/io.test @@ -418,8 +418,8 @@ ifcapable pager_pragmas { do_test io-3.3 { # The COMMIT requires a single fsync() - to the database file. execsql { COMMIT } - list [file size test.db] [nSync] - } {39936 1} + list [file_page_count test.db] [nSync] + } {39 1} } #---------------------------------------------------------------------- @@ -488,7 +488,7 @@ do_test io-4.3.1 { INSERT INTO abc SELECT * FROM abc; INSERT INTO abc SELECT * FROM abc; } - expr {[file size test.db]/1024} + file_page_count test.db } {43} ifcapable pager_pragmas { do_test io-4.3.2 { @@ -562,7 +562,9 @@ foreach {char sectorsize pgsize} { CREATE TABLE abc(a, b, c); } expr {[file size test.db]/2} - } $pgsize + + list [file_page_count test.db] [file_page_size test.db] + } [list 2 $pgsize] } sqlite3_simulate_device -char {} -sectorsize 0 diff --git a/test/jrnlmode.test b/test/jrnlmode.test index b1007c4908..4fb0404b49 100644 --- a/test/jrnlmode.test +++ b/test/jrnlmode.test @@ -521,7 +521,9 @@ ifcapable pragma { PRAGMA user_version; } } {memory 5} - do_test jrnlmode-7.2 { file size test.db } {1024} + do_test jrnlmode-7.2 { + list [file_page_count test.db] [file_page_size test.db] + } {1 1024} } do_execsql_test jrnlmode-8.1 { PRAGMA locking_mode=EXCLUSIVE } {exclusive} diff --git a/test/lock4.test b/test/lock4.test index b0b1c74fbe..14eb5ab3f9 100644 --- a/test/lock4.test +++ b/test/lock4.test @@ -33,8 +33,8 @@ do_test lock4-1.1 { CREATE TABLE t2(x) } db2 close - list [file size test.db] [file size test2.db] -} {2048 2048} + list [file_page_count test.db] [file_page_count test2.db] +} {2 2} # Create a script to drive a separate process that will # diff --git a/test/pager1.test b/test/pager1.test index ae47b3d932..a91951fafb 100644 --- a/test/pager1.test +++ b/test/pager1.test @@ -1109,6 +1109,7 @@ do_test pager1-5.5.2 { do_test pager1-6.1 { faultsim_delete_and_reopen execsql { + PRAGMA page_size = 4096; PRAGMA auto_vacuum = none; PRAGMA max_page_count = 10; CREATE TABLE t2(a, b); @@ -1357,8 +1358,8 @@ do_test pager1-9.3.3 { db2 close db close tv delete - file size test.db2 -} [file size test.db] + file_page_count test.db2 +} [file_page_count test.db] do_test pager1-9.4.1 { faultsim_delete_and_reopen @@ -1471,8 +1472,8 @@ do_test pager1.10.x.2 { CREATE TABLE t2(x); DROP TABLE t2; } - file size test.db -} {33792} + list [file_page_count test.db] [file_page_size test.db] +} {33 1024} do_test pager1.10.x.3 { execsql { BEGIN; @@ -1552,7 +1553,7 @@ foreach pagesize { PRAGMA page_size = $pagesize; CREATE VIEW v AS SELECT * FROM sqlite_master; " db2 - file size test.db + file_page_size test.db } $eff do_test pager1-12.$pagesize.2 { sqlite3 db2 test.db @@ -2388,15 +2389,15 @@ do_test pager1-29.1 { CREATE TABLE t1(a, b); INSERT INTO t1 VALUES(1, 2); } - file size test.db -} [expr 1024*3] + list [file_page_count test.db] [file_page_size test.db] +} {3 1024} do_test pager1-29.2 { execsql { PRAGMA page_size = 4096; VACUUM; } - file size test.db -} [expr 4096*3] + list [file_page_count test.db] [file_page_size test.db] +} {3 4096} #------------------------------------------------------------------------- # Test that if an empty database file (size 0 bytes) is opened in diff --git a/test/pagesize.test b/test/pagesize.test index 0eebbbb7c9..f495ab9bc9 100644 --- a/test/pagesize.test +++ b/test/pagesize.test @@ -115,8 +115,8 @@ foreach PGSZ {512 2048 4096 8192} { } } $PGSZ do_test pagesize-2.$PGSZ.3 { - file size test.db - } [expr {$PGSZ*($AUTOVACUUM?3:2)}] + list [file_page_count test.db] [file_page_size test.db] + } [list [expr ($AUTOVACUUM?3:2)] $PGSZ] ifcapable {vacuum} { do_test pagesize-2.$PGSZ.4 { execsql {VACUUM} diff --git a/test/pragma.test b/test/pragma.test index 3eb624328e..474eaf97b7 100644 --- a/test/pragma.test +++ b/test/pragma.test @@ -262,6 +262,7 @@ do_test pragma-3.1 { forcedelete test.db test.db-journal sqlite3 db test.db execsql { + PRAGMA mmap_limit=0; PRAGMA auto_vacuum=OFF; BEGIN; CREATE TABLE t2(a,b,c); @@ -284,6 +285,7 @@ ifcapable attach { hexio_write test.db $offset 0a00000000040000000000 db close sqlite3 db test.db + execsql {PRAGMA mmap_limit=0} execsql {PRAGMA integrity_check} } {{rowid 1 missing from index i2} {rowid 2 missing from index i2} {wrong # of entries in index i2}} do_test pragma-3.3 { @@ -1251,8 +1253,8 @@ ifcapable pager_pragmas { do_test pragma-14.4 { set page_size [db one {pragma page_size}] - expr [file size test.db] / $page_size - } {2} + list [file_page_count test.db] $page_size + } [list 2 [file_page_size test.db]] do_test pragma-14.5 { execsql { diff --git a/test/pragma2.test b/test/pragma2.test index 1111a984b4..01290f5019 100644 --- a/test/pragma2.test +++ b/test/pragma2.test @@ -86,8 +86,8 @@ ifcapable attach { } } {0} do_test pragma2-2.4 { - expr {[file size test2.db] / 1024} - } {11} + list [file_page_count test2.db] [file_page_size test2.db] + } {11 1024} do_test pragma2-2.5 { execsql { DELETE FROM aux.abc; diff --git a/test/quota.test b/test/quota.test index 816dec8b8f..2db7b6d1cc 100644 --- a/test/quota.test +++ b/test/quota.test @@ -71,6 +71,7 @@ do_test quota-2.1.1 { do_test quota-2.1.2 { sqlite3 db test.db execsql { + PRAGMA mmap_limit=0; PRAGMA page_size=1024; PRAGMA auto_vacuum=OFF; PRAGMA journal_mode=DELETE; @@ -143,6 +144,7 @@ do_test quota-3.1.1 { do_test quota-3.1.2 { sqlite3 db test.db execsql { + PRAGMA mmap_limit = 0; PRAGMA page_size = 1024; PRAGMA journal_mode = delete; PRAGMA auto_vacuum = off; @@ -154,6 +156,7 @@ do_test quota-3.1.2 { do_test quota-3.1.3 { sqlite3 db2 test.db set ::quota [list] + execsql { PRAGMA mmap_limit=0 } db2 execsql { CREATE TABLE t2(a, b) } db2 set ::quota } {} @@ -179,6 +182,7 @@ do_test quota-3.2.1 { foreach db {db1a db2a} { execsql { + PRAGMA mmap_limit=0; PRAGMA page_size = 1024; PRAGMA journal_mode = delete; PRAGMA auto_vacuum = off; diff --git a/test/tester.tcl b/test/tester.tcl index d6468f7b14..ba1cfd7f32 100644 --- a/test/tester.tcl +++ b/test/tester.tcl @@ -1636,6 +1636,7 @@ proc sql36231 {sql} { set B [hexio_read test.db 92 8] set A [hexio_read test.db 28 4] sqlite3 db36231 test.db + db36231 eval { PRAGMA mmap_limit = 0 } catch { db36231 func a_string a_string } execsql $sql db36231 db36231 close @@ -1674,6 +1675,23 @@ proc db_delete_and_reopen {{file test.db}} { sqlite3 db $file } +# Return the number of pages in the database file $zFile, according to +# the database header. +# +proc file_page_count {zFile} { + set nPg [hexio_get_int [hexio_read $zFile 28 4]] + return $nPg +} + +# Return the page size of database file $zFile, according to the database +# header. +# +proc file_page_size {zFile} { + set pgsz [hexio_get_int [hexio_read $zFile 16 2]] + if {$pgsz==1} {set pgsz 65536} + return $pgsz +} + # If the library is compiled with the SQLITE_DEFAULT_AUTOVACUUM macro set # to non-zero, then set the global variable $AUTOVACUUM to 1. set AUTOVACUUM $sqlite_options(default_autovacuum) diff --git a/test/tkt1512.test b/test/tkt1512.test index a2c39dbe48..6c6e7e0abf 100644 --- a/test/tkt1512.test +++ b/test/tkt1512.test @@ -35,20 +35,20 @@ do_test tkt1512-1.1 { } } {1 2 3 4} do_test tkt1512-1.2 { - file size test.db -} {2048} + file_page_count test.db +} {2} do_test tkt1512-1.3 { execsql { DROP TABLE t1; } - file size test.db -} {2048} + file_page_count test.db +} {2} do_test tkt1512-1.4 { execsql { VACUUM; } - file size test.db -} {1024} + file_page_count test.db +} {1} finish_test diff --git a/test/tkt2920.test b/test/tkt2920.test index d76c05bab9..c711fbf5c5 100644 --- a/test/tkt2920.test +++ b/test/tkt2920.test @@ -26,8 +26,8 @@ do_test tkt2920-1.1 { PRAGMA auto_vacuum=0; CREATE TABLE filler (fill); } - file size test.db -} {2048} + list [file_page_count test.db] [file_page_size test.db] +} {2 1024} do_test tkt2920-1.2 { db eval BEGIN for {set i 0} {$i<34} {incr i} { diff --git a/test/wal.test b/test/wal.test index 0539192d25..0b502d04f8 100644 --- a/test/wal.test +++ b/test/wal.test @@ -67,8 +67,8 @@ do_test wal-0.1 { execsql { PRAGMA journal_mode = wal } } {wal} do_test wal-0.2 { - file size test.db -} {1024} + file_page_count test.db +} {1} do_test wal-1.0 { execsql { @@ -77,8 +77,8 @@ do_test wal-1.0 { } list [file exists test.db-journal] \ [file exists test.db-wal] \ - [file size test.db] -} {0 1 1024} + [file_page_count test.db] +} {0 1 1} do_test wal-1.1 { execsql COMMIT list [file exists test.db-journal] [file exists test.db-wal] @@ -347,8 +347,8 @@ foreach sector {512 4096} { INSERT INTO t1 VALUES(1, 2); " db close - file size test.db - } [expr $pgsz*2] + list [file_page_count test.db] [file_page_size test.db] + } [list 2 $pgsz] do_test wal-6.$sector.$pgsz.2 { log_deleted test.db-wal @@ -364,12 +364,16 @@ do_test wal-7.1 { CREATE TABLE t1(a, b); INSERT INTO t1 VALUES(1, 2); } - list [file size test.db] [file size test.db-wal] -} [list 1024 [wal_file_size 3 1024]] + list [file_page_count test.db] \ + [file_page_size test.db] \ + [file size test.db-wal] +} [list 1 1024 [wal_file_size 3 1024]] do_test wal-7.2 { execsql { PRAGMA wal_checkpoint } - list [file size test.db] [file size test.db-wal] -} [list 2048 [wal_file_size 3 1024]] + list [file_page_count test.db] \ + [file_page_size test.db] \ + [file size test.db-wal] +} [list 2 1024 [wal_file_size 3 1024]] # Execute some transactions in auto-vacuum mode to test database file # truncation. @@ -428,8 +432,8 @@ do_test wal-9.1 { INSERT INTO t1 SELECT blob(900) FROM t1; /* 128 */ INSERT INTO t1 SELECT blob(900) FROM t1; /* 256 */ } - file size test.db -} 1024 + file_page_count test.db +} 1 do_test wal-9.2 { sqlite3_wal db2 test.db execsql {PRAGMA integrity_check } db2 @@ -681,15 +685,15 @@ do_test wal-11.1 { PRAGMA page_size = 1024; CREATE TABLE t1(x PRIMARY KEY); } - list [expr [file size test.db]/1024] [expr [file size test.db-wal]/1044] + list [file_page_count test.db] [expr [file size test.db-wal]/1044] } {1 3} do_test wal-11.2 { execsql { PRAGMA wal_checkpoint } - list [expr [file size test.db]/1024] [file size test.db-wal] + list [file_page_count test.db] [file size test.db-wal] } [list 3 [wal_file_size 3 1024]] do_test wal-11.3 { execsql { INSERT INTO t1 VALUES( blob(900) ) } - list [expr [file size test.db]/1024] [file size test.db-wal] + list [file_page_count test.db] [file size test.db-wal] } [list 3 [wal_file_size 4 1024]] do_test wal-11.4 { @@ -700,7 +704,7 @@ do_test wal-11.4 { INSERT INTO t1 SELECT blob(900) FROM t1; -- 8 INSERT INTO t1 SELECT blob(900) FROM t1; -- 16 } - list [expr [file size test.db]/1024] [file size test.db-wal] + list [file_page_count test.db] [file size test.db-wal] } [list 3 [wal_file_size 32 1024]] do_test wal-11.5 { execsql { @@ -710,7 +714,7 @@ do_test wal-11.5 { } {16 ok} do_test wal-11.6 { execsql COMMIT - list [expr [file size test.db]/1024] [file size test.db-wal] + list [file_page_count test.db] [file size test.db-wal] } [list 3 [wal_file_size 41 1024]] do_test wal-11.7 { execsql { @@ -720,11 +724,11 @@ do_test wal-11.7 { } {16 ok} do_test wal-11.8 { execsql { PRAGMA wal_checkpoint } - list [expr [file size test.db]/1024] [file size test.db-wal] + list [file_page_count test.db] [file size test.db-wal] } [list 37 [wal_file_size 41 1024]] do_test wal-11.9 { db close - list [expr [file size test.db]/1024] [log_deleted test.db-wal] + list [file_page_count test.db] [log_deleted test.db-wal] } {37 1} sqlite3_wal db test.db set nWal 39 @@ -736,7 +740,7 @@ do_test wal-11.10 { INSERT INTO t1 SELECT blob(900) FROM t1; -- 32 SELECT count(*) FROM t1; } - list [expr [file size test.db]/1024] [file size test.db-wal] + list [file_page_count test.db] [file size test.db-wal] } [list 37 [wal_file_size $nWal 1024]] do_test wal-11.11 { execsql { @@ -746,7 +750,7 @@ do_test wal-11.11 { } } {32 16} do_test wal-11.12 { - list [expr [file size test.db]/1024] [file size test.db-wal] + list [file_page_count test.db] [file size test.db-wal] } [list 37 [wal_file_size $nWal 1024]] do_test wal-11.13 { execsql { @@ -756,7 +760,7 @@ do_test wal-11.13 { } } {17 ok} do_test wal-11.14 { - list [expr [file size test.db]/1024] [file size test.db-wal] + list [file_page_count test.db] [file size test.db-wal] } [list 37 [wal_file_size $nWal 1024]] @@ -773,7 +777,7 @@ do_test wal-12.1 { CREATE TABLE t2(x, y); INSERT INTO t1 VALUES('A', 1); } - list [expr [file size test.db]/1024] [file size test.db-wal] + list [file_page_count test.db] [file size test.db-wal] } [list 1 [wal_file_size 5 1024]] do_test wal-12.2 { db close @@ -782,11 +786,11 @@ do_test wal-12.2 { PRAGMA synchronous = normal; UPDATE t1 SET y = 0 WHERE x = 'A'; } - list [expr [file size test.db]/1024] [expr [file size test.db-wal]/1044] + list [file_page_count test.db] [expr [file size test.db-wal]/1044] } {3 1} do_test wal-12.3 { execsql { INSERT INTO t2 VALUES('B', 1) } - list [expr [file size test.db]/1024] [expr [file size test.db-wal]/1044] + list [file_page_count test.db] [expr [file size test.db-wal]/1044] } {3 2} do_test wal-12.4 { forcecopy test.db test2.db @@ -851,7 +855,6 @@ do_test wal-13.1.2 { sqlite3 db test.db execsql { SELECT * FROM t2 } } {B 2} -breakpoint do_test wal-13.1.3 { db close file exists test.db-wal @@ -1022,8 +1025,8 @@ do_test wal-15.4.5 { sqlite3_errmsg db } {not an error} do_test wal-15.4.6 { - file size test.db -} [expr 1024*2] + list [file_page_count test.db] [file_page_size test.db] +} {2 1024} catch { db2 close } catch { db close } @@ -1071,21 +1074,21 @@ foreach {tn ckpt_cmd ckpt_res ckpt_main ckpt_aux} { INSERT INTO t1 SELECT * FROM t2; } - list [file size test.db] [file size test.db-wal] - } [list [expr 1*1024] [wal_file_size 10 1024]] + list [file_page_count test.db] [file size test.db-wal] + } [list 1 [wal_file_size 10 1024]] do_test wal-16.$tn.3 { - list [file size test2.db] [file size test2.db-wal] - } [list [expr 1*1024] [wal_file_size 13 1024]] + list [file_page_count test2.db] [file size test2.db-wal] + } [list 1 [wal_file_size 13 1024]] do_test wal-16.$tn.4 [list eval $ckpt_cmd] $ckpt_res do_test wal-16.$tn.5 { - list [file size test.db] [file size test.db-wal] - } [list [expr ($ckpt_main ? 7 : 1)*1024] [wal_file_size 10 1024]] + list [file_page_count test.db] [file size test.db-wal] + } [list [expr ($ckpt_main ? 7 : 1)] [wal_file_size 10 1024]] do_test wal-16.$tn.6 { - list [file size test2.db] [file size test2.db-wal] - } [list [expr ($ckpt_aux ? 7 : 1)*1024] [wal_file_size 13 1024]] + list [file_page_count test2.db] [file size test2.db-wal] + } [list [expr ($ckpt_aux ? 7 : 1)] [wal_file_size 13 1024]] catch { db close } } @@ -1145,13 +1148,13 @@ foreach {tn sectorsize logsize} " } $logsize do_test wal-17.$tn.2 { - file size test.db - } 512 + file_page_count test.db + } 1 do_test wal-17.$tn.3 { db close - file size test.db - } [expr 512*171] + file_page_count test.db + } 171 } sqlite3_test_control_pending_byte $old_pending_byte @@ -1186,8 +1189,8 @@ do_test wal-18.0 { forcecopy test.db testX.db forcecopy test.db-wal testX.db-wal db close - list [file size testX.db] [file size testX.db-wal] -} [list [expr 3*1024] [wal_file_size 6 1024]] + list [file_page_count testX.db] [file size testX.db-wal] +} [list 3 [wal_file_size 6 1024]] unset -nocomplain nFrame result foreach {nFrame result} { @@ -1267,7 +1270,7 @@ foreach {tn pgsz works} { # do_test wal-18.2.$tn.$pg.1 { file exists test.db-wal } 0 do_test wal-18.2.$tn.$pg.2 { file exists test.db } 1 - do_test wal-18.2.$tn.$pg.3 { file size test.db } [expr 1024*3] + do_test wal-18.2.$tn.$pg.3 { file_page_count test.db } 3 do_test wal-18.2.$tn.$pg.4 { @@ -1509,8 +1512,8 @@ do_test wal-23.3 { db close set ::log [list] faultsim_restore_and_reopen - execsql { SELECT * FROM t1 } -} {1 2 3 4} + execsql { SELECT * FROM t1 ; PRAGMA page_size } +} {1 2 3 4 1024} set nPage [expr 2+$AUTOVACUUM] do_test wal-23.4 { set ::log diff --git a/test/wal5.test b/test/wal5.test index ebd1dbfc31..7e80221473 100644 --- a/test/wal5.test +++ b/test/wal5.test @@ -21,7 +21,7 @@ ifcapable !wal {finish_test ; return } set testprefix wal5 -proc db_page_count {{file test.db}} { expr [file size $file] / 1024 } +proc db_page_count {{file test.db}} { file_page_count $file } proc wal_page_count {{file test.db}} { wal_frame_count ${file}-wal 1024 } @@ -101,8 +101,8 @@ foreach {testprefix do_wal_checkpoint} { INSERT INTO t1 VALUES(2, zeroblob(1200)); INSERT INTO t1 VALUES(3, zeroblob(1200)); } - expr [file size test.db] / 1024 - } {2} + list [file_page_count test.db] [file_page_size test.db] + } {2 1024} # Have connection 2 grab a read-lock on the current snapshot. do_test 1.$tn.2 { sql2 { BEGIN; SELECT x FROM t1 } } {1 2 3} diff --git a/test/wal9.test b/test/wal9.test index ae2a52bb02..15f8f00fc7 100644 --- a/test/wal9.test +++ b/test/wal9.test @@ -63,7 +63,7 @@ do_execsql_test 1.2 { # # The sizes of various files are slightly different in normal and # auto-vacuum mode. -do_test 1.3 { file size test.db } {1024} +do_test 1.3 { file_page_count test.db } {1} do_test 1.4 { expr {[file size test.db-wal]>(1500*1024)} } {1} do_test 1.5 { expr {[file size test.db-shm]>32768} } {1} do_test 1.6 { diff --git a/test/walbak.test b/test/walbak.test index 303a628a84..f821337f63 100644 --- a/test/walbak.test +++ b/test/walbak.test @@ -50,8 +50,8 @@ do_test walbak-1.0 { do_test walbak-1.1 { forcedelete bak.db bak.db-journal bak.db-wal db backup bak.db - file size bak.db -} [expr 3*1024] + file_page_count bak.db +} 3 do_test walbak-1.2 { sqlite3 db2 bak.db execsql { @@ -73,8 +73,8 @@ do_test walbak-1.4 { } } {wal} do_test walbak-1.5 { - list [file size test.db] [file size test.db-wal] -} [list 1024 [wal_file_size 6 1024]] + list [file_page_count test.db] [file size test.db-wal] +} [list 1 [wal_file_size 6 1024]] do_test walbak-1.6 { execsql { PRAGMA wal_checkpoint } list [file size test.db] [file size test.db-wal] diff --git a/test/walcksum.test b/test/walcksum.test index 08278dd054..1d9774df25 100644 --- a/test/walcksum.test +++ b/test/walcksum.test @@ -176,8 +176,8 @@ foreach endian {big little} { forcecopy test.db-wal test2.db-wal db close - list [file size test2.db] [file size test2.db-wal] - } [list [expr 1024*3] [wal_file_size 6 1024]] + list [file_page_count test2.db] [file size test2.db-wal] + } [list 3 [wal_file_size 6 1024]] # Verify that the checksums are valid for all frames and that they # are calculated by interpreting data in native byte-order. @@ -213,8 +213,8 @@ foreach endian {big little} { PRAGMA synchronous = NORMAL; INSERT INTO t1 VALUES(34, 'thirtyfour'); } - list [file size test.db] [file size test.db-wal] - } [list [expr 1024*3] [wal_file_size 8 1024]] + list [file_page_count test.db] [file size test.db-wal] + } [list 3 [wal_file_size 8 1024]] for {set f 1} {$f <= 8} {incr f} { do_test walcksum-1.$endian.5.$f { log_checksum_verify test.db-wal $f $endian @@ -237,8 +237,8 @@ foreach endian {big little} { PRAGMA synchronous = NORMAL; INSERT INTO t1 VALUES(55, 'fiftyfive'); } db2 - list [file size test.db] [file size test.db-wal] - } [list [expr 1024*3] [wal_file_size 10 1024]] + list [file_page_count test.db] [file size test.db-wal] + } [list 3 [wal_file_size 10 1024]] for {set f 1} {$f <= 10} {incr f} { do_test walcksum-1.$endian.7.$f { log_checksum_verify test.db-wal $f $endian diff --git a/test/walhook.test b/test/walhook.test index 631ec834e3..b31d4f3fb0 100644 --- a/test/walhook.test +++ b/test/walhook.test @@ -49,8 +49,8 @@ do_test walhook-1.2 { do_test walhook-1.3 { proc wal_hook {args} { db eval {PRAGMA wal_checkpoint}; return 0 } execsql { INSERT INTO t1 VALUES(2, 'two') } - file size test.db -} [expr 3*1024] + file_page_count test.db +} 3 do_test walhook-1.4 { proc wal_hook {zDb nEntry} { execsql { PRAGMA wal_checkpoint } diff --git a/test/walmode.test b/test/walmode.test index 4e14d54d4f..6caad58638 100644 --- a/test/walmode.test +++ b/test/walmode.test @@ -42,8 +42,8 @@ do_test walmode-1.1 { execsql { PRAGMA journal_mode = wal } } {wal} do_test walmode-1.2 { - file size test.db -} {1024} + file_page_count test.db +} {1} set expected_sync_count 3 if {$::tcl_platform(platform)!="windows"} { @@ -60,8 +60,8 @@ do_test walmode-1.4 { } {0} do_test walmode-1.5 { execsql { CREATE TABLE t1(a, b) } - file size test.db -} {1024} + file_page_count test.db +} {1} do_test walmode-1.6 { file exists test.db-wal } {1}