1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Fix the shmlock.test script so that it works with the Windows restriction

that UnlockFile must exactly correspond to a prior LockFile.

FossilOrigin-Name: df939c89fa90b7f9ccf961027ca4eca4f987c49eabf530b5719a83e5ab0d346d
This commit is contained in:
drh
2019-01-03 16:00:23 +00:00
parent 20c0082371
commit 94e02d9c2c
3 changed files with 16 additions and 9 deletions

View File

@ -114,6 +114,11 @@ sqlite3 db0 test.db
sqlite3 db1 test.db
do_test 3.1 { execsql { SELECT * FROM t1 } db0 } {1 2}
do_test 3.2 { execsql { SELECT * FROM t1 } db1 } {1 2}
if {$tcl_platform(platform)=="windows"} {
set isWindows 1
} else {
set isWindows 0
}
set L(0) {n n n n n n n n}
set L(1) {n n n n n n n n}
@ -134,6 +139,10 @@ proc random_lock_test {idx} {
if {$locktype=="e"} {
for {set l $iSlot} {$l<8 && [lindex $L($idx) $l]=="n"} {incr l} {}
set n [expr int(rand()*($l-$iSlot))+1]
# The LockFile() and UnlockFile() apis on windows require that
# every unlock correspond exactly to a prior lock. Hence, we cannot
# lock arbitrary ranges in this test on windows.
if {$::isWindows} {set n 1}
# puts "iSlot=$iSlot l=$l L=$L($idx)"
# puts "$iSlot $n"
}
@ -169,5 +178,3 @@ db0 close
db1 close
finish_test