Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Update the rest of the malloc failure test scripts to use the new interface. (CVS 4296) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b076e1655d6bae5ae10e6ceee646f502 |
User & Date: | danielk1977 2007-08-25 13:37:49.000 |
Context
2007-08-25
| ||
14:39 | Use recursive mutexes in pthreads. If the pthreads implementation does not support recursive mutexes, then you cannot compile SQLite with SQLITE_THREADSAFE=1. Ticket #2588. (CVS 4297) (check-in: 1668284d15 user: drh tags: trunk) | |
13:37 | Update the rest of the malloc failure test scripts to use the new interface. (CVS 4296) (check-in: b076e1655d user: danielk1977 tags: trunk) | |
13:09 | Fix bugs in the altermalloc.test and incrblob_err.test scripts. (CVS 4295) (check-in: e5ec170717 user: danielk1977 tags: trunk) | |
Changes
Changes to src/test8.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing the virtual table 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 the virtual table interfaces. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** ** $Id: test8.c,v 1.54 2007/08/25 13:37:49 danielk1977 Exp $ */ #include "sqliteInt.h" #include "tcl.h" #include <stdlib.h> #include <string.h> #ifndef SQLITE_OMIT_VIRTUALTABLE |
︙ | ︙ | |||
299 300 301 302 303 304 305 | echo_vtab *pVtab, sqlite3 *db ){ int rc = SQLITE_OK; if( pVtab->zTableName ){ sqlite3_stmt *pStmt = 0; | | > | | | | | | | | | | | | | | | | | | | | > | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | echo_vtab *pVtab, sqlite3 *db ){ int rc = SQLITE_OK; if( pVtab->zTableName ){ sqlite3_stmt *pStmt = 0; rc = sqlite3_prepare(db, "SELECT sql FROM sqlite_master WHERE type = 'table' AND name = ?", -1, &pStmt, 0); if( rc==SQLITE_OK ){ sqlite3_bind_text(pStmt, 1, pVtab->zTableName, -1, 0); if( sqlite3_step(pStmt)==SQLITE_ROW ){ int rc2; const char *zCreateTable = (const char *)sqlite3_column_text(pStmt, 0); rc = sqlite3_declare_vtab(db, zCreateTable); rc2 = sqlite3_finalize(pStmt); if( rc==SQLITE_OK ){ rc = rc2; } } else { rc = sqlite3_finalize(pStmt); if( rc==SQLITE_OK ){ rc = SQLITE_ERROR; } } if( rc==SQLITE_OK ){ rc = getColumnNames(db, pVtab->zTableName, &pVtab->aCol, &pVtab->nCol); } if( rc==SQLITE_OK ){ rc = getIndexArray(db, pVtab->zTableName, pVtab->nCol, &pVtab->aIndex); } } } return rc; } /* |
︙ | ︙ | |||
780 781 782 783 784 785 786 787 788 789 790 791 792 793 | string_concat(&zQuery, zNew, 1); pIdxInfo->orderByConsumed = 1; } appendToEchoModule(pVtab->interp, "xBestIndex");; appendToEchoModule(pVtab->interp, zQuery); pIdxInfo->idxNum = hashString(zQuery); pIdxInfo->idxStr = zQuery; pIdxInfo->needToFreeIdxStr = 1; if (useCost) { pIdxInfo->estimatedCost = cost; } else if( useIdx ){ /* Approximation of log2(nRow). */ | > > > | 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 | string_concat(&zQuery, zNew, 1); pIdxInfo->orderByConsumed = 1; } appendToEchoModule(pVtab->interp, "xBestIndex");; appendToEchoModule(pVtab->interp, zQuery); if( !zQuery ){ return SQLITE_NOMEM; } pIdxInfo->idxNum = hashString(zQuery); pIdxInfo->idxStr = zQuery; pIdxInfo->needToFreeIdxStr = 1; if (useCost) { pIdxInfo->estimatedCost = cost; } else if( useIdx ){ /* Approximation of log2(nRow). */ |
︙ | ︙ |
Changes to test/attachmalloc.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #************************************************************************* # This file implements regression tests for SQLite library. The # focus of this script is testing the ATTACH statement and # specifically out-of-memory conditions within that command. # | | < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # May you share freely, never taking more than you give. # #************************************************************************* # This file implements regression tests for SQLite library. The # focus of this script is testing the ATTACH statement and # specifically out-of-memory conditions within that command. # # $Id: attachmalloc.test,v 1.4 2007/08/25 13:37:49 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl source $testdir/malloc_common.tcl do_malloc_test attachmalloc-1 -tclprep { db close for {set i 2} {$i<=4} {incr i} { file delete -force test$i.db file delete -force test$i.db-journal } |
︙ | ︙ |
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.53 2007/08/25 13:37:49 danielk1977 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. |
︙ | ︙ | |||
746 747 748 749 750 751 752 | set test_number 1 foreach {code english} $code2english { do_test capi3-9.$test_number "sqlite3_test_errstr $code" $english incr test_number } # Test the error message when a "real" out of memory occurs. | | < | | | | | | | | | | | | | | | | | | | 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 | set test_number 1 foreach {code english} $code2english { do_test capi3-9.$test_number "sqlite3_test_errstr $code" $english incr test_number } # Test the error message when a "real" out of memory occurs. if {[info command sqlite3_memdebug_fail]!=""} { do_test capi3-10-1 { sqlite3 db test.db set DB [sqlite3_connection_pointer db] sqlite3_memdebug_fail 0 0 catchsql { select * from sqlite_master; } } {1 {out of memory}} do_test capi3-10-2 { sqlite3_errmsg $::DB } {out of memory} ifcapable {utf16} { do_test capi3-10-3 { utf8 [sqlite3_errmsg16 $::DB] } {out of memory} } db close sqlite3_memdebug_fail -1 0 } # The following tests - capi3-11.* - test that a COMMIT or ROLLBACK # statement issued while there are still outstanding VMs that are part of # the transaction fails. sqlite3 db test.db set DB [sqlite3_connection_pointer db] |
︙ | ︙ |
Changes to test/capi3c.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This is a copy of the capi3.test file that has been adapted to # test the new sqlite3_prepare_v2 interface. # | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This is a copy of the capi3.test file that has been adapted to # test the new sqlite3_prepare_v2 interface. # # $Id: capi3c.test,v 1.10 2007/08/25 13:37:49 danielk1977 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. |
︙ | ︙ | |||
741 742 743 744 745 746 747 | set test_number 1 foreach {code english} $code2english { do_test capi3c-9.$test_number "sqlite3_test_errstr $code" $english incr test_number } # Test the error message when a "real" out of memory occurs. | | < | | | | | | | | | | | | | | | | | | | 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 | set test_number 1 foreach {code english} $code2english { do_test capi3c-9.$test_number "sqlite3_test_errstr $code" $english incr test_number } # Test the error message when a "real" out of memory occurs. if {[info command sqlite3_memdebug_fail]!=""} { do_test capi3c-10-1 { sqlite3 db test.db set DB [sqlite3_connection_pointer db] sqlite3_memdebug_fail 0 0 catchsql { select * from sqlite_master; } } {1 {out of memory}} do_test capi3c-10-2 { sqlite3_errmsg $::DB } {out of memory} ifcapable {utf16} { do_test capi3c-10-3 { utf8 [sqlite3_errmsg16 $::DB] } {out of memory} } db close sqlite3_memdebug_fail -1 0 } # The following tests - capi3c-11.* - test that a COMMIT or ROLLBACK # statement issued while there are still outstanding VMs that are part of # the transaction fails. sqlite3 db test.db set DB [sqlite3_connection_pointer db] |
︙ | ︙ |
Changes to test/fuzz_malloc.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # # This file tests malloc failures in concert with fuzzy SQL generation. # | | < < < < < < < < | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # # This file tests malloc failures in concert with fuzzy SQL generation. # # $Id: fuzz_malloc.test,v 1.6 2007/08/25 13:37:49 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl source $testdir/malloc_common.tcl source $testdir/fuzz_common.tcl if {[info exists ISQUICK]} { set ::REPEATS 20 } elseif {[info exists SOAKTEST]} { set ::REPEATS 100 } else { set ::REPEATS 40 |
︙ | ︙ | |||
44 45 46 47 48 49 50 | # -repeats # proc do_fuzzy_malloc_test {testname args} { set ::fuzzyopts(-repeats) $::REPEATS set ::fuzzyopts(-sqlprep) {} array set ::fuzzyopts $args | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | # -repeats # proc do_fuzzy_malloc_test {testname args} { set ::fuzzyopts(-repeats) $::REPEATS set ::fuzzyopts(-sqlprep) {} array set ::fuzzyopts $args sqlite3_memdebug_fail -1 0 db close file delete test.db test.db-journal sqlite3 db test.db set ::prep $::fuzzyopts(-sqlprep) execsql $::prep set jj 0 for {set ii 0} {$ii < $::fuzzyopts(-repeats)} {incr ii} { |
︙ | ︙ | |||
89 90 91 92 93 94 95 | set ::TableList [list abc def ghi] set ::ColumnList [list a b c] do_fuzzy_malloc_test fuzzy_malloc-3 \ -template {[Select]} \ -sqlprep $::SQLPREP | | | 81 82 83 84 85 86 87 88 89 | set ::TableList [list abc def ghi] set ::ColumnList [list a b c] do_fuzzy_malloc_test fuzzy_malloc-3 \ -template {[Select]} \ -sqlprep $::SQLPREP sqlite3_memdebug_fail -1 0 finish_test |
Changes to test/shared_err.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # # 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? # | | > < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # #*********************************************************************** # # 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.12 2007/08/25 13:37:49 danielk1977 Exp $ proc skip {args} {} set testdir [file dirname $argv0] source $testdir/tester.tcl source $testdir/malloc_common.tcl db close ifcapable !shared_cache||!subquery { finish_test return } set ::enable_shared_cache [sqlite3_enable_shared_cache 1] do_ioerr_test shared_ioerr-1 -tclprep { sqlite3 db2 test.db execsql { PRAGMA read_uncommitted = 1; CREATE TABLE t1(a,b,c); BEGIN; |
︙ | ︙ |
Changes to test/vtab_err.test.
1 2 3 4 5 6 7 8 9 10 11 | # 2006 June 10 # # 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 20 21 22 23 24 25 26 27 28 29 30 | # 2006 June 10 # # 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: vtab_err.test,v 1.6 2007/08/25 13:37:49 danielk1977 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 { BEGIN; CREATE TABLE r(a PRIMARY KEY, b, c); CREATE VIRTUAL TABLE e USING echo(r); |
︙ | ︙ | |||
160 161 162 163 164 165 166 | BEGIN; CREATE TABLE r2(a, b, c); INSERT INTO r2 SELECT * FROM e; INSERT INTO e SELECT a||'x', b, c FROM r2; COMMIT; } | > | | 54 55 56 57 58 59 60 61 62 63 | BEGIN; CREATE TABLE r2(a, b, c); INSERT INTO r2 SELECT * FROM e; INSERT INTO e SELECT a||'x', b, c FROM r2; COMMIT; } sqlite3_memdebug_fail -1 0 finish_test |