| OLD | NEW |
| 1 # 2011 February 19 | 1 # 2011 February 19 |
| 2 # | 2 # |
| 3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
| 4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
| 5 # | 5 # |
| 6 # May you do good and not evil. | 6 # May you do good and not evil. |
| 7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
| 8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
| 9 # | 9 # |
| 10 #*********************************************************************** | 10 #*********************************************************************** |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 # Tests oserror-1.* test failures in the open() system call. | 44 # Tests oserror-1.* test failures in the open() system call. |
| 45 # | 45 # |
| 46 | 46 |
| 47 # Test a failure in open() due to too many files. | 47 # Test a failure in open() due to too many files. |
| 48 # | 48 # |
| 49 # The xOpen() method of the unix VFS calls getcwd() as well as open(). | 49 # The xOpen() method of the unix VFS calls getcwd() as well as open(). |
| 50 # Although this does not appear to be documented in the man page, on OSX | 50 # Although this does not appear to be documented in the man page, on OSX |
| 51 # a call to getcwd() may fail if there are no free file descriptors. So | 51 # a call to getcwd() may fail if there are no free file descriptors. So |
| 52 # an error may be reported for either open() or getcwd() here. | 52 # an error may be reported for either open() or getcwd() here. |
| 53 # | 53 # |
| 54 puts "Possible valgrind error about invalid file descriptor follows:" | 54 if {![clang_sanitize_address]} { |
| 55 do_test 1.1.1 { | 55 do_test 1.1.1 { |
| 56 set ::log [list] | 56 set ::log [list] |
| 57 list [catch { | 57 list [catch { |
| 58 for {set i 0} {$i < 2000} {incr i} { sqlite3 dbh_$i test.db -readonly 1 } | 58 for {set i 0} {$i < 2000} {incr i} { sqlite3 dbh_$i test.db -readonly 1 } |
| 59 } msg] $msg | 59 } msg] $msg |
| 60 } {1 {unable to open database file}} | 60 } {1 {unable to open database file}} |
| 61 do_test 1.1.2 { | 61 do_test 1.1.2 { |
| 62 catch { for {set i 0} {$i < 2000} {incr i} { dbh_$i close } } | 62 catch { for {set i 0} {$i < 2000} {incr i} { dbh_$i close } } |
| 63 } {1} | 63 } {1} |
| 64 do_re_test 1.1.3 { | 64 do_re_test 1.1.3 { |
| 65 lindex $::log 0 | 65 lindex $::log 0 |
| 66 } {^os_unix.c:\d+: \(\d+\) (open|getcwd)\(.*test.db\) - } | 66 } {^os_unix.c:\d+: \(\d+\) (open|getcwd)\(.*test.db\) - } |
| 67 } |
| 67 | 68 |
| 68 | 69 |
| 69 # Test a failure in open() due to the path being a directory. | 70 # Test a failure in open() due to the path being a directory. |
| 70 # | 71 # |
| 71 do_test 1.2.1 { | 72 do_test 1.2.1 { |
| 72 file mkdir dir.db | 73 file mkdir dir.db |
| 73 set ::log [list] | 74 set ::log [list] |
| 74 list [catch { sqlite3 dbh dir.db } msg] $msg | 75 list [catch { sqlite3 dbh dir.db } msg] $msg |
| 75 } {1 {unable to open database file}} | 76 } {1 {unable to open database file}} |
| 76 | 77 |
| 77 do_re_test 1.2.2 { lindex $::log 0 } {^os_unix.c:\d+: \(\d+\) open\(.*dir.db\) -
} | 78 do_re_test 1.2.2 { lindex $::log 0 } {^os_unix.c:\d+: \(\d+\) open\(.*dir.db\) -
} |
| 78 | 79 |
| 79 # Test a failure in open() due to the path not existing. | 80 # Test a failure in open() due to the path not existing. |
| 80 # | 81 # |
| 81 do_test 1.3.1 { | 82 do_test 1.3.1 { |
| 82 set ::log [list] | 83 set ::log [list] |
| 83 list [catch { sqlite3 dbh /x/y/z/test.db } msg] $msg | 84 list [catch { sqlite3 dbh /x/y/z/test.db } msg] $msg |
| 84 } {1 {unable to open database file}} | 85 } {1 {unable to open database file}} |
| 85 | 86 |
| 86 do_re_test 1.3.2 { lindex $::log 0 } {^os_unix.c:\d+: \(\d+\) open\(.*test.db\)
- } | 87 do_re_test 1.3.2 { lindex $::log 0 } {^os_unix.c:\d+: \(\d+\) open\(.*test.db\)
- } |
| 87 | 88 |
| 88 # Test a failure in open() due to the path not existing. | 89 # Test a failure in open() due to the path not existing. |
| 89 # | 90 # |
| 90 do_test 1.4.1 { | 91 do_test 1.4.1 { |
| 91 set ::log [list] | 92 set ::log [list] |
| 92 list [catch { sqlite3 dbh /root/test.db } msg] $msg | 93 list [catch { sqlite3 dbh /root/test.db } msg] $msg |
| 93 } {1 {unable to open database file}} | 94 } {1 {unable to open database file}} |
| 94 | 95 |
| 95 do_re_test 1.4.2 { lindex $::log 0 } {^os_unix.c:\d*: \(\d+\) open\(.*test.db\)
- } | 96 do_re_test 1.4.2 { |
| 97 lindex $::log 0 |
| 98 } {^os_unix.c:\d*: \(\d+\) (open|readlink)\(.*test.db\) - } |
| 96 | 99 |
| 97 #-------------------------------------------------------------------------- | 100 #-------------------------------------------------------------------------- |
| 98 # Tests oserror-1.* test failures in the unlink() system call. | 101 # Tests oserror-1.* test failures in the unlink() system call. |
| 99 # | 102 # |
| 100 ifcapable wal { | 103 ifcapable wal { |
| 101 do_test 2.1.1 { | 104 do_test 2.1.1 { |
| 102 set ::log [list] | 105 set ::log [list] |
| 103 file mkdir test.db-wal | 106 file mkdir test.db-wal |
| 104 forcedelete test.db | 107 forcedelete test.db |
| 105 list [catch { | 108 list [catch { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 116 forcedelete test.db-wal | 119 forcedelete test.db-wal |
| 117 } {} | 120 } {} |
| 118 } | 121 } |
| 119 | 122 |
| 120 | 123 |
| 121 test_syscall reset | 124 test_syscall reset |
| 122 sqlite3_shutdown | 125 sqlite3_shutdown |
| 123 test_sqlite3_log | 126 test_sqlite3_log |
| 124 sqlite3_initialize | 127 sqlite3_initialize |
| 125 finish_test | 128 finish_test |
| OLD | NEW |