patch Tcl tests, darwin rc2

For details see

  https://sqlite.org/forum/forumpost/0244674f4e?t=h

and

  https://sqlite.org/src/info/0c8e2ede5c325aa7
This commit is contained in:
Jan Mercl
2021-01-07 22:48:37 +01:00
parent 1c17040813
commit 48fa7fd005
2 changed files with 44 additions and 30 deletions

View File

@@ -29,7 +29,7 @@ ifcapable !crashtest||!memorymanage {
db close db close
for {set ii 0} {$ii < 10} {incr ii} { for {set ii 0} {$ii < 10} {incr ii} {
for {set jj 50} {$jj < 100} {incr jj} { for {set jj 1} {$jj < 100} {incr jj} {
# Set up the database so that it is an auto-vacuum database # Set up the database so that it is an auto-vacuum database
# containing a single table (root page 3) with a single row. # containing a single table (root page 3) with a single row.
@@ -47,6 +47,14 @@ for {set ii 0} {$ii < 10} {incr ii} {
do_test crash5-$ii.$jj.1 { do_test crash5-$ii.$jj.1 {
crashsql -delay 1 -file test.db-journal -seed $ii -tclbody [join [list \ crashsql -delay 1 -file test.db-journal -seed $ii -tclbody [join [list \
[list set iFail $jj] { [list set iFail $jj] {
proc get_pwd {} {
if {$::tcl_platform(platform) eq "windows"} {
return [string map [list \\ /] \
[string trim [exec -- $::env(ComSpec) /c echo %CD%]]]
} else {
return [pwd]
}
}
sqlite3_crashparams 0 [file join [get_pwd] test.db-journal] sqlite3_crashparams 0 [file join [get_pwd] test.db-journal]
# Begin a transaction and evaluate a "CREATE INDEX" statement # Begin a transaction and evaluate a "CREATE INDEX" statement
@@ -61,9 +69,11 @@ for {set ii 0} {$ii < 10} {incr ii} {
# #
db eval BEGIN db eval BEGIN
sqlite3_memdebug_fail $iFail -repeat 0 sqlite3_memdebug_fail $iFail -repeat 0
catch {db eval { CREATE UNIQUE INDEX i1 ON t1(a); }} msg set rc [catch {db eval { CREATE UNIQUE INDEX i1 ON t1(a); }} msg]
# puts "$n $msg ac=[sqlite3_get_autocommit db]" # puts "$msg ac=[sqlite3_get_autocommit db] iFail=$iFail"
# puts "fail=[sqlite3_memdebug_fail -1]"
if {$rc} {
# If the transaction is still active (it may not be if the malloc() # If the transaction is still active (it may not be if the malloc()
# failure occurred in the OS layer), write to the database. Make sure # failure occurred in the OS layer), write to the database. Make sure
# page 4 is among those written. # page 4 is among those written.
@@ -91,6 +101,7 @@ for {set ii 0} {$ii < 10} {incr ii} {
# #
sqlite3_crashparams 1 [file join [get_pwd] test.db-journal] sqlite3_crashparams 1 [file join [get_pwd] test.db-journal]
sqlite3_release_memory 8092 sqlite3_release_memory 8092
}
}]] {} }]] {}
expr 1 expr 1
} {1} } {1}

View File

@@ -1689,9 +1689,12 @@ proc crashsql {args} {
set cfile [string map {\\ \\\\} [file nativename [file join [get_pwd] $crashfile]]] set cfile [string map {\\ \\\\} [file nativename [file join [get_pwd] $crashfile]]]
set f [open crash.tcl w] set f [open crash.tcl w]
puts $f "sqlite3_initialize ; sqlite3_shutdown"
puts $f "catch { install_malloc_faultsim 1 }"
puts $f "sqlite3_crash_enable 1 $dfltvfs" puts $f "sqlite3_crash_enable 1 $dfltvfs"
puts $f "sqlite3_crashparams $blocksize $dc $crashdelay $cfile" puts $f "sqlite3_crashparams $blocksize $dc $crashdelay $cfile"
puts $f "sqlite3_test_control_pending_byte $::sqlite_pending_byte" puts $f "sqlite3_test_control_pending_byte $::sqlite_pending_byte"
puts $f "autoinstall_test_functions"
# This block sets the cache size of the main database to 10 # This block sets the cache size of the main database to 10
# pages. This is done in case the build is configured to omit # pages. This is done in case the build is configured to omit
@@ -1719,7 +1722,7 @@ proc crashsql {args} {
} }
close $f close $f
set r [catch { set r [catch {
exec [info nameofexec] crash.tcl >@stdout exec [info nameofexec] crash.tcl >@stdout 2>@stdout
} msg] } msg]
# Windows/ActiveState TCL returns a slightly different # Windows/ActiveState TCL returns a slightly different