Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Activate testing of mem3 and mem5. Fix problems found. Tickets #3223 and #3225. Other test configuration changes. (CVS 5419) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
a3a7820540f6f2285e6c83cac84383fc |
User & Date: | drh 2008-07-16 12:25:32.000 |
Context
2008-07-16
| ||
12:33 | Fix a bug in the HOMEGROWN_RECURSIVE_MUTEX implementation for unix. Ticket #3224. (CVS 5420) (check-in: 9af2514c83 user: drh tags: trunk) | |
12:25 | Activate testing of mem3 and mem5. Fix problems found. Tickets #3223 and #3225. Other test configuration changes. (CVS 5419) (check-in: a3a7820540 user: drh tags: trunk) | |
2008-07-15
| ||
22:59 | Work around bugs in older versions of the OS/2 conversion library by trying to minimize calls to UniCreateUconvObject() etc. Use global uconv objects instead. (CVS 5418) (check-in: 80e4218306 user: pweilbacher tags: trunk) | |
Changes
Changes to src/main.c.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** ** $Id: main.c,v 1.478 2008/07/16 12:25:32 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> #ifdef SQLITE_ENABLE_FTS3 # include "fts3.h" #endif |
︙ | ︙ | |||
239 240 241 242 243 244 245 | }else{ /* The heap pointer is not NULL, then install one of the ** mem5.c/mem3.c methods. If neither ENABLE_MEMSYS3 nor ** ENABLE_MEMSYS5 is defined, return an error. ** the default case and return an error. */ #ifdef SQLITE_ENABLE_MEMSYS3 | | | | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | }else{ /* The heap pointer is not NULL, then install one of the ** mem5.c/mem3.c methods. If neither ENABLE_MEMSYS3 nor ** ENABLE_MEMSYS5 is defined, return an error. ** the default case and return an error. */ #ifdef SQLITE_ENABLE_MEMSYS3 sqlite3Config.m = *sqlite3MemGetMemsys3(); #endif #ifdef SQLITE_ENABLE_MEMSYS5 sqlite3Config.m = *sqlite3MemGetMemsys5(); #endif } break; } #endif default: { |
︙ | ︙ |
Changes to src/mem3.c.
︙ | ︙ | |||
19 20 21 22 23 24 25 | ** implementations. Once sqlite3_initialize() has been called, ** the amount of memory available to SQLite is fixed and cannot ** be changed. ** ** This version of the memory allocation subsystem is included ** in the build only if SQLITE_ENABLE_MEMSYS3 is defined. ** | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ** implementations. Once sqlite3_initialize() has been called, ** the amount of memory available to SQLite is fixed and cannot ** be changed. ** ** This version of the memory allocation subsystem is included ** in the build only if SQLITE_ENABLE_MEMSYS3 is defined. ** ** $Id: mem3.c,v 1.19 2008/07/16 12:25:32 drh Exp $ */ #include "sqliteInt.h" /* ** This version of the memory allocator is only built into the library ** SQLITE_ENABLE_MEMSYS3 is defined. Defining this symbol does not ** mean that the library will use a memory-pool by default, just that |
︙ | ︙ | |||
494 495 496 497 498 499 500 | /* ** Return the size of an outstanding allocation, in bytes. The ** size returned omits the 8-byte header overhead. This only ** works for chunks that are currently checked out. */ static int memsys3Size(void *p){ | | > | | 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | /* ** Return the size of an outstanding allocation, in bytes. The ** size returned omits the 8-byte header overhead. This only ** works for chunks that are currently checked out. */ static int memsys3Size(void *p){ Mem3Block *pBlock; if( p==0 ) return 0; pBlock = (Mem3Block*)p; assert( (pBlock[-1].u.hdr.size4x&1)!=0 ); return (pBlock[-1].u.hdr.size4x&~3)*2 - 4; } /* ** Change the size of an existing memory allocation */ |
︙ | ︙ |
Changes to src/mem5.c.
︙ | ︙ | |||
19 20 21 22 23 24 25 | ** implementations. Once sqlite3_initialize() has been called, ** the amount of memory available to SQLite is fixed and cannot ** be changed. ** ** This version of the memory allocation subsystem is included ** in the build only if SQLITE_ENABLE_MEMSYS5 is defined. ** | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ** implementations. Once sqlite3_initialize() has been called, ** the amount of memory available to SQLite is fixed and cannot ** be changed. ** ** This version of the memory allocation subsystem is included ** in the build only if SQLITE_ENABLE_MEMSYS5 is defined. ** ** $Id: mem5.c,v 1.11 2008/07/16 12:25:32 drh Exp $ */ #include "sqliteInt.h" /* ** This version of the memory allocator is used only when ** SQLITE_POW2_MEMORY_SIZE is defined. */ |
︙ | ︙ | |||
42 43 44 45 46 47 48 | # define SQLITE_POW2_LOGMIN 6 #endif /* ** Log2 of the maximum size of an allocation. */ #ifndef SQLITE_POW2_LOGMAX | | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | # define SQLITE_POW2_LOGMIN 6 #endif /* ** Log2 of the maximum size of an allocation. */ #ifndef SQLITE_POW2_LOGMAX # define SQLITE_POW2_LOGMAX 20 #endif #define POW2_MAX (((unsigned int)1)<<SQLITE_POW2_LOGMAX) /* ** Number of distinct allocation sizes. */ #define NSIZE (SQLITE_POW2_LOGMAX - SQLITE_POW2_LOGMIN + 1) |
︙ | ︙ |
Changes to src/test_malloc.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file contains code used to implement test interfaces to the ** memory allocation subsystem. ** | | | 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. ** ************************************************************************* ** ** This file contains code used to implement test interfaces to the ** memory allocation subsystem. ** ** $Id: test_malloc.c,v 1.38 2008/07/16 12:25:32 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" #include <stdlib.h> #include <string.h> #include <assert.h> |
︙ | ︙ | |||
963 964 965 966 967 968 969 | */ static int test_config_heap( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ | | > > > > | | < | 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 | */ static int test_config_heap( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ static char *zBuf; /* Use this memory */ static int szBuf; /* Bytes allocated for zBuf */ int nByte; /* Size of buffer to pass to sqlite3_config() */ int nMinAlloc; /* Size of minimum allocation */ int rc; /* Return code of sqlite3_config() */ Tcl_Obj * CONST *aArg = &objv[1]; int nArg = objc-1; if( nArg!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "NBYTE NMINALLOC"); return TCL_ERROR; } if( Tcl_GetIntFromObj(interp, aArg[0], &nByte) ) return TCL_ERROR; if( Tcl_GetIntFromObj(interp, aArg[1], &nMinAlloc) ) return TCL_ERROR; if( nByte==0 ){ free( zBuf ); zBuf = 0; szBuf = 0; rc = sqlite3_config(SQLITE_CONFIG_HEAP, (void*)0, 0, 0); }else{ zBuf = realloc(zBuf, nByte); szBuf = nByte; rc = sqlite3_config(SQLITE_CONFIG_HEAP, zBuf, nByte, nMinAlloc); } Tcl_SetResult(interp, (char *)sqlite3TestErrorName(rc), TCL_VOLATILE); return TCL_OK; } |
︙ | ︙ |
Changes to test/corrupt9.test.
︙ | ︙ | |||
10 11 12 13 14 15 16 | #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests to make sure SQLite does not crash or # segfault if it sees a corrupt database file. It specifically focuses # on corruption in the form of duplicate entries no the freelist. # | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests to make sure SQLite does not crash or # segfault if it sees a corrupt database file. It specifically focuses # on corruption in the form of duplicate entries no the freelist. # # $Id: corrupt9.test,v 1.2 2008/07/16 12:25:32 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # We must have the page_size pragma for these tests to work. # ifcapable !pager_pragmas { |
︙ | ︙ | |||
50 51 52 53 54 55 56 57 58 59 60 61 62 63 | } # Create a database to work with. Make sure there are plenty of # entries on the freelist. # do_test corrupt9-1.1 { execsql { PRAGMA page_size=1024; CREATE TABLE t1(x); INSERT INTO t1(x) VALUES(1); INSERT INTO t1(x) VALUES(2); INSERT INTO t1(x) SELECT x+2 FROM t1; INSERT INTO t1(x) SELECT x+4 FROM t1; INSERT INTO t1(x) SELECT x+8 FROM t1; | > | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | } # Create a database to work with. Make sure there are plenty of # entries on the freelist. # do_test corrupt9-1.1 { execsql { PRAGMA auto_vacuum=NONE; PRAGMA page_size=1024; CREATE TABLE t1(x); INSERT INTO t1(x) VALUES(1); INSERT INTO t1(x) VALUES(2); INSERT INTO t1(x) SELECT x+2 FROM t1; INSERT INTO t1(x) SELECT x+4 FROM t1; INSERT INTO t1(x) SELECT x+8 FROM t1; |
︙ | ︙ |
Changes to test/mutex2.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2008 July 7 # # 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. # #*********************************************************************** # # Test scripts for deliberate failures of mutex routines. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2008 July 7 # # 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. # #*********************************************************************** # # Test scripts for deliberate failures of mutex routines. # # $Id: mutex2.test,v 1.7 2008/07/16 12:25:32 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # deinitialize # catch {db close} |
︙ | ︙ | |||
56 57 58 59 60 61 62 | do_test mutex2-2.3 { sqlite3_complete16 [utf16 {SELECT * FROM t1;}] } {7} } do_test mutex2-2.4 { sqlite3_mprintf_int {This is a test %d,%d,%d} 1 2 3 } {} | > | | | > | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | do_test mutex2-2.3 { sqlite3_complete16 [utf16 {SELECT * FROM t1;}] } {7} } do_test mutex2-2.4 { sqlite3_mprintf_int {This is a test %d,%d,%d} 1 2 3 } {} ifcapable load_ext { do_test mutex2-2.5 { sqlite3_auto_extension_sqr } {7} } do_test mutex2-2.6 { sqlite3_reset_auto_extension } {} do_test mutex2-2.7 { sqlite3_malloc 10000 } {0} do_test mutex2-2.8 { |
︙ | ︙ |
Changes to test/permutations.test.
1 2 3 4 5 6 7 8 9 10 11 | # 2008 June 21 # # 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. # #*********************************************************************** # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # 2008 June 21 # # 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. # #*********************************************************************** # # $Id: permutations.test,v 1.13 2008/07/16 12:25:32 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Argument processing. # set ::testmode [lindex $argv 0] |
︙ | ︙ | |||
357 358 359 360 361 362 363 | capi3c.test ioerr.test memsubsys2.test capi3.test join3.test pagesize.test collate5.test limit.test } -initialize { catch {db close} sqlite3_reset_auto_extension sqlite3_shutdown | | | 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | capi3c.test ioerr.test memsubsys2.test capi3.test join3.test pagesize.test collate5.test limit.test } -initialize { catch {db close} sqlite3_reset_auto_extension sqlite3_shutdown sqlite3_config_heap 25000000 0 install_malloc_faultsim 1 sqlite3_initialize autoinstall_test_functions } -shutdown { catch {db close} sqlite3_reset_auto_extension sqlite3_shutdown |
︙ | ︙ | |||
385 386 387 388 389 390 391 | capi3c.test ioerr.test memsubsys2.test capi3.test join3.test pagesize.test collate5.test limit.test } -initialize { catch {db close} sqlite3_reset_auto_extension sqlite3_shutdown | | | | 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | capi3c.test ioerr.test memsubsys2.test capi3.test join3.test pagesize.test collate5.test limit.test } -initialize { catch {db close} sqlite3_reset_auto_extension sqlite3_shutdown sqlite3_config_heap 25000000 64 install_malloc_faultsim 1 sqlite3_initialize autoinstall_test_functions } -shutdown { catch {db close} sqlite3_reset_auto_extension sqlite3_shutdown sqlite3_config_heap 0 0 install_malloc_faultsim 1 sqlite3_initialize } run_tests "memsys5-2" -description { Run tests using the allocator in mem5.c in a different configuration. } -include { select1.test } -initialize { catch {db close} sqlite3_reset_auto_extension sqlite3_shutdown sqlite3_config_heap 40000000 16 install_malloc_faultsim 1 sqlite3_initialize autoinstall_test_functions } -shutdown { catch {db close} sqlite3_reset_auto_extension sqlite3_shutdown |
︙ | ︙ |