/ Check-in [ddadc25d]
Login

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

Overview
Comment:Make sure the finished() array in thread005.test is cleared before the script starts. (CVS 6351)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:ddadc25d550efd56e319bf5508c27d66e346be1b
User & Date: drh 2009-03-16 17:07:57
Context
2009-03-17
15:39
Fix test script bugs in the thread002.test and thread_common.tcl. (CVS 6352) check-in: d137e841 user: drh tags: trunk
2009-03-16
17:07
Make sure the finished() array in thread005.test is cleared before the script starts. (CVS 6351) check-in: ddadc25d user: drh tags: trunk
14:48
Modify quick.test to support the QUICKTEST_INCLUDE environment variable, which can be used to override the built-in EXCLUDE list. (CVS 6350) check-in: fdfe22f0 user: danielk1977 tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/thread002.test.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#    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.6 2009/02/12 17:06:41 drh Exp $

set testdir [file dirname $argv0]

source $testdir/tester.tcl
source $testdir/thread_common.tcl
if {[info commands sqlthread] eq ""} {
  finish_test
................................................................................

# Wait for all threads to finish,  then check they all returned "OK".
#
for {set i 0} {$i < $::NTHREAD} {incr i} {
  if {![info exists finished($i)]} {
    vwait finished($i)
  }
  do_test thread001.2.$i {
    set ::finished($i)
  } OK
}

# Check all three databases are Ok.
for {set ii 0} {$ii < 3} {incr ii} {
  do_test thread002.3.$ii {







|







 







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#    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.7 2009/03/16 17:07:57 drh Exp $

set testdir [file dirname $argv0]

source $testdir/tester.tcl
source $testdir/thread_common.tcl
if {[info commands sqlthread] eq ""} {
  finish_test
................................................................................

# Wait for all threads to finish,  then check they all returned "OK".
#
for {set i 0} {$i < $::NTHREAD} {incr i} {
  if {![info exists finished($i)]} {
    vwait finished($i)
  }
  do_test thread002.2.$i {
    set ::finished($i)
  } OK
}

# Check all three databases are Ok.
for {set ii 0} {$ii < 3} {incr ii} {
  do_test thread002.3.$ii {

Changes to test/thread005.test.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
76
77
78
79
80
81
82

83
84
85
86
87
88
89
...
167
168
169
170
171
172
173
174
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
#
# Test a race-condition that shows up in shared-cache mode.
#
# $Id: thread005.test,v 1.1 2009/03/12 14:43:28 danielk1977 Exp $

set testdir [file dirname $argv0]

source $testdir/tester.tcl
ifcapable !mutex||!shared_cache {
  return
}
................................................................................
# Use shared-cache mode for this test.
# 
db close
set ::enable_shared_cache [sqlite3_enable_shared_cache]
sqlite3_enable_shared_cache 1

file delete -force test.db test2.db


do_test thread005-1.1 {
  sqlite3 db test.db
  execsql { ATTACH 'test2.db' AS aux }
  execsql {
    CREATE TABLE aux.t1(a INTEGER PRIMARY KEY, b UNIQUE);
    INSERT INTO t1 VALUES(1, 1);
................................................................................
  sqlite3 db test.db
  execsql { ATTACH 'test2.db' AS aux }
  execsql { SELECT count(*) FROM t1 WHERE b IS NULL }
} {0}

sqlite3_enable_shared_cache $::enable_shared_cache
finish_test








|







 







>







 







<
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
...
168
169
170
171
172
173
174

#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
#
# Test a race-condition that shows up in shared-cache mode.
#
# $Id: thread005.test,v 1.2 2009/03/16 17:07:57 drh Exp $

set testdir [file dirname $argv0]

source $testdir/tester.tcl
ifcapable !mutex||!shared_cache {
  return
}
................................................................................
# Use shared-cache mode for this test.
# 
db close
set ::enable_shared_cache [sqlite3_enable_shared_cache]
sqlite3_enable_shared_cache 1

file delete -force test.db test2.db
unset -nocomplain finished

do_test thread005-1.1 {
  sqlite3 db test.db
  execsql { ATTACH 'test2.db' AS aux }
  execsql {
    CREATE TABLE aux.t1(a INTEGER PRIMARY KEY, b UNIQUE);
    INSERT INTO t1 VALUES(1, 1);
................................................................................
  sqlite3 db test.db
  execsql { ATTACH 'test2.db' AS aux }
  execsql { SELECT count(*) FROM t1 WHERE b IS NULL }
} {0}

sqlite3_enable_shared_cache $::enable_shared_cache
finish_test