]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add the vfs_unregister_all and vfs_reregister_all test commands. Use them
authordrh <drh@noemail.net>
Mon, 7 Jul 2008 13:31:58 +0000 (13:31 +0000)
committerdrh <drh@noemail.net>
Mon, 7 Jul 2008 13:31:58 +0000 (13:31 +0000)
to test the sqlite3_sleep() interface when no VFSes are registered. (CVS 5348)

FossilOrigin-Name: 024d439299478062b6efdb63adce85b251af18ce

manifest
manifest.uuid
src/test1.c
test/capi3.test

index d74abad3681b17518dd22c1fbf709101f3588612..8956695325225c71d3ec3c23dfdb695afe30b837 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\scomment\sin\salter.c.\s\sNo\schanges\sto\scode.\s(CVS\s5347)
-D 2008-07-07T12:44:58
+C Add\sthe\svfs_unregister_all\sand\svfs_reregister_all\stest\scommands.\s\sUse\sthem\nto\stest\sthe\ssqlite3_sleep()\sinterface\swhen\sno\sVFSes\sare\sregistered.\s(CVS\s5348)
+D 2008-07-07T13:31:59
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 325dfac0a0dd1cb4d975f1ace6453157892e6042
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -149,7 +149,7 @@ F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
 F src/status.c 6cb10377992505bd69f1ca1d75c1240a65f25a58
 F src/table.c 1fa8f8113ac9cbc09ae4801c6d2a7f0af82c5822
 F src/tclsqlite.c 4dd9ee4cb44846ad9bcc4d0da8088c1e7d4b33d9
-F src/test1.c b96ef5465261a63c96870d1423660b170bf1dec3
+F src/test1.c 37de7addd16f4be291bfab25794704daee0ff532
 F src/test2.c c46d146019ab6e37474e66b3c789e5237d9ea7b7
 F src/test3.c 01ff03164cf6a2bededa3b44ecd481603e2644fc
 F src/test4.c ff4ecde3cafc71337b04e8cb7da5bb88e85d70e7
@@ -223,7 +223,7 @@ F test/blob.test 2a38d867bdf08f9ce081776acec1ac8d4bca66be
 F test/busy.test 76b4887f8b9160ba903c1ac22e8ff406ad6ae2f0
 F test/cache.test 3ff445c445742a7b6b9ba6e1d62a25263f9424b9
 F test/capi2.test cc64df7560a96f848f919ea2926c60acf639684b
-F test/capi3.test 6312427a6034d4bb725411dbe0c7ec02f09a65f3
+F test/capi3.test b92ba9a889def7578da553b1a36f92b147244579
 F test/capi3b.test 664eb55318132f292f2c436f90906f578cad6b97
 F test/capi3c.test 208713e5f3a63442c3574c55b83baa7cf8ac5f28
 F test/capi3d.test 537de3a1f724862e327e02bb21b4a84f185dc1e2
@@ -598,7 +598,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 71d699de366fc9c97d4a5122e2bf754310b9b34a
-R c7104d24bf193ab5bf7b15e1bf12efdc
+P 3e558acd5eb8aa5ef4681e62284af5c017a24a65
+R 1bf36cfd88471c9d49dd28f2d6350ddc
 U drh
-Z 5a0ac4ae85600990de53dfc94ccbbf85
+Z 6364bac1cd87c47b349e49eb6a625ea6
index 3b6ae138ddefd9292984dc2f87e5b5acab60d713..689d71e870b0a06ce85e3c9464488472a823849e 100644 (file)
@@ -1 +1 @@
-3e558acd5eb8aa5ef4681e62284af5c017a24a65
\ No newline at end of file
+024d439299478062b6efdb63adce85b251af18ce
\ No newline at end of file
index 37b6cf24665ac0149fd82119497c26b55e4f9cc4..6e6fbb86e4a0358406f71af80f9ef3b1f07bbd2d 100644 (file)
@@ -13,7 +13,7 @@
 ** is not included in the SQLite library.  It is used for automated
 ** testing of the SQLite library.
 **
-** $Id: test1.c,v 1.308 2008/06/28 11:23:00 danielk1977 Exp $
+** $Id: test1.c,v 1.309 2008/07/07 13:31:59 drh Exp $
 */
 #include "sqliteInt.h"
 #include "tcl.h"
@@ -4416,6 +4416,51 @@ static int vfs_unlink_test(
   return TCL_OK;
 }
 
+/*
+** Saved VFSes
+*/
+static sqlite3_vfs *apVfs[20];
+static int nVfs = 0;
+
+/*
+** tclcmd:   vfs_unregister_all
+**
+** Unregister all VFSes.
+*/
+static int vfs_unregister_all(
+  ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
+  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
+  int objc,              /* Number of arguments */
+  Tcl_Obj *CONST objv[]  /* Command arguments */
+){
+  int i;
+  for(i=0; i<ArraySize(apVfs); i++){
+    apVfs[i] = sqlite3_vfs_find(0);
+    if( apVfs[i]==0 ) break;
+    sqlite3_vfs_unregister(apVfs[i]);
+  }
+  nVfs = i;
+  return TCL_OK;
+}
+/*
+** tclcmd:   vfs_reregister_all
+**
+** Restore all VFSes that were removed using vfs_unregister_all
+*/
+static int vfs_reregister_all(
+  ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
+  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
+  int objc,              /* Number of arguments */
+  Tcl_Obj *CONST objv[]  /* Command arguments */
+){
+  int i;
+  for(i=0; i<nVfs; i++){
+    sqlite3_vfs_register(apVfs[i], i==0);
+  }
+  return TCL_OK;
+}
+
+
 /*
 ** tclcmd:   file_control_test DB
 **
@@ -4535,6 +4580,10 @@ static int test_limit(
 
 /*
 ** tclcmd:  save_prng_state
+**
+** Save the state of the pseudo-random number generator.
+** At the same time, verify that sqlite3_test_control works even when
+** called with an out-of-range opcode.
 */
 static int save_prng_state(
   ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
@@ -4542,6 +4591,10 @@ static int save_prng_state(
   int objc,              /* Number of arguments */
   Tcl_Obj *CONST objv[]  /* Command arguments */
 ){
+  int rc = sqlite3_test_control(9999);
+  assert( rc==0 );
+  rc = sqlite3_test_control(-1);
+  assert( rc==0 );
   sqlite3_test_control(SQLITE_TESTCTRL_PRNG_SAVE);
   return TCL_OK;
 }
@@ -4716,6 +4769,8 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
      { "sqlite3_global_recover",     test_global_recover, 0   },
      { "working_64bit_int",          working_64bit_int,   0   },
      { "vfs_unlink_test",            vfs_unlink_test,     0   },
+     { "vfs_unregister_all",         vfs_unregister_all,  0   },
+     { "vfs_reregister_all",         vfs_reregister_all,  0   },
      { "file_control_test",          file_control_test,   0   },
      { "sqlite3_vfs_list",           vfs_list,     0   },
 
index b771980e17b8ad94122cd905f3ae761c56e7074c..71599810e9c374cb1913821c58fe12fcc8a2fddf 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this script testing the callback-free C/C++ API.
 #
-# $Id: capi3.test,v 1.65 2008/06/23 17:56:47 drh Exp $
+# $Id: capi3.test,v 1.66 2008/07/07 13:32:00 drh Exp $
 #
 
 set testdir [file dirname $argv0]
@@ -1184,4 +1184,13 @@ do_test capi3-19.1 {
   sqlite3_prepare_tkt3134 db
 } {}
 
+# Tests of the interface when no VFS is registered.
+#
+db close
+vfs_unregister_all
+do_test capi3-20.1 {
+  sqlite3_sleep 100
+} {0}
+vfs_reregister_all
+
 finish_test