/ Check-in [d137e841]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Fix test script bugs in the thread002.test and thread_common.tcl. (CVS 6352)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d137e841ce90be92f4c18218f35d22e3a06b0f14
User & Date: drh 2009-03-17 15:39:31
Context
2009-03-17
17:49
Fix a problem that could cause a crash when a shared-cache schema contains column default values. (CVS 6353) check-in: afadddc3 user: danielk1977 tags: trunk
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
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
..
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#    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
................................................................................
  
    execsql { SELECT * FROM aux2.t1 }
    execsql { INSERT INTO aux2.t1(v) SELECT sum(v) FROM aux3.t1 }
  
    execsql { SELECT * FROM aux3.t1 }
    execsql { INSERT INTO aux3.t1(v) SELECT sum(v) FROM aux1.t1 }

    execsql { CREATE TABLE aux1.t2(a,b) }
    execsql { DROP TABLE aux1.t2 }

    # if {($ii%10)==0} {puts -nonewline . ; flush stdout}
    puts -nonewline . ; flush stdout
  }

  sqlite3_close $::DB
  list OK







|







 







|
|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#    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.8 2009/03/17 15:39:31 drh Exp $

set testdir [file dirname $argv0]

source $testdir/tester.tcl
source $testdir/thread_common.tcl
if {[info commands sqlthread] eq ""} {
  finish_test
................................................................................
  
    execsql { SELECT * FROM aux2.t1 }
    execsql { INSERT INTO aux2.t1(v) SELECT sum(v) FROM aux3.t1 }
  
    execsql { SELECT * FROM aux3.t1 }
    execsql { INSERT INTO aux3.t1(v) SELECT sum(v) FROM aux1.t1 }

    execsql { CREATE TABLE IF NOT EXISTS aux1.t2(a,b) }
    execsql { DROP TABLE IF EXISTS aux1.t2 }

    # if {($ii%10)==0} {puts -nonewline . ; flush stdout}
    puts -nonewline . ; flush stdout
  }

  sqlite3_close $::DB
  list OK

Changes to test/thread_common.tcl.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
..
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#
#    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: thread_common.tcl,v 1.3 2009/01/19 17:40:12 drh Exp $

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

if {[info commands sqlthread] eq ""} {
  puts -nonewline "Skipping thread-safety tests - "
  puts            " not running a threadsafe sqlite/tcl build"
................................................................................
        while {[set rc [sqlite3_step $::STMT]] eq "SQLITE_ROW"} {
          for {set i 0} {$i < [sqlite3_column_count $::STMT]} {incr i} {
            lappend res [sqlite3_column_text $::STMT 0]
          }
        }
        set rc [sqlite3_finalize $::STMT]
      } else {
        if {[string first (6) $msg]} {
          set rc SQLITE_LOCKED
        } else {
          set rc SQLITE_ERROR
        }
      }

      if {[string first locked [sqlite3_errmsg $::DB]]>=0} {







|







 







|







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
..
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#
#    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: thread_common.tcl,v 1.4 2009/03/17 15:39:31 drh Exp $

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

if {[info commands sqlthread] eq ""} {
  puts -nonewline "Skipping thread-safety tests - "
  puts            " not running a threadsafe sqlite/tcl build"
................................................................................
        while {[set rc [sqlite3_step $::STMT]] eq "SQLITE_ROW"} {
          for {set i 0} {$i < [sqlite3_column_count $::STMT]} {incr i} {
            lappend res [sqlite3_column_text $::STMT 0]
          }
        }
        set rc [sqlite3_finalize $::STMT]
      } else {
        if {[lindex $msg 0]=="(6)"} {
          set rc SQLITE_LOCKED
        } else {
          set rc SQLITE_ERROR
        }
      }

      if {[string first locked [sqlite3_errmsg $::DB]]>=0} {