From: drh Date: Sat, 26 Nov 2016 20:12:40 +0000 (+0000) Subject: Update test case for opening SHM files read/write on a read-only connection X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e5c66e42db1b26b3e227383ac9ce80f4e5cd386d;p=thirdparty%2Fsqlite.git Update test case for opening SHM files read/write on a read-only connection so that they are only attempted on Darwin with SQLITE_ENABLE_PRESIST_WAL. FossilOrigin-Name: d6a7bf80cfb0cdca2bd684adfaba2c3e8053f8a4 --- diff --git a/manifest b/manifest index f8c34d5338..21d3d4bccc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C When\sopening\sthe\s*-shm\sfile\sfor\sa\sreadonly\sdatabase,\stry\sto\sopen\sit\sin\sread-write\smode\sbefore\sfalling\sback\sto\sreadonly.\sThis\sis\sin\scase\ssome\sother\sread/write\sconnection\swithin\sthe\ssame\sprocess\suses\sthe\ssame\sfile\sdescriptor. -D 2016-11-17T14:02:50.490 +C Update\stest\scase\sfor\sopening\sSHM\sfiles\sread/write\son\sa\sread-only\sconnection\nso\sthat\sthey\sare\sonly\sattempted\son\sDarwin\swith\sSQLITE_ENABLE_PRESIST_WAL. +D 2016-11-26T20:12:40.118 F Makefile.in c9c70541089a9755069a9dad0b609cf14a382649 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc a8af814f63c124db048517b63a0b8650c3fc26fc @@ -1402,7 +1402,7 @@ F test/walnoshm.test 559b878f3aab838971d820329ca35f1caa7b038e F test/waloverwrite.test dad2f26567f1b45174e54fbf9a8dc1cb876a7f03 F test/walpersist.test abd956d66e2f36d2d9d05d3a969f48be6d2ddbec F test/walprotocol.test 0b92feb132ccebd855494d917d3f6c2d717ace20 -F test/walro.test 2baad492f8f52d24143ec8a0a811dc5604d05ae9 +F test/walro.test b874ef49167c3a463f798a4caf25c7e13e1a9e7f F test/walshared.test 04590b10c677f75318701818c50bc0dda5da64ab F test/walslow.test 07a51cbe9d4895d0a90c7af76d14a62d363ac162 F test/walthread.test c13f5a12fbd9d81e58f49875dc9dd8a52a84cf03 @@ -1535,7 +1535,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 0e5ffd9123d6d2d2b8f3701e8a73cc98a3a7ff5f -R dd715a7090f8ccbb07a44c145e36e97f -U dan -Z dc2784f452c216a6da4c2c53fde33522 +P a07c581e88aa4d9835f6144c0fd5e58ef42f14ac +R 061d6c14387255b6c2b7db96406db959 +U drh +Z deaa464aa4ff286e026ec1554bd7622c diff --git a/manifest.uuid b/manifest.uuid index 958987df12..6c25c70c60 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a07c581e88aa4d9835f6144c0fd5e58ef42f14ac \ No newline at end of file +d6a7bf80cfb0cdca2bd684adfaba2c3e8053f8a4 \ No newline at end of file diff --git a/test/walro.test b/test/walro.test index ba8bc3dc44..2076f06ee9 100644 --- a/test/walro.test +++ b/test/walro.test @@ -306,62 +306,67 @@ do_multiclient_test tn { forcedelete $shmpath -#---------------------------------------------------------------------------- - -catch {db2 close} -reset_db -do_execsql_test 3.1 { - CREATE TABLE t1(a, b); - PRAGMA journal_mode = wal; - INSERT INTO t1 VALUES(1, 2); -} {wal} -db_save -db close -db_restore - -sqlite3 db test.db -readonly 1 - -do_execsql_test 3.2 { SELECT * FROM t1 } {1 2} -do_catchsql_test 3.3 { - INSERT INTO t1 VALUES(3, 4) -} {1 {attempt to write a readonly database}} - -sqlite3 db2 test.db -do_test 3.4 { - db2 eval { INSERT INTO t1 VALUES(3, 4) } -} {} -do_execsql_test 3.5 { SELECT * FROM t1 } {1 2 3 4} - -db close -db2 close -db_restore -file attributes $shmpath -permissions r--r--r-- -sqlite3 db test.db -readonly 1 -do_execsql_test 3.6 { SELECT * FROM t1 } {1 2} - -db close -db_restore -file attributes $shmpath -permissions r--r--r-- -sqlite3 db test.db -do_test 3.7 { - catchsql { SELECT * FROM t1 } -} {1 {unable to open database file}} - -db close -db_restore -file attributes $shmpath -permissions r--r--r-- -sqlite3 db test.db -readonly 1 -do_execsql_test 3.8 { SELECT * FROM t1 } {1 2} - -sqlite3 db2 test.db -do_test 3.9 { db2 eval { SELECT * FROM t1 } } {1 2} -do_test 3.10 { - catchsql { INSERT INTO t1 VALUES(3, 4) } db2 -} {1 {attempt to write a readonly database}} - -catch { db close } -catch { db2 close } - -forcedelete $shmpath - +if {$tcl_platform(os)=="Darwin"} { + ifcapable enable_persist_wal { + + #-------------------------------------------------------------------------- + + catch {db2 close} + reset_db + do_execsql_test 3.1 { + CREATE TABLE t1(a, b); + PRAGMA journal_mode = wal; + INSERT INTO t1 VALUES(1, 2); + } {wal} + db_save + db close + db_restore + + sqlite3 db test.db -readonly 1 + + do_execsql_test 3.2 { SELECT * FROM t1 } {1 2} + do_catchsql_test 3.3 { + INSERT INTO t1 VALUES(3, 4) + } {1 {attempt to write a readonly database}} + + sqlite3 db2 test.db + do_test 3.4 { + db2 eval { INSERT INTO t1 VALUES(3, 4) } + } {} + do_execsql_test 3.5 { SELECT * FROM t1 } {1 2 3 4} + + db close + db2 close + db_restore + file attributes $shmpath -permissions r--r--r-- + sqlite3 db test.db -readonly 1 + do_execsql_test 3.6 { SELECT * FROM t1 } {1 2} + + db close + db_restore + file attributes $shmpath -permissions r--r--r-- + sqlite3 db test.db + do_test 3.7 { + catchsql { SELECT * FROM t1 } + } {1 {unable to open database file}} + + db close + db_restore + file attributes $shmpath -permissions r--r--r-- + sqlite3 db test.db -readonly 1 + do_execsql_test 3.8 { SELECT * FROM t1 } {1 2} + + sqlite3 db2 test.db + do_test 3.9 { db2 eval { SELECT * FROM t1 } } {1 2} + do_test 3.10 { + catchsql { INSERT INTO t1 VALUES(3, 4) } db2 + } {1 {attempt to write a readonly database}} + + catch { db close } + catch { db2 close } + + forcedelete $shmpath + } ;# endif capable enable_persist_wal +} ;# endif os Darwin + finish_test