Index: Makefile.in ================================================================== --- Makefile.in +++ Makefile.in @@ -50,11 +50,11 @@ # LIBREADLINE = @TARGET_READLINE_LIBS@ # Should the database engine be compiled threadsafe # -TCC += -DTHREADSAFE=@THREADSAFE@ +TCC += -DSQLITE_THREADSAFE=@SQLITE_THREADSAFE@ # The pthreads library if needed # LIBPTHREAD=@TARGET_THREAD_LIB@ Index: configure ================================================================== --- configure +++ configure @@ -843,11 +843,11 @@ VERSION RELEASE VERSION_NUMBER BUILD_CC BUILD_CFLAGS -THREADSAFE +SQLITE_THREADSAFE TARGET_THREAD_LIB XTHREADCONNECT THREADSOVERRIDELOCKS ALLOWRELEASE TEMP_STORE @@ -1929,11 +1929,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # The following RCS revision string applies to configure.in -# $Revision: 1.42 $ +# $Revision: 1.43 $ ######### # Programs needed # # Check whether --enable-shared was given. @@ -18881,27 +18881,27 @@ # # Check whether --enable-threadsafe was given. if test "${enable_threadsafe+set}" = set; then enableval=$enable_threadsafe; else - enable_threadsafe=no + enable_threadsafe=yes fi { echo "$as_me:$LINENO: checking whether to support threadsafe operation" >&5 echo $ECHO_N "checking whether to support threadsafe operation... $ECHO_C" >&6; } if test "$enable_threadsafe" = "no"; then - THREADSAFE=0 + SQLITE_THREADSAFE=0 { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } else - THREADSAFE=1 + SQLITE_THREADSAFE=1 { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } fi -if test "$THREADSAFE" = "1"; then +if test "$SQLITE_THREADSAFE" = "1"; then LIBS="" { echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5 echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6; } if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then @@ -20737,11 +20737,11 @@ VERSION!$VERSION$ac_delim RELEASE!$RELEASE$ac_delim VERSION_NUMBER!$VERSION_NUMBER$ac_delim BUILD_CC!$BUILD_CC$ac_delim BUILD_CFLAGS!$BUILD_CFLAGS$ac_delim -THREADSAFE!$THREADSAFE$ac_delim +SQLITE_THREADSAFE!$SQLITE_THREADSAFE$ac_delim TARGET_THREAD_LIB!$TARGET_THREAD_LIB$ac_delim XTHREADCONNECT!$XTHREADCONNECT$ac_delim THREADSOVERRIDELOCKS!$THREADSOVERRIDELOCKS$ac_delim ALLOWRELEASE!$ALLOWRELEASE$ac_delim TEMP_STORE!$TEMP_STORE$ac_delim @@ -21140,6 +21140,5 @@ exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi - Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -90,11 +90,11 @@ AC_INIT(src/sqlite.h.in) dnl Put the RCS revision string after AC_INIT so that it will also dnl show in in configure. # The following RCS revision string applies to configure.in -# $Revision: 1.29 $ +# $Revision: 1.30 $ ######### # Programs needed # AC_PROG_LIBTOOL @@ -176,22 +176,22 @@ ########## # Do we want to support multithreaded use of sqlite # AC_ARG_ENABLE(threadsafe, -AC_HELP_STRING([--enable-threadsafe],[Support threadsafe operation]),,enable_threadsafe=no) +AC_HELP_STRING([--enable-threadsafe],[Support threadsafe operation]),,enable_threadsafe=yes) AC_MSG_CHECKING([whether to support threadsafe operation]) if test "$enable_threadsafe" = "no"; then - THREADSAFE=0 + SQLITE_THREADSAFE=0 AC_MSG_RESULT([no]) else - THREADSAFE=1 + SQLITE_THREADSAFE=1 AC_MSG_RESULT([yes]) fi -AC_SUBST(THREADSAFE) +AC_SUBST(SQLITE_THREADSAFE) -if test "$THREADSAFE" = "1"; then +if test "$SQLITE_THREADSAFE" = "1"; then LIBS="" AC_CHECK_LIB(pthread, pthread_create) TARGET_THREAD_LIB="$LIBS" LIBS="" else Index: test/malloc3.test ================================================================== --- test/malloc3.test +++ test/malloc3.test @@ -11,19 +11,19 @@ # # This file contains tests to ensure that the library handles malloc() failures # correctly. The emphasis of these tests are the _prepare(), _step() and # _finalize() calls. # -# $Id: malloc3.test,v 1.14 2007/08/31 05:00:49 danielk1977 Exp $ +# $Id: malloc3.test,v 1.15 2007/09/03 16:12:10 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Only run these tests if memory debugging is turned on. # ifcapable !memdebug { - puts "Skipping malloc tests: not compiled with -DSQLITE_MEMDEBUG..." + puts "Skipping malloc3 tests: not compiled with -DSQLITE_MEMDEBUG..." finish_test return } #-------------------------------------------------------------------------- Index: test/malloc4.test ================================================================== --- test/malloc4.test +++ test/malloc4.test @@ -10,11 +10,11 @@ #*********************************************************************** # # This file contains tests to ensure that the library handles malloc() failures # correctly. The emphasis in this file is on sqlite3_column_XXX() APIs. # -# $Id: malloc4.test,v 1.8 2007/08/30 15:16:05 danielk1977 Exp $ +# $Id: malloc4.test,v 1.9 2007/09/03 16:12:10 drh Exp $ #--------------------------------------------------------------------------- # NOTES ON EXPECTED BEHAVIOUR # # [193] When a memory allocation failure occurs during sqlite3_column_name(), @@ -25,12 +25,12 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl # Only run these tests if memory debugging is turned on. -if {[info command sqlite3_memdebug_pending]==""} { - puts "Skipping malloc tests: not compiled with -DSQLITE_MEMDEBUG..." +ifcapable !memdebug { + puts "Skipping malloc4 tests: not compiled with -DSQLITE_MEMDEBUG..." finish_test return } ifcapable !utf16 { Index: test/malloc5.test ================================================================== --- test/malloc5.test +++ test/malloc5.test @@ -10,11 +10,11 @@ #*********************************************************************** # # This file contains test cases focused on the two memory-management APIs, # sqlite3_soft_heap_limit() and sqlite3_release_memory(). # -# $Id: malloc5.test,v 1.15 2007/09/03 11:04:22 danielk1977 Exp $ +# $Id: malloc5.test,v 1.16 2007/09/03 16:12:10 drh Exp $ #--------------------------------------------------------------------------- # NOTES ON EXPECTED BEHAVIOUR # #--------------------------------------------------------------------------- @@ -25,11 +25,11 @@ db close # Only run these tests if memory debugging is turned on. # ifcapable !memdebug { - puts "Skipping malloc tests: not compiled with -DSQLITE_MEMDEBUG..." + puts "Skipping malloc5 tests: not compiled with -DSQLITE_MEMDEBUG..." finish_test return } # Skip these tests if OMIT_MEMORY_MANAGEMENT was defined at compile time. Index: test/malloc6.test ================================================================== --- test/malloc6.test +++ test/malloc6.test @@ -8,19 +8,19 @@ # May you share freely, never taking more than you give. # #*********************************************************************** # This file attempts to check the library in an out-of-memory situation. # -# $Id: malloc6.test,v 1.2 2007/08/22 22:04:37 drh Exp $ +# $Id: malloc6.test,v 1.3 2007/09/03 16:12:10 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Only run these tests if memory debugging is turned on. # ifcapable !memdebug { - puts "Skipping malloc tests: not compiled with -DSQLITE_MEMDEBUG..." + puts "Skipping malloc6 tests: not compiled with -DSQLITE_MEMDEBUG..." finish_test return } source $testdir/malloc_common.tcl Index: test/malloc7.test ================================================================== --- test/malloc7.test +++ test/malloc7.test @@ -9,19 +9,19 @@ # #*********************************************************************** # This file contains additional out-of-memory checks (see malloc.tcl) # added to expose a bug in out-of-memory handling for sqlite3_prepare16(). # -# $Id: malloc7.test,v 1.3 2007/08/22 22:04:37 drh Exp $ +# $Id: malloc7.test,v 1.4 2007/09/03 16:12:10 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Only run these tests if memory debugging is turned on. # ifcapable !memdebug { - puts "Skipping malloc tests: not compiled with -DSQLITE_MEMDEBUG..." + puts "Skipping malloc7 tests: not compiled with -DSQLITE_MEMDEBUG..." finish_test return } source $testdir/malloc_common.tcl Index: test/malloc8.test ================================================================== --- test/malloc8.test +++ test/malloc8.test @@ -9,19 +9,19 @@ # #*********************************************************************** # This file contains additional out-of-memory checks (see malloc.tcl) # added to expose a bug in out-of-memory handling for sqlite3_value_text() # -# $Id: malloc8.test,v 1.4 2007/08/22 22:04:37 drh Exp $ +# $Id: malloc8.test,v 1.5 2007/09/03 16:12:10 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Only run these tests if memory debugging is turned on. # ifcapable !memdebug { - puts "Skipping malloc tests: not compiled with -DSQLITE_MEMDEBUG..." + puts "Skipping malloc8 tests: not compiled with -DSQLITE_MEMDEBUG..." finish_test return } source $testdir/malloc_common.tcl Index: test/malloc9.test ================================================================== --- test/malloc9.test +++ test/malloc9.test @@ -9,19 +9,19 @@ # #*********************************************************************** # This file contains additional out-of-memory checks (see malloc.tcl) # added to expose a bug in out-of-memory handling for sqlite3_prepare(). # -# $Id: malloc9.test,v 1.2 2007/08/22 22:04:37 drh Exp $ +# $Id: malloc9.test,v 1.3 2007/09/03 16:12:10 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Only run these tests if memory debugging is turned on. # ifcapable !memdebug { - puts "Skipping malloc tests: not compiled with -DSQLITE_MEMDEBUG..." + puts "Skipping malloc9 tests: not compiled with -DSQLITE_MEMDEBUG..." finish_test return } source $testdir/malloc_common.tcl Index: test/mallocA.test ================================================================== --- test/mallocA.test +++ test/mallocA.test @@ -8,19 +8,19 @@ # May you share freely, never taking more than you give. # #*********************************************************************** # This file contains additional out-of-memory checks (see malloc.tcl). # -# $Id: mallocA.test,v 1.4 2007/08/29 12:31:29 danielk1977 Exp $ +# $Id: mallocA.test,v 1.5 2007/09/03 16:12:10 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Only run these tests if memory debugging is turned on. # ifcapable !memdebug { - puts "Skipping malloc tests: not compiled with -DSQLITE_MEMDEBUG..." + puts "Skipping mallocA tests: not compiled with -DSQLITE_MEMDEBUG..." finish_test return } source $testdir/malloc_common.tcl Index: test/mallocB.test ================================================================== --- test/mallocB.test +++ test/mallocB.test @@ -11,20 +11,20 @@ # This file contains additional out-of-memory checks (see malloc.tcl). # These were all discovered by fuzzy generation of SQL. Apart from # that they have little in common. # # -# $Id: mallocB.test,v 1.4 2007/08/22 22:04:37 drh Exp $ +# $Id: mallocB.test,v 1.5 2007/09/03 16:12:10 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl source $testdir/malloc_common.tcl # Only run these tests if memory debugging is turned on. # ifcapable !memdebug { - puts "Skipping malloc tests: not compiled with -DSQLITE_MEMDEBUG..." + puts "Skipping mallocB tests: not compiled with -DSQLITE_MEMDEBUG..." finish_test return } source $testdir/malloc_common.tcl Index: test/mallocC.test ================================================================== --- test/mallocC.test +++ test/mallocC.test @@ -10,19 +10,19 @@ #*********************************************************************** # # This file tests aspects of the malloc failure while parsing # CREATE TABLE statements in auto_vacuum mode. # -# $Id: mallocC.test,v 1.4 2007/08/29 12:31:29 danielk1977 Exp $ +# $Id: mallocC.test,v 1.5 2007/09/03 16:12:10 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Only run these tests if memory debugging is turned on. # ifcapable !memdebug { - puts "Skipping malloc tests: not compiled with -DSQLITE_MEMDEBUG..." + puts "Skipping mallocC tests: not compiled with -DSQLITE_MEMDEBUG..." finish_test return } # Generate a checksum based on the contents of the database. If the Index: test/malloc_common.tcl ================================================================== --- test/malloc_common.tcl +++ test/malloc_common.tcl @@ -1,9 +1,24 @@ +# 2007 May 05 +# +# 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 contains common code used by many different malloc tests +# within the test suite. +# +# $Id: malloc_common.tcl,v 1.8 2007/09/03 16:12:10 drh Exp $ +# If we did not compile with malloc testing enabled, then do nothing. +# ifcapable !memdebug { - puts "Skipping malloc tests: not compiled with -DSQLITE_MEMDEBUG..." - finish_test return 0 } # Usage: do_malloc_test # @@ -97,11 +112,10 @@ # nFail - The total number of simulated malloc() failures. # nBenign - The number of benign simulated malloc() failures. # set isFail [catch $::mallocbody msg] set nFail [sqlite3_memdebug_fail -1 -benigncnt nBenign] -#puts "isFail=$isFail nFail=$nFail nBenign=$nBenign msg=$msg" # If one or more mallocs failed, run this loop body again. # set go [expr {$nFail>0}] @@ -129,7 +143,5 @@ } } unset ::mallocopts sqlite3_memdebug_fail -1 } - -return 1 Index: test/shared_err.test ================================================================== --- test/shared_err.test +++ test/shared_err.test @@ -11,11 +11,11 @@ # # The focus of the tests in this file are IO errors that occur in a shared # cache context. What happens to connection B if one connection A encounters # an IO-error whilst reading or writing the file-system? # -# $Id: shared_err.test,v 1.16 2007/08/30 10:07:39 danielk1977 Exp $ +# $Id: shared_err.test,v 1.17 2007/09/03 16:12:10 drh Exp $ proc skip {args} {} set testdir [file dirname $argv0] @@ -291,11 +291,12 @@ } # Only run these tests if memory debugging is turned on. # ifcapable !memdebug { - puts "Skipping malloc tests: not compiled with -DSQLITE_MEMDEBUG..." + puts "Skipping tests shared_err-4 through -9:\ + not compiled with -DSQLITE_MEMDEBUG..." db close sqlite3_enable_shared_cache $::enable_shared_cache finish_test return } Index: test/vtab_err.test ================================================================== --- test/vtab_err.test +++ test/vtab_err.test @@ -7,21 +7,21 @@ # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # -# $Id: vtab_err.test,v 1.7 2007/08/29 12:31:29 danielk1977 Exp $ +# $Id: vtab_err.test,v 1.8 2007/09/03 16:12:10 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl -source $testdir/malloc_common.tcl - ifcapable !vtab { finish_test return } + + unset -nocomplain echo_module_begin_fail do_ioerr_test vtab_err-1 -tclprep { register_echo_module [sqlite3_connection_pointer db] } -sqlbody { @@ -37,10 +37,18 @@ CREATE TABLE r2(a, b, c); INSERT INTO r2 SELECT * FROM e; INSERT INTO e SELECT a||'x', b, c FROM r2; COMMIT; } + +ifcapable !memdebug { + puts "Skipping vtab_err-2 tests: not compiled with -DSQLITE_MEMDEBUG..." + finish_test + return +} +source $testdir/malloc_common.tcl + do_malloc_test vtab_err-2 -tclprep { register_echo_module [sqlite3_connection_pointer db] } -sqlbody { BEGIN;