From 1315c8c4cf1b13926d8d4cef76fdd98654683ac9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 4 Mar 2002 00:35:28 +0000 Subject: allow setting of lock range and base in locktest (This used to be commit 97993630add4e8965f0395f92d34b0e8a6d9b875) --- source3/torture/locktest.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'source3') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index ad30537e69..2f7c4a9c05 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -31,17 +31,13 @@ static BOOL showall; static BOOL analyze; static BOOL hide_unlock_fails; static BOOL use_oplocks; +static unsigned lock_range = 100; +static unsigned lock_base = 0; #define FILENAME "\\locktest.dat" -#define LOCKRANGE 100 -#define LOCKBASE 0 #define MINLENGTH 0 -#define ZERO_ZERO 0 - -/* -#define LOCKBASE (0x40000000 - 50) -*/ +#define ZERO_ZERO 1 #define READ_PCT 50 #define LOCK_PCT 45 @@ -416,9 +412,9 @@ static void test_locks(char *share[NSERVERS]) #endif recorded[n].conn = random() % NCONNECTIONS; recorded[n].f = random() % NFILES; - recorded[n].start = LOCKBASE + ((unsigned)random() % (LOCKRANGE-1)); + recorded[n].start = lock_base + ((unsigned)random() % (lock_range-1)); recorded[n].len = MINLENGTH + - random() % (LOCKRANGE-(recorded[n].start-LOCKBASE)); + random() % (lock_range-(recorded[n].start-lock_base)); recorded[n].start *= RANGE_MULTIPLE; recorded[n].len *= RANGE_MULTIPLE; r1 = random() % 100; @@ -535,6 +531,8 @@ static void usage(void) -a (show all ops)\n\ -A analyse for minimal ops\n\ -O use oplocks\n\ + -R range set lock range\n\ + -B base set lock base\n\ "); } @@ -578,7 +576,7 @@ static void usage(void) seed = time(NULL); - while ((opt = getopt(argc, argv, "U:s:ho:aAW:Ok")) != EOF) { + while ((opt = getopt(argc, argv, "U:s:ho:aAW:OkR:B:")) != EOF) { switch (opt) { case 'k': #ifdef HAVE_KRB5 @@ -598,6 +596,12 @@ static void usage(void) got_pass = 1; } break; + case 'R': + lock_range = strtol(optarg, NULL, 0); + break; + case 'B': + lock_base = strtol(optarg, NULL, 0); + break; case 's': seed = atoi(optarg); break; -- cgit