1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Add the vfs_unregister_all and vfs_reregister_all test commands. Use them

to test the sqlite3_sleep() interface when no VFSes are registered. (CVS 5348)

FossilOrigin-Name: 024d439299478062b6efdb63adce85b251af18ce
This commit is contained in:
drh
2008-07-07 13:31:58 +00:00
parent 6aa1edce9b
commit a2820970c5
4 changed files with 74 additions and 10 deletions

View File

@ -1,5 +1,5 @@
C Fix\sa\scomment\sin\salter.c.\s\sNo\schanges\sto\scode.\s(CVS\s5347) 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-07T12:44:58 D 2008-07-07T13:31:59
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 325dfac0a0dd1cb4d975f1ace6453157892e6042 F Makefile.in 325dfac0a0dd1cb4d975f1ace6453157892e6042
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -149,7 +149,7 @@ F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
F src/status.c 6cb10377992505bd69f1ca1d75c1240a65f25a58 F src/status.c 6cb10377992505bd69f1ca1d75c1240a65f25a58
F src/table.c 1fa8f8113ac9cbc09ae4801c6d2a7f0af82c5822 F src/table.c 1fa8f8113ac9cbc09ae4801c6d2a7f0af82c5822
F src/tclsqlite.c 4dd9ee4cb44846ad9bcc4d0da8088c1e7d4b33d9 F src/tclsqlite.c 4dd9ee4cb44846ad9bcc4d0da8088c1e7d4b33d9
F src/test1.c b96ef5465261a63c96870d1423660b170bf1dec3 F src/test1.c 37de7addd16f4be291bfab25794704daee0ff532
F src/test2.c c46d146019ab6e37474e66b3c789e5237d9ea7b7 F src/test2.c c46d146019ab6e37474e66b3c789e5237d9ea7b7
F src/test3.c 01ff03164cf6a2bededa3b44ecd481603e2644fc F src/test3.c 01ff03164cf6a2bededa3b44ecd481603e2644fc
F src/test4.c ff4ecde3cafc71337b04e8cb7da5bb88e85d70e7 F src/test4.c ff4ecde3cafc71337b04e8cb7da5bb88e85d70e7
@ -223,7 +223,7 @@ F test/blob.test 2a38d867bdf08f9ce081776acec1ac8d4bca66be
F test/busy.test 76b4887f8b9160ba903c1ac22e8ff406ad6ae2f0 F test/busy.test 76b4887f8b9160ba903c1ac22e8ff406ad6ae2f0
F test/cache.test 3ff445c445742a7b6b9ba6e1d62a25263f9424b9 F test/cache.test 3ff445c445742a7b6b9ba6e1d62a25263f9424b9
F test/capi2.test cc64df7560a96f848f919ea2926c60acf639684b F test/capi2.test cc64df7560a96f848f919ea2926c60acf639684b
F test/capi3.test 6312427a6034d4bb725411dbe0c7ec02f09a65f3 F test/capi3.test b92ba9a889def7578da553b1a36f92b147244579
F test/capi3b.test 664eb55318132f292f2c436f90906f578cad6b97 F test/capi3b.test 664eb55318132f292f2c436f90906f578cad6b97
F test/capi3c.test 208713e5f3a63442c3574c55b83baa7cf8ac5f28 F test/capi3c.test 208713e5f3a63442c3574c55b83baa7cf8ac5f28
F test/capi3d.test 537de3a1f724862e327e02bb21b4a84f185dc1e2 F test/capi3d.test 537de3a1f724862e327e02bb21b4a84f185dc1e2
@ -598,7 +598,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1 F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 71d699de366fc9c97d4a5122e2bf754310b9b34a P 3e558acd5eb8aa5ef4681e62284af5c017a24a65
R c7104d24bf193ab5bf7b15e1bf12efdc R 1bf36cfd88471c9d49dd28f2d6350ddc
U drh U drh
Z 5a0ac4ae85600990de53dfc94ccbbf85 Z 6364bac1cd87c47b349e49eb6a625ea6

View File

@ -1 +1 @@
3e558acd5eb8aa5ef4681e62284af5c017a24a65 024d439299478062b6efdb63adce85b251af18ce

View File

@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated ** is not included in the SQLite library. It is used for automated
** testing of the SQLite library. ** 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 "sqliteInt.h"
#include "tcl.h" #include "tcl.h"
@ -4416,6 +4416,51 @@ static int vfs_unlink_test(
return TCL_OK; 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 ** tclcmd: file_control_test DB
** **
@ -4535,6 +4580,10 @@ static int test_limit(
/* /*
** tclcmd: save_prng_state ** 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( static int save_prng_state(
ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
@ -4542,6 +4591,10 @@ static int save_prng_state(
int objc, /* Number of arguments */ int objc, /* Number of arguments */
Tcl_Obj *CONST objv[] /* Command 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); sqlite3_test_control(SQLITE_TESTCTRL_PRNG_SAVE);
return TCL_OK; return TCL_OK;
} }
@ -4716,6 +4769,8 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
{ "sqlite3_global_recover", test_global_recover, 0 }, { "sqlite3_global_recover", test_global_recover, 0 },
{ "working_64bit_int", working_64bit_int, 0 }, { "working_64bit_int", working_64bit_int, 0 },
{ "vfs_unlink_test", vfs_unlink_test, 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 }, { "file_control_test", file_control_test, 0 },
{ "sqlite3_vfs_list", vfs_list, 0 }, { "sqlite3_vfs_list", vfs_list, 0 },

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this script testing the callback-free C/C++ API. # 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] set testdir [file dirname $argv0]
@ -1184,4 +1184,13 @@ do_test capi3-19.1 {
sqlite3_prepare_tkt3134 db 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 finish_test