Change code in malloc_common.tcl (test code) to retry a "file delete -force" if

it fails.

FossilOrigin-Name: ebfb04f00c839601d92d33b9c2305fc4ce869bbc
This commit is contained in:
dan 2010-09-16 15:23:07 +00:00
parent ddbb6b48c9
commit d78fe8e380
4 changed files with 31 additions and 29 deletions

View File

@ -1,8 +1,5 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
C Updates\sto\sthe\ssqlite3_progress_handler()\sdocumentation.
D 2010-09-15T23:41:24
C Change\scode\sin\smalloc_common.tcl\s(test\scode)\sto\sretry\sa\s"file\sdelete\s-force"\sif\nit\sfails.
D 2010-09-16T15:23:07
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in c599a15d268b1db2aeadea19df2adc3bf2eb6bee
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -525,7 +522,7 @@ F test/mallocH.test 79b65aed612c9b3ed2dcdaa727c85895fd1bfbdb
F test/mallocI.test a88c2b9627c8506bf4703d8397420043a786cdb6
F test/mallocJ.test b5d1839da331d96223e5f458856f8ffe1366f62e
F test/mallocK.test d79968641d1b70d88f6c01bdb9a7eb4a55582cc9
F test/malloc_common.tcl 9b032b2e9172952400be0910d28f1852d5ca1ed1
F test/malloc_common.tcl cda732c0d2365a058c2a73778cf6b6da6db54452
F test/manydb.test b3d3bc4c25657e7f68d157f031eb4db7b3df0d3c
F test/memdb.test 0825155b2290e900264daaaf0334b6dfe69ea498
F test/memleak.test 10b9c6c57e19fc68c32941495e9ba1c50123f6e2
@ -636,7 +633,7 @@ F test/tclsqlite.test 8c154101e704170c2be10f137a5499ac2c6da8d3
F test/tempdb.test 800c36623d67a2ad1f58784b9c5644e0405af6e6
F test/temptable.test f42121a0d29a62f00f93274464164177ab1cc24a
F test/temptrigger.test b0273db072ce5f37cf19140ceb1f0d524bbe9f05
F test/tester.tcl d2f1bf08719de0d40bde73096c55a03d0a7de503
F test/tester.tcl d0c7b39c374156f3a37eeeb83af279c41c60ecbc
F test/thread001.test a3e6a7254d1cb057836cb3145b60c10bf5b7e60f
F test/thread002.test afd20095e6e845b405df4f2c920cb93301ca69db
F test/thread003.test b824d4f52b870ae39fc5bae4d8070eca73085dca
@ -860,14 +857,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 14f156632729d1a44ef234f39ff9df32db6b308a
R d553d625fffd87b4f35a681bb7a245ce
U drh
Z 0d39acdb955e95d3736b9e8eb9643b00
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFMkVmooxKgR168RlERAgNmAJoDiKM26gmlvaa5t8E8s8hnaY4+pACgim5h
26XMQhRVu2SUorfyCfdexXo=
=Y4G6
-----END PGP SIGNATURE-----
P 78f659ee9bb60df3503998301b554fe81fa6bdd3
R ee96a2d4950e0abaf03c37482918b8c3
U dan
Z 9971ebfc8719fca164d2b024c4c43a5a

View File

@ -1 +1 @@
78f659ee9bb60df3503998301b554fe81fa6bdd3
ebfb04f00c839601d92d33b9c2305fc4ce869bbc

View File

@ -143,7 +143,7 @@ proc do_faultsim_test {name args} {
# faultsim_delete_and_reopen
#
proc faultsim_save {} {
foreach f [glob -nocomplain sv_test.db*] { file delete -force $f }
foreach f [glob -nocomplain sv_test.db*] { forcedelete $f }
foreach f [glob -nocomplain test.db*] {
set f2 "sv_$f"
file copy -force $f $f2
@ -155,7 +155,7 @@ proc faultsim_save_and_close {} {
return ""
}
proc faultsim_restore {} {
foreach f [glob -nocomplain test.db*] { file delete -force $f }
foreach f [glob -nocomplain test.db*] { forcedelete $f }
foreach f2 [glob -nocomplain sv_test.db*] {
set f [string range $f2 3 end]
file copy -force $f2 $f
@ -422,12 +422,12 @@ proc do_malloc_test {tn args} {
#
catch {db close}
catch {db2 close}
catch {file delete -force test.db}
catch {file delete -force test.db-journal}
catch {file delete -force test.db-wal}
catch {file delete -force test2.db}
catch {file delete -force test2.db-journal}
catch {file delete -force test2.db-wal}
forcedelete test.db
forcedelete test.db-journal
forcedelete test.db-wal
forcedelete test2.db
forcedelete test2.db-journal
forcedelete test2.db-wal
if {[info exists ::mallocopts(-testdb)]} {
file copy $::mallocopts(-testdb) test.db
}

View File

@ -601,9 +601,21 @@ proc stepsql {dbptr sql} {
# Delete a file or directory
#
proc forcedelete {filename} {
if {[catch {file delete -force $filename}]} {
exec rm -rf $filename
# On windows, sometimes even a [file delete -force] can fail just after
# a file is closed. The cause is usually "tag-alongs" - programs like
# anti-virus software, automatic backup tools and various explorer
# extensions that keep a file open a little longer than we expect, causing
# the delete to fail.
#
# The solution is to wait a short amount of time before retrying the delete.
#
set nRetry 50 ;# Maximum number of retries.
set nDelay 100 ;# Delay in ms before retrying.
set rc 1
for {set i 0} {$i<$nRetry && $rc} {incr i} {
set rc [catch {file delete -force $filename} msg]
}
if {$rc} { error $msg }
}
# Do an integrity check of the entire database