/ Check-in [3b8f9dec]
Login

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

Overview
Comment:Disable the new malloc-37 test when locking_mode==exclusive. The test basically works, but sometimes reports "database is locked" instead of "out of memory" and that messes up the error reporting. (CVS 6811)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:3b8f9dec24d06865455a75587bbfc199c19c6215
User & Date: drh 2009-06-24 13:13:45
Context
2009-06-24
13:16
Remove an ALWAYS() macro from vdbe.c that sometimes fails on thread tests. (CVS 6812) check-in: 52eac078 user: drh tags: trunk
13:13
Disable the new malloc-37 test when locking_mode==exclusive. The test basically works, but sometimes reports "database is locked" instead of "out of memory" and that messes up the error reporting. (CVS 6811) check-in: 3b8f9dec user: drh tags: trunk
11:08
Remove a declaration of the sqlite3Assert() function that was deleted by the previous check-in. (CVS 6810) check-in: ee20b6a2 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/malloc.test.

    12     12   # This file attempts to check the behavior of the SQLite library in 
    13     13   # an out-of-memory situation. When compiled with -DSQLITE_DEBUG=1, 
    14     14   # the SQLite library accepts a special command (sqlite3_memdebug_fail N C)
    15     15   # which causes the N-th malloc to fail.  This special feature is used
    16     16   # to see what happens in the library if a malloc were to really fail
    17     17   # due to an out-of-memory situation.
    18     18   #
    19         -# $Id: malloc.test,v 1.80 2009/06/22 05:43:24 danielk1977 Exp $
           19  +# $Id: malloc.test,v 1.81 2009/06/24 13:13:45 drh Exp $
    20     20   
    21     21   set testdir [file dirname $argv0]
    22     22   source $testdir/tester.tcl
    23     23   
    24     24   
    25     25   # Only run these tests if memory debugging is turned on.
    26     26   #
................................................................................
   839    839     INSERT INTO t1 VALUES(3, 4);
   840    840   } -sqlbody {
   841    841     SELECT test_agg_errmsg16(), group_concat(a) FROM t1
   842    842   }
   843    843   
   844    844   # At one point, if an OOM occured immediately after obtaining a shared lock
   845    845   # on the database file, the file remained locked. This test case ensures
   846         -# that bug has been fixed.
   847         -do_malloc_test 36 -tclprep {
   848         -  sqlite3 db2 test.db
   849         -  execsql {
   850         -    CREATE TABLE t1(a, b);
   851         -    INSERT INTO t1 VALUES(1, 2);
   852         -  } db2
   853         -} -sqlbody {
   854         -  SELECT * FROM t1;
   855         -} -cleanup {
   856         -  # Try to write to the database using connection [db2]. If connection [db]
   857         -  # has correctly released the shared lock, this write attempt should 
   858         -  # succeed. If [db] has not released the lock, this should hit an 
   859         -  # SQLITE_BUSY error.
   860         -  do_test malloc-36.$zRepeat.${::n}.unlocked {
   861         -    execsql {INSERT INTO t1 VALUES(3, 4)} db2
   862         -  } {}
   863         -  db2 close
   864         -}
   865         -catch { db2 close }
          846  +# that bug has been fixed.i
          847  +if {[db eval {PRAGMA locking_mode}]!="exclusive"} {
          848  +  do_malloc_test 37 -tclprep {
          849  +    sqlite3 db2 test.db
          850  +    execsql {
          851  +      CREATE TABLE t1(a, b);
          852  +      INSERT INTO t1 VALUES(1, 2);
          853  +    } db2
          854  +  } -sqlbody {
          855  +    SELECT * FROM t1;
          856  +  } -cleanup {
          857  +    # Try to write to the database using connection [db2]. If connection [db]
          858  +    # has correctly released the shared lock, this write attempt should 
          859  +    # succeed. If [db] has not released the lock, this should hit an 
          860  +    # SQLITE_BUSY error.
          861  +    do_test malloc-36.$zRepeat.${::n}.unlocked {
          862  +      execsql {INSERT INTO t1 VALUES(3, 4)} db2
          863  +    } {}
          864  +    db2 close
          865  +  }
          866  +  catch { db2 close }
          867  +}
   866    868   
   867    869   # Ensure that no file descriptors were leaked.
   868    870   do_test malloc-99.X {
   869    871     catch {db close}
   870    872     set sqlite_open_file_count
   871    873   } {0}
   872    874   
   873    875   puts open-file-count=$sqlite_open_file_count
   874    876   finish_test