/ Check-in [d1a87c3b]
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 a test case in mutex1.test that was failing when sqlite was compiled with SQLITE_THREADSAFE=0. (CVS 5235)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d1a87c3bcc9a32918f1cf743f85cd1a71557220e
User & Date: danielk1977 2008-06-18 17:59:04
Context
2008-06-18
18:08
Add a call to sqlite3_initialize() to sqlite3_mutex_alloc() (CVS 5236) check-in: 8b23b719 user: danielk1977 tags: trunk
17:59
Fix a test case in mutex1.test that was failing when sqlite was compiled with SQLITE_THREADSAFE=0. (CVS 5235) check-in: d1a87c3b user: danielk1977 tags: trunk
17:09
Implement the 'CONFIG_SINGLETHREAD' and 'CONFIG_MULTITHREAD' configuration modes. (CVS 5234) check-in: 5059644c user: danielk1977 tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/mutex1.test.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
..
80
81
82
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
112
113
114
115
116
117

118
119
120
121
122
123
124

125
126
127
128
#
#    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: mutex1.test,v 1.2 2008/06/18 17:09:10 danielk1977 Exp $

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

proc mutex_counters {varname} {
  upvar $varname var
  set var(total) 0
................................................................................
# can be selected using sqlite3_config:
#
#   * Serialized mode,
#   * Multi-threaded mode,
#   * Single-threaded mode.
#


foreach {mode mutexes} {
  singlethread {}
  multithread  {fast static_master static_mem static_prng}
  serialized   {fast recursive static_master static_mem static_prng}
} {
  do_test mutex1.2.$mode.1 {
    catch {db close}
    sqlite3_shutdown
    sqlite3_config $mode
  } SQLITE_OK

  do_test mutex1.2.$mode.2 {
    clear_mutex_counters
    sqlite3 db test.db
    catchsql { CREATE TABLE abc(a, b, c) }
    db eval {
      INSERT INTO abc VALUES(1, 2, 3);
    }
  } {}

  do_test mutex1.2.$mode.3 {
    mutex_counters counters

    set res [list]
    foreach {key value} [array get counters] {
      if {$key ne "total" && $value > 0} {
        lappend res $key
      }
    }
    lsort $res
  } $mutexes

}

do_test mutex1-X {
  db close
  sqlite3_shutdown
  clear_mutex_counters
  install_mutex_counters 0

} {SQLITE_OK}

finish_test








|







 







>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>



|



>




5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
..
80
81
82
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#
#    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: mutex1.test,v 1.3 2008/06/18 17:59:04 danielk1977 Exp $

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

proc mutex_counters {varname} {
  upvar $varname var
  set var(total) 0
................................................................................
# can be selected using sqlite3_config:
#
#   * Serialized mode,
#   * Multi-threaded mode,
#   * Single-threaded mode.
#

ifcapable threadsafe {
  foreach {mode mutexes} {
    singlethread {}
    multithread  {fast static_master static_mem static_prng}
    serialized   {fast recursive static_master static_mem static_prng}
  } {
    do_test mutex1.2.$mode.1 {
      catch {db close}
      sqlite3_shutdown
      sqlite3_config $mode
    } SQLITE_OK
  
    do_test mutex1.2.$mode.2 {
      clear_mutex_counters
      sqlite3 db test.db
      catchsql { CREATE TABLE abc(a, b, c) }
      db eval {
        INSERT INTO abc VALUES(1, 2, 3);
      }
    } {}
  
    do_test mutex1.2.$mode.3 {
      mutex_counters counters
  
      set res [list]
      foreach {key value} [array get counters] {
        if {$key ne "total" && $value > 0} {
          lappend res $key
        }
      }
      lsort $res
    } $mutexes
  }
}

do_test mutex1-X {
  catch {db close}
  sqlite3_shutdown
  clear_mutex_counters
  install_mutex_counters 0
  sqlite3_initialize
} {SQLITE_OK}

finish_test