From af1f408a05a42a7ec5c2f4cc5b67c08b3c6cf61f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 8 Nov 1997 05:33:45 +0000 Subject: [PATCH] a few more tests added, including one that tests whether the server understand the full range of byte offsets in locking requests. Samba doesn't (due to the 31 bit limitation in fcntl locking) --- source/utils/torture.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 157 insertions(+), 1 deletion(-) diff --git a/source/utils/torture.c b/source/utils/torture.c index 67a363df27b..506f31481c3 100644 --- a/source/utils/torture.c +++ b/source/utils/torture.c @@ -283,7 +283,7 @@ static void run_locktest1(void) t2 = time(NULL); if (t2 - t1 < 5) { - printf("This server appears not to support timed lock requests\n"); + printf("error: This server appears not to support timed lock requests\n"); } if (!cli_close(&cli1, fnum2)) { @@ -436,6 +436,160 @@ static void run_locktest2(void) } +/* + This test checks that + + 1) the server supports the full offset range in lock requests +*/ +static void run_locktest3(int numops) +{ + static struct cli_state cli1, cli2; + char *fname = "\\locktest.lck"; + int fnum1, fnum2, i; + uint32 offset; + +#define NEXT_OFFSET offset += (~(uint32)0) / numops + + if (!open_connection(&cli1) || !open_connection(&cli2)) { + return; + } + cli_sockopt(&cli1, sockops); + cli_sockopt(&cli2, sockops); + + printf("starting locktest3\n"); + + cli_unlink(&cli1, fname); + + fnum1 = cli_open(&cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); + if (fnum1 == -1) { + printf("open of %s failed (%s)\n", fname, cli_errstr(&cli1)); + return; + } + fnum2 = cli_open(&cli2, fname, O_RDWR, DENY_NONE); + if (fnum2 == -1) { + printf("open2 of %s failed (%s)\n", fname, cli_errstr(&cli2)); + return; + } + + for (offset=i=0;i