SQLite

Check-in [7d4cdff444]
Login

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

Overview
Comment:Fix the test labels in mallocC.test. (CVS 4212)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7d4cdff444b98b76a34bd85d0a43cda28e7dffe4
User & Date: drh 2007-08-13 12:58:18.000
Context
2007-08-13
14:41
When loading a database schema, do not clear the SQLITE_InternChanges flag. This fixes the problem illustrated by (4211). (CVS 4213) (check-in: 540a7b28bc user: danielk1977 tags: trunk)
12:58
Fix the test labels in mallocC.test. (CVS 4212) (check-in: 7d4cdff444 user: drh tags: trunk)
12:39
Add a new test cases for a problem with malloc failure during the parsing of CREATE TABLE statements in autovacuum mode. (CVS 4211) (check-in: be50387e65 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/mallocC.test.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# 
# This file tests aspects of the malloc failure while parsing
# CREATE TABLE statements in auto_vacuum mode.
#
# $Id: mallocC.test,v 1.1 2007/08/13 12:39:04 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Only run these tests if memory debugging is turned on.
#
if {[info command sqlite_malloc_stat]==""} {







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# 
# This file tests aspects of the malloc failure while parsing
# CREATE TABLE statements in auto_vacuum mode.
#
# $Id: mallocC.test,v 1.2 2007/08/13 12:58:18 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Only run these tests if memory debugging is turned on.
#
if {[info command sqlite_malloc_stat]==""} {
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
  set sum [cksum db]

  for {set ::n 1} {true} {incr ::n} {

    # Run the SQL. Malloc number $::n is set to fail. A malloc() failure
    # may or may not be reported.
    sqlite_malloc_fail $::n
    do_test malloc2shl-$tn.$::n.1 {
      set res [catchsql [string trim $::mallocopts(-sql)]]
      set rc [expr { 
        0==[string compare $res {1 {out of memory}}] ||
        0==[lindex $res 0]
      }]
      if {$rc!=1} {
        puts "Error: $res"







|







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
  set sum [cksum db]

  for {set ::n 1} {true} {incr ::n} {

    # Run the SQL. Malloc number $::n is set to fail. A malloc() failure
    # may or may not be reported.
    sqlite_malloc_fail $::n
    do_test mallocC-$tn.$::n.1 {
      set res [catchsql [string trim $::mallocopts(-sql)]]
      set rc [expr { 
        0==[string compare $res {1 {out of memory}}] ||
        0==[lindex $res 0]
      }]
      if {$rc!=1} {
        puts "Error: $res"
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111

    # Recover from the malloc failure.
    #
    # Update: The new malloc() failure handling means that a transaction may
    # still be active even if a malloc() has failed. But when these tests were
    # written this was not the case. So do a manual ROLLBACK here so that the
    # tests pass.
    do_test malloc2shl-$tn.$::n.2 {
      catch {
        execsql {
          ROLLBACK;
        }
      }
      expr 0
    } {0}

    # Checksum the database.
    #do_test malloc2shl-$tn.$::n.3 {
    #  cksum db
    #} $sum

    #integrity_check malloc2shl-$tn.$::n.4
  if {$::nErr>1} return
  }
  unset ::mallocopts
}

execsql {
  PRAGMA auto_vacuum=1;







|









|



|







83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111

    # Recover from the malloc failure.
    #
    # Update: The new malloc() failure handling means that a transaction may
    # still be active even if a malloc() has failed. But when these tests were
    # written this was not the case. So do a manual ROLLBACK here so that the
    # tests pass.
    do_test mallocC-$tn.$::n.2 {
      catch {
        execsql {
          ROLLBACK;
        }
      }
      expr 0
    } {0}

    # Checksum the database.
    #do_test mallocC-$tn.$::n.3 {
    #  cksum db
    #} $sum

    #integrity_check mallocC-$tn.$::n.4
  if {$::nErr>1} return
  }
  unset ::mallocopts
}

execsql {
  PRAGMA auto_vacuum=1;