From b34d17e49811df341054038ebb01734c9c83623c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 24 Aug 2001 19:34:11 +0000 Subject: tests for 0 length locks (This used to be commit 8fbd1d0f978a349ec4fcc0d34fca55314d3dec31) --- source3/torture/locktest.c | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 54cf0dd351..4c62b8dafc 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -33,8 +33,9 @@ static BOOL hide_unlock_fails; static BOOL use_oplocks; #define FILENAME "\\locktest.dat" -#define LOCKRANGE 1000 +#define LOCKRANGE 5 #define LOCKBASE 0 +#define MINLENGTH 0 /* #define LOCKBASE (0x40000000 - 50) @@ -260,9 +261,9 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS], start, len, LOCK_TIMEOUT, op); } if (showall || ret[0] != ret[1]) { - printf("lock conn=%u f=%u range=%.0f:%.0f(%.0f) op=%s -> %u:%u\n", + printf("lock conn=%u f=%u range=%.0f(%.0f) op=%s -> %u:%u\n", conn, f, - (double)start, (double)start+len-1, (double)len, + (double)start, (double)len, op==READ_LOCK?"READ_LOCK":"WRITE_LOCK", ret[0], ret[1]); } @@ -276,9 +277,9 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS], start, len); } if (showall || (!hide_unlock_fails && (ret[0] != ret[1]))) { - printf("unlock conn=%u f=%u range=%.0f:%.0f(%.0f) -> %u:%u\n", + printf("unlock conn=%u f=%u range=%.0f(%.0f) -> %u:%u\n", conn, f, - (double)start, (double)start+len-1, (double)len, + (double)start, (double)len, ret[0], ret[1]); } if (showall || ret[0] != ret[1]) show_locks(); @@ -372,7 +373,7 @@ static void test_locks(char *share[NSERVERS]) { struct cli_state *cli[NSERVERS][NCONNECTIONS]; int fnum[NSERVERS][NCONNECTIONS][NFILES]; - int n, i, n1; + int n, i, n1, skip; ZERO_STRUCT(fnum); ZERO_STRUCT(cli); @@ -388,7 +389,7 @@ static void test_locks(char *share[NSERVERS]) recorded[n].conn = random() % NCONNECTIONS; recorded[n].f = random() % NFILES; recorded[n].start = LOCKBASE + ((unsigned)random() % (LOCKRANGE-1)); - recorded[n].len = + recorded[n].len = MINLENGTH + random() % (LOCKRANGE-(recorded[n].start-LOCKBASE)); recorded[n].start *= RANGE_MULTIPLE; recorded[n].len *= RANGE_MULTIPLE; @@ -407,6 +408,8 @@ static void test_locks(char *share[NSERVERS]) if (n == numops || !analyze) return; n++; + skip = n/2; + while (1) { n1 = n; @@ -414,26 +417,36 @@ static void test_locks(char *share[NSERVERS]) reconnect(cli, fnum, share); open_files(cli, fnum); - for (i=0;i 1) { + skip = skip/2; + printf("skip=%d\n", skip); + continue; + } + if (n1 == n) break; } -- cgit