Correct subtle timing issues in the win32lock test cases and in the lock_win32_file Tcl command. Also, eliminate superfluous MSVC compiler warnings.
FossilOrigin-Name: 7baf02946e14eb889d864984ff3b3822aad8a3c9
This commit is contained in:
parent
1b466a605d
commit
176f1b47e5
@ -43,6 +43,11 @@ TCC = $(TCC) -I$(TOP)\ext\rtree
|
||||
#
|
||||
TCC = $(TCC) -DNDEBUG
|
||||
|
||||
#
|
||||
# Prevent warnings about "insecure" runtime library functions being used.
|
||||
#
|
||||
TCC = $(TCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
|
||||
|
||||
# The locations of the Tcl header and library files. Also, the library that
|
||||
# non-stubs enabled programs using Tcl must link against. These variables
|
||||
# (TCLINCDIR, TCLLIBDIR, and LIBTCL) may be overridden via the environment
|
||||
|
16
manifest
16
manifest
@ -1,9 +1,9 @@
|
||||
C Fix\smissing\sinfo\sexists\scheck\sfor\swin32lock-2.2\s(the\sone\spreviously\sapplied\sto\swin32lock-1.2).
|
||||
D 2011-08-02T20:19:48.906
|
||||
C Correct\ssubtle\stiming\sissues\sin\sthe\swin32lock\stest\scases\sand\sin\sthe\slock_win32_file\sTcl\scommand.\s\sAlso,\seliminate\ssuperfluous\sMSVC\scompiler\swarnings.
|
||||
D 2011-08-02T23:34:00.968
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
F Makefile.msc 8e04f517922b9e31a5bf975f07bb66df79ae7076
|
||||
F Makefile.msc 9fd0401b0134b565a9c7d8ed49dc044cc89f2096
|
||||
F Makefile.vxworks c85ec1d8597fe2f7bc225af12ac1666e21379151
|
||||
F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6
|
||||
F VERSION f724de7326e87b7f3b0a55f16ef4b4d993680d54
|
||||
@ -188,7 +188,7 @@ F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
|
||||
F src/status.c 7ac64842c86cec2fc1a1d0e5c16d3beb8ad332bf
|
||||
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
|
||||
F src/tclsqlite.c c355b33803fb756dc09297ec84d19604301fa622
|
||||
F src/test1.c e7ea726d26b9007bae7907d8b40280c70ec6c504
|
||||
F src/test1.c 9952abd6dc729eb1c011b71ee26a8b49d0aa7c10
|
||||
F src/test2.c 80d323d11e909cf0eb1b6fbb4ac22276483bcf31
|
||||
F src/test3.c 124ff9735fb6bb7d41de180d6bac90e7b1509432
|
||||
F src/test4.c d1e5a5e904d4b444cf572391fdcb017638e36ff7
|
||||
@ -913,7 +913,7 @@ F test/where9.test 24f19ad14bb1b831564ced5273e681e495662848
|
||||
F test/whereA.test 24c234263c8fe358f079d5e57d884fb569d2da0a
|
||||
F test/whereB.test 0def95db3bdec220a731c7e4bec5930327c1d8c5
|
||||
F test/wherelimit.test 5e9fd41e79bb2b2d588ed999d641d9c965619b31
|
||||
F test/win32lock.test cc90e3a73591b6e480b18ce864474908cccfb0d7
|
||||
F test/win32lock.test 7144fb147f7096807b22c98a44c4f2d9649b1175
|
||||
F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688
|
||||
F tool/build-shell.sh 12aa4391073a777fcb6dcc490b219a018ae98bac
|
||||
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
|
||||
@ -954,7 +954,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5
|
||||
F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576
|
||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||
F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262
|
||||
P cd20b4ef6020c0cffe918362afc2b491fb95eb92
|
||||
R 2c64effa9318d3db741b9bcbc99c8349
|
||||
P 8a52698e642f40a32d09a6a00b63f25ac38f3fda
|
||||
R e99f54a15d751a5d0d488d9edef3a843
|
||||
U mistachkin
|
||||
Z 8b2de65f0513dc9d6a9c2ea9b8d5fabb
|
||||
Z a80ca8d406d4afb3329eb0410ed145e3
|
||||
|
@ -1 +1 @@
|
||||
8a52698e642f40a32d09a6a00b63f25ac38f3fda
|
||||
7baf02946e14eb889d864984ff3b3822aad8a3c9
|
26
src/test1.c
26
src/test1.c
@ -5645,6 +5645,7 @@ static int test_test_control(
|
||||
** background thread.
|
||||
*/
|
||||
struct win32FileLocker {
|
||||
char *evName; /* Name of event to signal thread startup */
|
||||
HANDLE h; /* Handle of the file to be locked */
|
||||
int delay1; /* Delay before locking */
|
||||
int delay2; /* Delay before unlocking */
|
||||
@ -5660,6 +5661,13 @@ struct win32FileLocker {
|
||||
*/
|
||||
static void win32_file_locker(void *pAppData){
|
||||
struct win32FileLocker *p = (struct win32FileLocker*)pAppData;
|
||||
if( p->evName ){
|
||||
HANDLE ev = OpenEvent(EVENT_MODIFY_STATE, FALSE, p->evName);
|
||||
if ( ev ){
|
||||
SetEvent(ev);
|
||||
CloseHandle(ev);
|
||||
}
|
||||
}
|
||||
if( p->delay1 ) Sleep(p->delay1);
|
||||
if( LockFile(p->h, 0, 0, 100000000, 0) ){
|
||||
Sleep(p->delay2);
|
||||
@ -5688,16 +5696,18 @@ static int win32_file_lock(
|
||||
int objc,
|
||||
Tcl_Obj *CONST objv[]
|
||||
){
|
||||
static struct win32FileLocker x = { 0, 0, 0 };
|
||||
static struct win32FileLocker x = { "win32_file_lock", 0, 0, 0, 0, 0 };
|
||||
const char *zFilename;
|
||||
char zBuf[200];
|
||||
int retry = 0;
|
||||
HANDLE ev;
|
||||
DWORD wResult;
|
||||
|
||||
if( objc!=4 && objc!=1 ){
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "FILENAME DELAY1 DELAY2");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if( objc==1 ){
|
||||
char zBuf[200];
|
||||
sqlite3_snprintf(sizeof(zBuf), zBuf, "%d %d %d %d %d",
|
||||
x.ok, x.err, x.delay1, x.delay2, x.h);
|
||||
Tcl_AppendResult(interp, zBuf, (char*)0);
|
||||
@ -5721,8 +5731,20 @@ static int win32_file_lock(
|
||||
Tcl_AppendResult(interp, "cannot open file: ", zFilename, (char*)0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
ev = CreateEvent(NULL, TRUE, FALSE, x.evName);
|
||||
if ( !ev ){
|
||||
Tcl_AppendResult(interp, "cannot create event: ", x.evName, (char*)0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
_beginthread(win32_file_locker, 0, (void*)&x);
|
||||
Sleep(0);
|
||||
if ( (wResult = WaitForSingleObject(ev, 10000))!=WAIT_OBJECT_0 ){
|
||||
sqlite3_snprintf(sizeof(zBuf), zBuf, "0x%x", wResult);
|
||||
Tcl_AppendResult(interp, "wait failed: ", zBuf, (char*)0);
|
||||
CloseHandle(ev);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
CloseHandle(ev);
|
||||
return TCL_OK;
|
||||
}
|
||||
#endif
|
||||
|
@ -41,20 +41,23 @@ do_test win32lock-1.1 {
|
||||
} {1 100000 2 50000 3 25000 4 12500}
|
||||
|
||||
unset -nocomplain delay1 rc msg
|
||||
set delay1 50
|
||||
set rc 0
|
||||
set old_pending_byte [sqlite3_test_control_pending_byte 0x40000000]
|
||||
|
||||
set win32_lock_ok [list]
|
||||
set win32_lock_error [list]
|
||||
set delay1 25
|
||||
while {1} {
|
||||
sqlite3_sleep 10
|
||||
lock_win32_file test.db 0 $::delay1
|
||||
set ::log {}
|
||||
set rc [catch {db eval {SELECT x, length(y) FROM t1 ORDER BY rowid}} msg]
|
||||
if {$rc} {
|
||||
do_test win32lock-1.2-$delay1-fin {
|
||||
lappend win32_lock_error $::delay1
|
||||
do_test win32lock-1.2-$delay1-error {
|
||||
set ::msg
|
||||
} {disk I/O error}
|
||||
break
|
||||
} else {
|
||||
do_test win32lock-1.2-$delay1 {
|
||||
lappend win32_lock_ok $::delay1
|
||||
do_test win32lock-1.2-$delay1-ok {
|
||||
set ::msg
|
||||
} {1 100000 2 50000 3 25000 4 12500}
|
||||
if {[info exists ::log] && $::log!=""} {
|
||||
@ -63,9 +66,10 @@ while {1} {
|
||||
set x
|
||||
} {{delayed #ms for lock/sharing conflict}}
|
||||
}
|
||||
incr delay1 50
|
||||
}
|
||||
set ::log {}
|
||||
if {[llength $win32_lock_ok] && [llength $win32_lock_error]} break
|
||||
incr delay1 25
|
||||
sqlite3_sleep 10
|
||||
}
|
||||
|
||||
do_test win32lock-2.0 {
|
||||
@ -75,18 +79,21 @@ do_test win32lock-2.1 {
|
||||
file_control_win32_av_retry db 1 1
|
||||
} {0 1 1}
|
||||
|
||||
set delay1 50
|
||||
set win32_lock_ok [list]
|
||||
set win32_lock_error [list]
|
||||
set delay1 1
|
||||
while {1} {
|
||||
sqlite3_sleep 10
|
||||
lock_win32_file test.db 0 $::delay1
|
||||
set ::log {}
|
||||
set rc [catch {db eval {SELECT x, length(y) FROM t1 ORDER BY rowid}} msg]
|
||||
if {$rc} {
|
||||
do_test win32lock-2.2-$delay1-fin {
|
||||
lappend win32_lock_error $::delay1
|
||||
do_test win32lock-2.2-$delay1-error {
|
||||
set ::msg
|
||||
} {disk I/O error}
|
||||
break
|
||||
} else {
|
||||
do_test win32lock-2.2-$delay1 {
|
||||
lappend win32_lock_ok $::delay1
|
||||
do_test win32lock-2.2-$delay1-ok {
|
||||
set ::msg
|
||||
} {1 100000 2 50000 3 25000 4 12500}
|
||||
if {[info exists ::log] && $::log!=""} {
|
||||
@ -95,9 +102,10 @@ while {1} {
|
||||
set x
|
||||
} {{delayed #ms for lock/sharing conflict}}
|
||||
}
|
||||
incr delay1 50
|
||||
}
|
||||
set ::log {}
|
||||
if {[llength $win32_lock_ok] && [llength $win32_lock_error]} break
|
||||
incr delay1 1
|
||||
sqlite3_sleep 10
|
||||
}
|
||||
|
||||
file_control_win32_av_retry db 10 25
|
||||
|
Loading…
Reference in New Issue
Block a user