First public contribution.
     3 # The author disclaims copyright to this source code.  In place of
 
     4 # a legal notice, here is a blessing:
 
     6 #    May you do good and not evil.
 
     7 #    May you find forgiveness for yourself and forgive others.
 
     8 #    May you share freely, never taking more than you give.
 
    10 #***********************************************************************
 
    12 # Test scripts for deliberate failures of mutex routines.
 
    14 # $Id: mutex2.test,v 1.8 2008/07/19 13:43:24 danielk1977 Exp $
 
    16 set testdir [file dirname $argv0]
 
    17 source $testdir/tester.tcl
 
    22 sqlite3_reset_auto_extension
 
    24 install_mutex_counters 1
 
    26 # Fix the mutex subsystem so that it will not initialize.  In other words,
 
    27 # make it so that sqlite3_initialize() always fails.  
 
    30   set ::disable_mutex_init 10
 
    34   set ::disable_mutex_init 7
 
    39   set r [encoding convertto unicode $str]
 
    44 # Now that sqlite3_initialize() is failing, try to run various APIs that
 
    45 # require that SQLite be initialized.  Verify that they fail.
 
    48   set ::disable_mutex_init 7
 
    49   set rc [catch {sqlite db test.db} msg]
 
    54     set db2 [sqlite3_open16 [utf16 test.db] {}]
 
    57     sqlite3_complete16 [utf16 {SELECT * FROM t1;}]
 
    61   sqlite3_mprintf_int {This is a test %d,%d,%d} 1 2 3
 
    65     sqlite3_auto_extension_sqr
 
    69   sqlite3_reset_auto_extension
 
    75   sqlite3_realloc 0 10000
 
    77 ifcapable threadsafe {
 
    86 # Restore the system to a functional state
 
    88 install_mutex_counters 0
 
    89 set disable_mutex_init 0
 
    90 autoinstall_test_functions
 
    92 # Mutex allocation works now.
 
    96   set ptr [alloc_dealloc_mutex]