Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix bugs in the altermalloc.test and incrblob_err.test scripts. (CVS 4295) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
e5ec17071720a973bbd213a8b23038d3 |
User & Date: | danielk1977 2007-08-25 13:09:26.000 |
Context
2007-08-25
| ||
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) | |
12:39 | Update the async2.test test script to use the new malloc() failure simulation interface. (CVS 4294) (check-in: 686fcfeda4 user: danielk1977 tags: trunk) | |
Changes
Changes to src/alter.c.
︙ | ︙ | |||
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 contains C code routines that used to generate VDBE code ** that implements the ALTER TABLE command. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that used to generate VDBE code ** that implements the ALTER TABLE command. ** ** $Id: alter.c,v 1.30 2007/08/25 13:09:26 danielk1977 Exp $ */ #include "sqliteInt.h" #include <ctype.h> /* ** The code in this file only exists if we are not omitting the ** ALTER TABLE logic from the build. |
︙ | ︙ | |||
583 584 585 586 587 588 589 | if( !pNew ) goto exit_begin_add_column; pParse->pNewTable = pNew; pNew->nRef = 1; pNew->nCol = pTab->nCol; assert( pNew->nCol>0 ); nAlloc = (((pNew->nCol-1)/8)*8)+8; assert( nAlloc>=pNew->nCol && nAlloc%8==0 && nAlloc-pNew->nCol<8 ); | | | 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 | if( !pNew ) goto exit_begin_add_column; pParse->pNewTable = pNew; pNew->nRef = 1; pNew->nCol = pTab->nCol; assert( pNew->nCol>0 ); nAlloc = (((pNew->nCol-1)/8)*8)+8; assert( nAlloc>=pNew->nCol && nAlloc%8==0 && nAlloc-pNew->nCol<8 ); pNew->aCol = (Column*)sqlite3MallocZero(sizeof(Column)*nAlloc); pNew->zName = sqlite3DbStrDup(db, pTab->zName); if( !pNew->aCol || !pNew->zName ){ db->mallocFailed = 1; goto exit_begin_add_column; } memcpy(pNew->aCol, pTab->aCol, sizeof(Column)*pNew->nCol); for(i=0; i<pNew->nCol; i++){ |
︙ | ︙ |
Changes to test/altermalloc.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 ALTER TABLE 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 29 30 31 32 33 34 | # 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 ALTER TABLE statement and # specifically out-of-memory conditions within that command. # # $Id: altermalloc.test,v 1.4 2007/08/25 13:09:26 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # If SQLITE_OMIT_ALTERTABLE is defined, omit this file. ifcapable !altertable { finish_test return } source $testdir/malloc_common.tcl do_malloc_test altermalloc-1 -tclprep { db close } -tclbody { if {[catch {sqlite3 db test.db}]} { error "out of memory" } |
︙ | ︙ |
Changes to test/incrblob_err.test.
1 2 3 4 5 6 7 8 9 10 11 | # 2007 May 1 # # 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 31 32 33 34 35 36 37 38 | # 2007 May 1 # # 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: incrblob_err.test,v 1.4 2007/08/25 13:09:26 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable {!incrblob} { finish_test return } # Only run these tests if memory debugging is turned on. # if {[info command sqlite3_memdebug_fail]==""} { puts "Skipping incrblob_err tests: not compiled with -DSQLITE_MEMDEBUG..." finish_test return } source $testdir/malloc_common.tcl set ::fd [open [info script]] set ::data [read $::fd] close $::fd do_malloc_test 1 -tclprep { set bytes [file size [info script]] |
︙ | ︙ | |||
169 170 171 172 173 174 175 | error "Bad data read..." } set rc [catch {close $::blob}] if {$rc} { error "out of memory" } } | | | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | error "Bad data read..." } set rc [catch {close $::blob}] if {$rc} { error "out of memory" } } sqlite3_memdebug_fail -1 0 do_ioerr_test incrblob_err-4 -cksum 1 -sqlprep { CREATE TABLE blobs(k, v BLOB); INSERT INTO blobs VALUES(1, $::data); } -tclbody { set ::blob [db incrblob blobs v 1] read $::blob |
︙ | ︙ |
Changes to test/malloc_common.tcl.
1 2 3 4 5 6 7 | # Usage: do_malloc_test <test number> <options...> # # The first argument, <test number>, is an integer used to name the # tests executed by this proc. Options are as follows: # # -tclprep TCL script to run to prepare test. | > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 | ifcapable !memdebug { puts "Skipping malloc tests: not compiled with -DSQLITE_MEMDEBUG..." finish_test return } # Usage: do_malloc_test <test number> <options...> # # The first argument, <test number>, is an integer used to name the # tests executed by this proc. Options are as follows: # # -tclprep TCL script to run to prepare test. |
︙ | ︙ |