SQLite

Check-in [416288a9fa]
Login

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

Overview
Comment:Ensure that thread001.test and thread002.test reset the global shared-cache-enabled setting before they finish. (CVS 6253)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 416288a9fa39c7c4d9d414de18edc0423ed83794
User & Date: danielk1977 2009-02-04 11:57:46.000
Context
2009-02-04
15:27
Fix a bug in test_malloc.c whereby running multi-threaded test cases could cause subsequent OOM tests to fail. (CVS 6254) (check-in: 03ea9e5913 user: danielk1977 tags: trunk)
11:57
Ensure that thread001.test and thread002.test reset the global shared-cache-enabled setting before they finish. (CVS 6253) (check-in: 416288a9fa user: danielk1977 tags: trunk)
10:09
Do not attempt to use the sub-journal file descriptor if it is not opened (as in journal_mode=off mode). Ticket #3636. (CVS 6252) (check-in: 20bd760554 user: danielk1977 tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/thread001.test.
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
# 2007 September 7
#
# 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: thread001.test,v 1.7 2009/01/19 17:40:12 drh Exp $

set testdir [file dirname $argv0]

source $testdir/tester.tcl
ifcapable !mutex {
  return
}
source $testdir/thread_common.tcl
if {[info commands sqlthread] eq ""} {
  return
}



set ::NTHREAD 10

# Run this test three times: 
# 
#    1) All threads use the same database handle.
#    2) All threads use their own database handles.











|











>
>







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
# 2007 September 7
#
# 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: thread001.test,v 1.8 2009/02/04 11:57:46 danielk1977 Exp $

set testdir [file dirname $argv0]

source $testdir/tester.tcl
ifcapable !mutex {
  return
}
source $testdir/thread_common.tcl
if {[info commands sqlthread] eq ""} {
  return
}

set ::enable_shared_cache [sqlite3_enable_shared_cache]

set ::NTHREAD 10

# Run this test three times: 
# 
#    1) All threads use the same database handle.
#    2) All threads use their own database handles.
140
141
142
143
144
145
146

147
    }
  } {1}
  do_test thread001.$tn.7 {
    execsql { PRAGMA integrity_check }
  } {ok}
}


finish_test







>

142
143
144
145
146
147
148
149
150
    }
  } {1}
  do_test thread001.$tn.7 {
    execsql { PRAGMA integrity_check }
  } {ok}
}

sqlite3_enable_shared_cache $::enable_shared_cache
finish_test
Changes to test/thread002.test.
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
#    May you share freely, never taking more than you give.
#
#***********************************************************************
#
#   This test attempts to deadlock SQLite in shared-cache mode.
#     
#
# $Id: thread002.test,v 1.4 2008/10/07 15:25:49 drh Exp $

set testdir [file dirname $argv0]

source $testdir/tester.tcl
source $testdir/thread_common.tcl
if {[info commands sqlthread] eq ""} {
  finish_test
  return
}
ifcapable !attach||!mutex { 
  finish_test
  return
}

db close
sqlite3_enable_shared_cache 1

set ::NTHREAD 10

do_test thread002.1 {
  # Create 3 databases with identical schemas:
  for {set ii 0} {$ii < 3} {incr ii} {
    file delete -force test${ii}.db







|















|







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
#    May you share freely, never taking more than you give.
#
#***********************************************************************
#
#   This test attempts to deadlock SQLite in shared-cache mode.
#     
#
# $Id: thread002.test,v 1.5 2009/02/04 11:57:46 danielk1977 Exp $

set testdir [file dirname $argv0]

source $testdir/tester.tcl
source $testdir/thread_common.tcl
if {[info commands sqlthread] eq ""} {
  finish_test
  return
}
ifcapable !attach||!mutex { 
  finish_test
  return
}

db close
set ::enable_shared_cache [sqlite3_enable_shared_cache 1]

set ::NTHREAD 10

do_test thread002.1 {
  # Create 3 databases with identical schemas:
  for {set ii 0} {$ii < 3} {incr ii} {
    file delete -force test${ii}.db
102
103
104
105
106
107
108

109
      [execsql {PRAGMA integrity_check}]  \
    ]
    db close
    set res
  } [list [expr 1 + $::NTHREAD*100] ok]
}


finish_test







>

102
103
104
105
106
107
108
109
110
      [execsql {PRAGMA integrity_check}]  \
    ]
    db close
    set res
  } [list [expr 1 + $::NTHREAD*100] ok]
}

sqlite3_enable_shared_cache $::enable_shared_cache
finish_test