Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | 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) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
024d439299478062b6efdb63adce85b2 |
User & Date: | drh 2008-07-07 13:31:59.000 |
Context
2008-07-07
| ||
14:50 | Additional test cases added on the sqlite3_create_function() interface. (CVS 5349) (check-in: 4e941f3d43 user: drh tags: trunk) | |
13:31 | 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) (check-in: 024d439299 user: drh tags: trunk) | |
12:44 | Fix a comment in alter.c. No changes to code. (CVS 5347) (check-in: 3e558acd5e user: drh tags: trunk) | |
Changes
Changes to src/test1.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing all sorts of SQLite interfaces. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing all sorts of SQLite interfaces. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** ** $Id: test1.c,v 1.309 2008/07/07 13:31:59 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" #include <stdlib.h> #include <string.h> /* |
︙ | ︙ | |||
4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 | /* We should be left with the original default VFS back as the ** original */ assert( sqlite3_vfs_find(0)==pMain ); return TCL_OK; } /* ** tclcmd: file_control_test DB ** ** This TCL command runs the sqlite3_file_control interface and ** verifies correct operation of the same. */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 | /* We should be left with the original default VFS back as the ** original */ assert( sqlite3_vfs_find(0)==pMain ); 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 ** ** This TCL command runs the sqlite3_file_control interface and ** verifies correct operation of the same. */ |
︙ | ︙ | |||
4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 | rc = sqlite3_limit(db, id, val); Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return TCL_OK; } /* ** tclcmd: save_prng_state */ static int save_prng_state( 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 */ ){ sqlite3_test_control(SQLITE_TESTCTRL_PRNG_SAVE); return TCL_OK; } /* ** tclcmd: restore_prng_state */ static int restore_prng_state( | > > > > > > > > | 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 | rc = sqlite3_limit(db, id, val); Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return TCL_OK; } /* ** 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 */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ 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; } /* ** tclcmd: restore_prng_state */ static int restore_prng_state( |
︙ | ︙ | |||
4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 | {"sqlite3_column_origin_name16", test_stmt_utf16, sqlite3_column_origin_name16}, #endif #endif { "sqlite3_create_collation_v2", test_create_collation_v2, 0 }, { "sqlite3_global_recover", test_global_recover, 0 }, { "working_64bit_int", working_64bit_int, 0 }, { "vfs_unlink_test", vfs_unlink_test, 0 }, { "file_control_test", file_control_test, 0 }, { "sqlite3_vfs_list", vfs_list, 0 }, /* Functions from os.h */ #ifndef SQLITE_OMIT_DISKIO #if 0 { "sqlite3OsOpenReadWrite",test_sqlite3OsOpenReadWrite, 0 }, | > > | 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 | {"sqlite3_column_origin_name16", test_stmt_utf16, sqlite3_column_origin_name16}, #endif #endif { "sqlite3_create_collation_v2", test_create_collation_v2, 0 }, { "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 }, /* Functions from os.h */ #ifndef SQLITE_OMIT_DISKIO #if 0 { "sqlite3OsOpenReadWrite",test_sqlite3OsOpenReadWrite, 0 }, |
︙ | ︙ |
Changes to test/capi3.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2003 January 29 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script testing the callback-free C/C++ API. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2003 January 29 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # 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.66 2008/07/07 13:32:00 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # Return the UTF-16 representation of the supplied UTF-8 string $str. # If $nt is true, append two 0x00 bytes as a nul terminator. |
︙ | ︙ | |||
1179 1180 1181 1182 1183 1184 1185 1186 1187 | # Ticket #3134. Prepare a statement with an nBytes parameter of 0. # Make sure this works correctly and does not reference memory out of # range. # do_test capi3-19.1 { sqlite3_prepare_tkt3134 db } {} finish_test | > > > > > > > > > | 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 | # Ticket #3134. Prepare a statement with an nBytes parameter of 0. # Make sure this works correctly and does not reference memory out of # range. # 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 |