/ Check-in [d1a87c3b]
Login

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 Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/mutex1.test.

     5      5   #
     6      6   #    May you do good and not evil.
     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   #
    12         -# $Id: mutex1.test,v 1.2 2008/06/18 17:09:10 danielk1977 Exp $
           12  +# $Id: mutex1.test,v 1.3 2008/06/18 17:59:04 danielk1977 Exp $
    13     13   
    14     14   set testdir [file dirname $argv0]
    15     15   source $testdir/tester.tcl
    16     16   
    17     17   proc mutex_counters {varname} {
    18     18     upvar $varname var
    19     19     set var(total) 0
................................................................................
    80     80   # can be selected using sqlite3_config:
    81     81   #
    82     82   #   * Serialized mode,
    83     83   #   * Multi-threaded mode,
    84     84   #   * Single-threaded mode.
    85     85   #
    86     86   
    87         -foreach {mode mutexes} {
    88         -  singlethread {}
    89         -  multithread  {fast static_master static_mem static_prng}
    90         -  serialized   {fast recursive static_master static_mem static_prng}
    91         -} {
    92         -  do_test mutex1.2.$mode.1 {
    93         -    catch {db close}
    94         -    sqlite3_shutdown
    95         -    sqlite3_config $mode
    96         -  } SQLITE_OK
    97         -
    98         -  do_test mutex1.2.$mode.2 {
    99         -    clear_mutex_counters
   100         -    sqlite3 db test.db
   101         -    catchsql { CREATE TABLE abc(a, b, c) }
   102         -    db eval {
   103         -      INSERT INTO abc VALUES(1, 2, 3);
   104         -    }
   105         -  } {}
   106         -
   107         -  do_test mutex1.2.$mode.3 {
   108         -    mutex_counters counters
   109         -
   110         -    set res [list]
   111         -    foreach {key value} [array get counters] {
   112         -      if {$key ne "total" && $value > 0} {
   113         -        lappend res $key
           87  +ifcapable threadsafe {
           88  +  foreach {mode mutexes} {
           89  +    singlethread {}
           90  +    multithread  {fast static_master static_mem static_prng}
           91  +    serialized   {fast recursive static_master static_mem static_prng}
           92  +  } {
           93  +    do_test mutex1.2.$mode.1 {
           94  +      catch {db close}
           95  +      sqlite3_shutdown
           96  +      sqlite3_config $mode
           97  +    } SQLITE_OK
           98  +  
           99  +    do_test mutex1.2.$mode.2 {
          100  +      clear_mutex_counters
          101  +      sqlite3 db test.db
          102  +      catchsql { CREATE TABLE abc(a, b, c) }
          103  +      db eval {
          104  +        INSERT INTO abc VALUES(1, 2, 3);
          105  +      }
          106  +    } {}
          107  +  
          108  +    do_test mutex1.2.$mode.3 {
          109  +      mutex_counters counters
          110  +  
          111  +      set res [list]
          112  +      foreach {key value} [array get counters] {
          113  +        if {$key ne "total" && $value > 0} {
          114  +          lappend res $key
          115  +        }
   114    116         }
   115         -    }
   116         -    lsort $res
   117         -  } $mutexes
          117  +      lsort $res
          118  +    } $mutexes
          119  +  }
   118    120   }
   119    121   
   120    122   do_test mutex1-X {
   121         -  db close
          123  +  catch {db close}
   122    124     sqlite3_shutdown
   123    125     clear_mutex_counters
   124    126     install_mutex_counters 0
          127  +  sqlite3_initialize
   125    128   } {SQLITE_OK}
   126    129   
   127    130   finish_test
   128    131