| Index: third_party/sqlite/src/test/shared.test
 | 
| diff --git a/third_party/sqlite/src/test/shared.test b/third_party/sqlite/src/test/shared.test
 | 
| index 35ddf08820355a2566bee8a6b0e03f73945feca4..4eab476582c2230ca24cdcdadda3205ba2217563 100644
 | 
| --- a/third_party/sqlite/src/test/shared.test
 | 
| +++ b/third_party/sqlite/src/test/shared.test
 | 
| @@ -27,7 +27,7 @@ set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
 | 
|  foreach av [list 0 1] {
 | 
|  
 | 
|  # Open the database connection and execute the auto-vacuum pragma
 | 
| -file delete -force test.db
 | 
| +forcedelete test.db
 | 
|  sqlite3 db test.db
 | 
|  
 | 
|  ifcapable autovacuum {
 | 
| @@ -293,9 +293,9 @@ catch {db3 close}
 | 
|  #     db2.main  ->   ./test2.db
 | 
|  #     db2.test  ->   ./test.db
 | 
|  #
 | 
| -file delete -force test.db
 | 
| -file delete -force test2.db
 | 
| -file delete -force test2.db-journal
 | 
| +forcedelete test.db
 | 
| +forcedelete test2.db
 | 
| +forcedelete test2.db-journal
 | 
|  sqlite3 db  test.db
 | 
|  sqlite3 db2 test2.db
 | 
|  do_test shared-$av.4.1.1 {
 | 
| @@ -426,7 +426,7 @@ catch {db close}
 | 
|  # Tests shared-5.* 
 | 
|  #
 | 
|  foreach db [list test.db test1.db test2.db test3.db] {
 | 
| -  file delete -force $db ${db}-journal
 | 
| +  forcedelete $db ${db}-journal
 | 
|  }
 | 
|  do_test shared-$av.5.1.1 {
 | 
|    sqlite3 db1 test.db
 | 
| @@ -557,7 +557,7 @@ do_test shared-$av.6.1.4 {
 | 
|  catch {db1 close}
 | 
|  catch {db2 close}
 | 
|  foreach f [list test.db test2.db] {
 | 
| -  file delete -force $f ${f}-journal
 | 
| +  forcedelete $f ${f}-journal
 | 
|  }
 | 
|  
 | 
|  #--------------------------------------------------------------------------
 | 
| @@ -643,7 +643,7 @@ unset -nocomplain contents
 | 
|  # The following tests try to trick the shared-cache code into assuming
 | 
|  # the wrong encoding for a database.
 | 
|  #
 | 
| -file delete -force test.db test.db-journal
 | 
| +forcedelete test.db test.db-journal
 | 
|  ifcapable utf16 {
 | 
|    do_test shared-$av.8.1.1 {
 | 
|      sqlite3 db test.db
 | 
| @@ -675,7 +675,7 @@ ifcapable utf16 {
 | 
|      }
 | 
|    } {UTF-8}
 | 
|  
 | 
| -  file delete -force test2.db test2.db-journal
 | 
| +  forcedelete test2.db test2.db-journal
 | 
|    do_test shared-$av.8.2.1 {
 | 
|      execsql {
 | 
|        ATTACH 'test2.db' AS aux;
 | 
| @@ -693,7 +693,7 @@ ifcapable utf16 {
 | 
|  
 | 
|    catch {db close}
 | 
|    catch {db2 close}
 | 
| -  file delete -force test.db test2.db
 | 
| +  forcedelete test.db test2.db
 | 
|  
 | 
|    do_test shared-$av.8.3.2 {
 | 
|      sqlite3 db test.db
 | 
| @@ -732,7 +732,7 @@ if 0 {
 | 
|  
 | 
|  catch {db close}
 | 
|  catch {db2 close}
 | 
| -file delete -force test.db test2.db
 | 
| +forcedelete test.db test2.db
 | 
|  
 | 
|  #---------------------------------------------------------------------------
 | 
|  # The following tests - shared-9.* - test interactions between TEMP triggers
 | 
| @@ -772,7 +772,7 @@ do_test shared-$av.9.3 {
 | 
|  #
 | 
|  do_test shared-$av.10.1 {
 | 
|    # Create a small sample database with two connections to it (db and db2).
 | 
| -  file delete -force test.db
 | 
| +  forcedelete test.db
 | 
|    sqlite3 db  test.db
 | 
|    sqlite3 db2 test.db
 | 
|    execsql {
 | 
| @@ -853,7 +853,7 @@ do_test shared-$av.10.11 {
 | 
|  } {}
 | 
|  
 | 
|  do_test shared-$av.11.1 {
 | 
| -  file delete -force test.db
 | 
| +  forcedelete test.db
 | 
|    sqlite3 db  test.db
 | 
|    sqlite3 db2 test.db
 | 
|    execsql {
 | 
| @@ -904,9 +904,11 @@ do_test shared-$av.11.8 {
 | 
|    set res
 | 
|  } {1 4 {} 7}
 | 
|  if {[llength [info command sqlite3_shared_cache_report]]==1} {
 | 
| -  do_test shared-$av.11.9 {
 | 
| -    string tolower [sqlite3_shared_cache_report]
 | 
| -  } [string tolower [list [file nativename [file normalize test.db]] 2]]
 | 
| +  ifcapable curdir {
 | 
| +    do_test shared-$av.11.9 {
 | 
| +      string tolower [sqlite3_shared_cache_report]
 | 
| +    } [string tolower [list [file nativename [file normalize test.db]] 2]]
 | 
| +  }
 | 
|  }
 | 
|  
 | 
|  do_test shared-$av.11.11 {
 | 
| @@ -916,7 +918,7 @@ do_test shared-$av.11.11 {
 | 
|  
 | 
|  # This tests that if it is impossible to free any pages, SQLite will
 | 
|  # exceed the limit set by PRAGMA cache_size.
 | 
| -file delete -force test.db test.db-journal
 | 
| +forcedelete test.db test.db-journal
 | 
|  sqlite3 db test.db 
 | 
|  ifcapable pager_pragmas {
 | 
|    do_test shared-$av.12.1 {
 | 
| @@ -963,7 +965,7 @@ do_test shared-$av.12.X {
 | 
|  # database handle. This covers an extra line or two.
 | 
|  #
 | 
|  do_test shared-$av.13.1 {
 | 
| -  file delete -force test2.db test3.db test4.db test5.db
 | 
| +  forcedelete test2.db test3.db test4.db test5.db
 | 
|    sqlite3 db :memory:
 | 
|    execsql {
 | 
|      ATTACH 'test2.db' AS aux2;
 | 
| @@ -1026,7 +1028,7 @@ do_test shared-$av.14.3 {
 | 
|  # assert() statements in the C code.
 | 
|  #
 | 
|  do_test shared-$av-15.1 {
 | 
| -  file delete -force test.db
 | 
| +  forcedelete test.db
 | 
|    sqlite3 db test.db -fullmutex 1
 | 
|    sqlite3 db2 test.db -fullmutex 1
 | 
|    execsql {
 | 
| @@ -1056,7 +1058,127 @@ do_test shared-$av-15.2 {
 | 
|  db close
 | 
|  db2 close
 | 
|  
 | 
| -}
 | 
| +# Shared cache on a :memory: database.  This only works for URI filenames.
 | 
| +#
 | 
| +do_test shared-$av-16.1 {
 | 
| +  sqlite3 db1 file::memory: -uri 1
 | 
| +  sqlite3 db2 file::memory: -uri 1
 | 
| +  db1 eval {
 | 
| +    CREATE TABLE t1(x); INSERT INTO t1 VALUES(1),(2),(3);
 | 
| +  }
 | 
| +  db2 eval {
 | 
| +    SELECT x FROM t1 ORDER BY x;
 | 
| +  }
 | 
| +} {1 2 3}
 | 
| +do_test shared-$av-16.2 {
 | 
| +  db2 eval {
 | 
| +    INSERT INTO t1 VALUES(99);
 | 
| +    DELETE FROM t1 WHERE x=2;
 | 
| +  }
 | 
| +  db1 eval {
 | 
| +    SELECT x FROM t1 ORDER BY x;
 | 
| +  }
 | 
| +} {1 3 99}
 | 
| +
 | 
| +# Verify that there is no cache sharing ordinary (non-URI) filenames are
 | 
| +# used.
 | 
| +#
 | 
| +do_test shared-$av-16.3 {
 | 
| +  db1 close
 | 
| +  db2 close
 | 
| +  sqlite3 db1 :memory:
 | 
| +  sqlite3 db2 :memory:
 | 
| +  db1 eval {
 | 
| +    CREATE TABLE t1(x); INSERT INTO t1 VALUES(4),(5),(6);
 | 
| +  }
 | 
| +  catchsql {
 | 
| +    SELECT * FROM t1;
 | 
| +  } db2
 | 
| +} {1 {no such table: t1}}
 | 
| +
 | 
| +# Shared cache on named memory databases.
 | 
| +#
 | 
| +do_test shared-$av-16.4 {
 | 
| +  db1 close
 | 
| +  db2 close
 | 
| +  forcedelete test.db test.db-wal test.db-journal
 | 
| +  sqlite3 db1 file:test.db?mode=memory -uri 1
 | 
| +  sqlite3 db2 file:test.db?mode=memory -uri 1
 | 
| +  db1 eval {
 | 
| +    CREATE TABLE t1(x); INSERT INTO t1 VALUES(1),(2),(3);
 | 
| +  }
 | 
| +  db2 eval {
 | 
| +    SELECT x FROM t1 ORDER BY x;
 | 
| +  }
 | 
| +} {1 2 3}
 | 
| +do_test shared-$av-16.5 {
 | 
| +  db2 eval {
 | 
| +    INSERT INTO t1 VALUES(99);
 | 
| +    DELETE FROM t1 WHERE x=2;
 | 
| +  }
 | 
| +  db1 eval {
 | 
| +    SELECT x FROM t1 ORDER BY x;
 | 
| +  }
 | 
| +} {1 3 99}
 | 
| +do_test shared-$av-16.6 {
 | 
| +  file exists test.db
 | 
| +} {0}  ;# Verify that the database is in-memory
 | 
| +
 | 
| +# Shared cache on named memory databases with different names.
 | 
| +#
 | 
| +do_test shared-$av-16.7 {
 | 
| +  db1 close
 | 
| +  db2 close
 | 
| +  forcedelete test1.db test2.db
 | 
| +  sqlite3 db1 file:test1.db?mode=memory -uri 1
 | 
| +  sqlite3 db2 file:test2.db?mode=memory -uri 1
 | 
| +  db1 eval {
 | 
| +    CREATE TABLE t1(x); INSERT INTO t1 VALUES(1),(2),(3);
 | 
| +  }
 | 
| +  catchsql {
 | 
| +    SELECT x FROM t1 ORDER BY x;
 | 
| +  } db2
 | 
| +} {1 {no such table: t1}}
 | 
| +do_test shared-$av-16.8 {
 | 
| +  file exists test1.db
 | 
| +} {0}  ;# Verify that the database is in-memory
 | 
| +
 | 
| +# Shared cache on named memory databases attached to readonly connections.
 | 
| +#
 | 
| +do_test shared-$av-16.8.1 {
 | 
| +  db1 close
 | 
| +  db2 close
 | 
| +
 | 
| +  sqlite3 db test1.db
 | 
| +  db eval { 
 | 
| +    CREATE TABLE yy(a, b);
 | 
| +    INSERT INTO yy VALUES(77, 88);
 | 
| +  }
 | 
| +  db close
 | 
| +
 | 
| +  sqlite3 db1 test1.db -uri 1 -readonly 1
 | 
| +  sqlite3 db2 test2.db -uri 1 
 | 
| +
 | 
| +  db1 eval { 
 | 
| +    ATTACH 'file:mem?mode=memory&cache=shared' AS shared; 
 | 
| +    CREATE TABLE shared.xx(a, b);
 | 
| +    INSERT INTO xx VALUES(55, 66);
 | 
| +  }
 | 
| +  db2 eval { 
 | 
| +    ATTACH 'file:mem?mode=memory&cache=shared' AS shared;
 | 
| +    SELECT * FROM xx;
 | 
| +  }
 | 
| +} {55 66}
 | 
| +
 | 
| +do_test shared-$av-16.8.2 { db1 eval { SELECT * FROM yy } } {77 88}
 | 
| +do_test shared-$av-16.8.3 { 
 | 
| +  list [catch {db1 eval { INSERT INTO yy VALUES(1, 2) }} msg] $msg
 | 
| +} {1 {attempt to write a readonly database}}
 | 
| +
 | 
| +db1 close
 | 
| +db2 close
 | 
| +
 | 
| +}  ;# end of autovacuum on/off loop
 | 
|  
 | 
|  sqlite3_enable_shared_cache $::enable_shared_cache
 | 
|  finish_test
 | 
| 
 |