SQLite

Check-in [686fcfeda4]
Login

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

Overview
Comment:Update the async2.test test script to use the new malloc() failure simulation interface. (CVS 4294)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 686fcfeda407c29cdb51fe814da616f1ccac5414
User & Date: danielk1977 2007-08-25 12:39:29.000
Context
2007-08-25
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)
12:29
Make the test_async backend work again. (CVS 4293) (check-in: 04167483aa user: danielk1977 tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/async2.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
#    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: async2.test,v 1.4 2007/08/25 12:29:30 danielk1977 Exp $


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

if {
  [info commands sqlite3async_enable]=="" ||
  [info command sqlite_malloc_stat]==""
} {
  # The async logic is not built into this system
  puts "Skipping async2 tests: not compiled with required features"
  finish_test
  return
}








|







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
#    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: async2.test,v 1.5 2007/08/25 12:39:29 danielk1977 Exp $


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

if {
  [info commands sqlite3async_enable]=="" ||
  [info command sqlite3_memdebug_fail]==""
} {
  # The async logic is not built into this system
  puts "Skipping async2 tests: not compiled with required features"
  finish_test
  return
}

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
db close


foreach err [list ioerr malloc] {
  set ::go 1
  for {set n 1} {$::go} {incr n} {
    set ::sqlite_io_error_pending 0
    sqlite_malloc_fail 0
    file delete -force test.db test.db-journal
    sqlite3 db test.db
    execsql $::setup_script
    db close
  
    sqlite3async_enable 1
    sqlite3 db test.db
    execsql $::sql_script
    db close
  
    switch -- $err {
      ioerr  { set ::sqlite_io_error_pending $n }
      malloc { sqlite_malloc_fail $n }
    }
    sqlite3async_halt idle
    sqlite3async_start
    sqlite3async_wait
  
    set ::sqlite_io_error_pending 0
    sqlite_malloc_fail 0

    sqlite3 db test.db
    set c [db eval {SELECT c FROM counter LIMIT 1}]
    switch -- $c {
      1 {
        do_test async-$err-1.1.$n {
          execsql {







|












|






|







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
db close


foreach err [list ioerr malloc] {
  set ::go 1
  for {set n 1} {$::go} {incr n} {
    set ::sqlite_io_error_pending 0
    sqlite3_memdebug_fail -1 0
    file delete -force test.db test.db-journal
    sqlite3 db test.db
    execsql $::setup_script
    db close
  
    sqlite3async_enable 1
    sqlite3 db test.db
    execsql $::sql_script
    db close
  
    switch -- $err {
      ioerr  { set ::sqlite_io_error_pending $n }
      malloc { sqlite3_memdebug_fail $n 1 }
    }
    sqlite3async_halt idle
    sqlite3async_start
    sqlite3async_wait
  
    set ::sqlite_io_error_pending 0
    sqlite3_memdebug_fail -1 0

    sqlite3 db test.db
    set c [db eval {SELECT c FROM counter LIMIT 1}]
    switch -- $c {
      1 {
        do_test async-$err-1.1.$n {
          execsql {