summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-01-14 04:32:57 +0000
committerAndrew Tridgell <tridge@samba.org>2000-01-14 04:32:57 +0000
commit82af221e4a7e456f580f16bc5d2fd904fc018c96 (patch)
tree1b0818867ea76a25e578345364186566c4f167c4 /source3/utils
parent7cd74b07ef283a4ce2e6f6c98cc7096189a74f20 (diff)
downloadsamba-82af221e4a7e456f580f16bc5d2fd904fc018c96.tar.gz
samba-82af221e4a7e456f580f16bc5d2fd904fc018c96.tar.bz2
samba-82af221e4a7e456f580f16bc5d2fd904fc018c96.zip
we now pass all byte range locking tests
the last piece was to use a smb timeout slightly larger than the locking timeout in bloking locks to prevent a race (This used to be commit 1b54cb4a33a65e62c2e3189b78ef073869a60c75)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/torture.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/source3/utils/torture.c b/source3/utils/torture.c
index ba510c0b58..4539f11a6a 100644
--- a/source3/utils/torture.c
+++ b/source3/utils/torture.c
@@ -242,7 +242,7 @@ static BOOL rw_torture(struct cli_state *c)
printf("unlink failed (%s)\n", cli_errstr(c));
}
- if (!cli_unlock(c, fnum2, n*sizeof(int), sizeof(int), -1)) {
+ if (!cli_unlock(c, fnum2, n*sizeof(int), sizeof(int))) {
printf("unlock failed (%s)\n", cli_errstr(c));
}
}
@@ -550,8 +550,6 @@ static void run_locktest2(int dummy)
cli_setpid(&cli, 1);
- sleep(10);
-
if (!cli_lock(&cli, fnum1, 0, 4, 0, WRITE_LOCK)) {
printf("lock1 failed (%s)\n", cli_errstr(&cli));
return;
@@ -565,7 +563,7 @@ static void run_locktest2(int dummy)
cli_setpid(&cli, 2);
- if (cli_unlock(&cli, fnum1, 0, 4, 0)) {
+ if (cli_unlock(&cli, fnum1, 0, 8)) {
printf("unlock1 succeeded! This is a locking bug\n");
}
@@ -677,14 +675,14 @@ static void run_locktest3(int dummy)
for (offset=i=0;i<numops;i++) {
NEXT_OFFSET;
- if (!cli_unlock(&cli1, fnum1, offset-1, 1, 0)) {
+ if (!cli_unlock(&cli1, fnum1, offset-1, 1)) {
printf("unlock1 %d failed (%s)\n",
i,
cli_errstr(&cli1));
return;
}
- if (!cli_unlock(&cli2, fnum2, offset-2, 1, 0)) {
+ if (!cli_unlock(&cli2, fnum2, offset-2, 1)) {
printf("unlock2 %d failed (%s)\n",
i,
cli_errstr(&cli1));
@@ -802,7 +800,7 @@ static void run_locktest4(int dummy)
ret = cli_lock(&cli1, fnum1, 110, 4, 0, READ_LOCK) &&
cli_lock(&cli1, fnum1, 112, 4, 0, READ_LOCK) &&
- cli_unlock(&cli1, fnum1, 110, 6, 0);
+ cli_unlock(&cli1, fnum1, 110, 6);
EXPECTED(ret, False);
printf("the same process %s coalesce read locks\n", ret?"can":"cannot");
@@ -820,30 +818,30 @@ static void run_locktest4(int dummy)
ret = cli_lock(&cli1, fnum1, 140, 4, 0, READ_LOCK) &&
cli_lock(&cli1, fnum1, 140, 4, 0, READ_LOCK) &&
- cli_unlock(&cli1, fnum1, 140, 4, 0) &&
- cli_unlock(&cli1, fnum1, 140, 4, 0);
+ cli_unlock(&cli1, fnum1, 140, 4) &&
+ cli_unlock(&cli1, fnum1, 140, 4);
EXPECTED(ret, True);
printf("this server %s do recursive read locking\n", ret?"does":"doesn't");
ret = cli_lock(&cli1, fnum1, 150, 4, 0, WRITE_LOCK) &&
cli_lock(&cli1, fnum1, 150, 4, 0, READ_LOCK) &&
- cli_unlock(&cli1, fnum1, 150, 4, 0) &&
+ cli_unlock(&cli1, fnum1, 150, 4) &&
(cli_read(&cli2, fnum2, buf, 150, 4) == 4) &&
!(cli_write(&cli2, fnum2, 0, buf, 150, 4) == 4) &&
- cli_unlock(&cli1, fnum1, 150, 4, 0);
+ cli_unlock(&cli1, fnum1, 150, 4);
EXPECTED(ret, True);
printf("this server %s do recursive lock overlays\n", ret?"does":"doesn't");
ret = cli_lock(&cli1, fnum1, 160, 4, 0, READ_LOCK) &&
- cli_unlock(&cli1, fnum1, 160, 4, 0) &&
+ cli_unlock(&cli1, fnum1, 160, 4) &&
(cli_write(&cli2, fnum2, 0, buf, 160, 4) == 4) &&
(cli_read(&cli2, fnum2, buf, 160, 4) == 4);
EXPECTED(ret, True);
printf("the same process %s remove a read lock using write locking\n", ret?"can":"cannot");
ret = cli_lock(&cli1, fnum1, 170, 4, 0, WRITE_LOCK) &&
- cli_unlock(&cli1, fnum1, 170, 4, 0) &&
+ cli_unlock(&cli1, fnum1, 170, 4) &&
(cli_write(&cli2, fnum2, 0, buf, 170, 4) == 4) &&
(cli_read(&cli2, fnum2, buf, 170, 4) == 4);
EXPECTED(ret, True);
@@ -851,7 +849,7 @@ static void run_locktest4(int dummy)
ret = cli_lock(&cli1, fnum1, 190, 4, 0, WRITE_LOCK) &&
cli_lock(&cli1, fnum1, 190, 4, 0, READ_LOCK) &&
- cli_unlock(&cli1, fnum1, 190, 4, 0) &&
+ cli_unlock(&cli1, fnum1, 190, 4) &&
!(cli_write(&cli2, fnum2, 0, buf, 190, 4) == 4) &&
(cli_read(&cli2, fnum2, buf, 190, 4) == 4);
EXPECTED(ret, True);