/ Check-in [5a82620e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add a test to mallocI.test to show that a shared lock is correctly released if an OOM condition occurs while parsing a database schema. (CVS 6951)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5a82620efa1298530760e69e4e34d446a30233b8
User & Date: danielk1977 2009-07-29 06:04:57
Context
2009-07-31
06:14
Fix a bug in where.c that could cause SQLite to write to freed memory while compiling a query with many terms in the WHERE clause. (CVS 6952) check-in: 8161af84 user: danielk1977 tags: trunk
2009-07-29
06:04
Add a test to mallocI.test to show that a shared lock is correctly released if an OOM condition occurs while parsing a database schema. (CVS 6951) check-in: 5a82620e user: danielk1977 tags: trunk
2009-07-28
16:44
Add the experimental API sqlite3_strnicmp(). Modify fts3 so that in terms like 'column_name:token' the column_name is interpreted in a case-insenstive fashion. Ticket #3996. (CVS 6950) check-in: 4571aa9e user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/mallocI.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   #
    12     12   # This test script checks malloc failures in various obscure operations.
    13     13   # 
    14         -# $Id: mallocI.test,v 1.1 2008/08/02 03:50:39 drh Exp $
           14  +# $Id: mallocI.test,v 1.2 2009/07/29 06:04:57 danielk1977 Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   source $testdir/malloc_common.tcl
    19     19   
    20     20   # Malloc failures in a view.
    21     21   #
................................................................................
    35     35   # Malloc failure while creating a table from a SELECT statement.
    36     36   #
    37     37   do_malloc_test mallocI-3 -sqlprep {
    38     38     CREATE TABLE t1(a,b,c);
    39     39   } -sqlbody {
    40     40     CREATE TABLE t2 AS SELECT b,c FROM t1;
    41     41   }
           42  +
           43  +# This tests that a malloc failure that occurs while passing the schema
           44  +# does not result in a SHARED lock being left on the database file.
           45  +#
           46  +do_malloc_test mallocI-4 -tclprep {
           47  +  sqlite3 db2 test.db
           48  +  db2 eval {
           49  +    CREATE TABLE t1(a, b, c);
           50  +    CREATE TABLE t2(a, b, c);
           51  +  }
           52  +} -sqlbody {
           53  +  SELECT * FROM t1
           54  +} -cleanup {
           55  +  do_test mallocI-4.$::n.2 {
           56  +    # If this INSERT is possible then [db] does not hold a shared lock
           57  +    # on the database file.
           58  +    catchsql { INSERT INTO t1 VALUES(1, 2, 3) } db2
           59  +  } {0 {}}
           60  +}
    42     61   
    43     62   finish_test