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.9 2008/10/07 15:25:49 drh Exp $
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
26 sqlite3_reset_auto_extension
28 install_mutex_counters 1
30 # Fix the mutex subsystem so that it will not initialize. In other words,
31 # make it so that sqlite3_initialize() always fails.
34 set ::disable_mutex_init 10
38 set ::disable_mutex_init 7
43 set r [encoding convertto unicode $str]
48 # Now that sqlite3_initialize() is failing, try to run various APIs that
49 # require that SQLite be initialized. Verify that they fail.
52 set ::disable_mutex_init 7
53 set rc [catch {sqlite db test.db} msg]
58 set db2 [sqlite3_open16 [utf16 test.db] {}]
61 sqlite3_complete16 [utf16 {SELECT * FROM t1;}]
65 sqlite3_mprintf_int {This is a test %d,%d,%d} 1 2 3
69 sqlite3_auto_extension_sqr
73 sqlite3_reset_auto_extension
79 sqlite3_realloc 0 10000
81 ifcapable threadsafe {
90 # Restore the system to a functional state
92 install_mutex_counters 0
93 set disable_mutex_init 0
94 autoinstall_test_functions
96 # Mutex allocation works now.
100 set ptr [alloc_dealloc_mutex]