diff options
author | Tim Prouty <tprouty@samba.org> | 2009-12-02 18:39:05 -0800 |
---|---|---|
committer | Tim Prouty <tprouty@samba.org> | 2009-12-03 18:54:52 -0800 |
commit | 522d6bc58891b8c25e935bcee3206f03c8ab73cb (patch) | |
tree | c81f1faabb3787c7d875925916bd234b6e349881 /source4/torture | |
parent | b14da4f7c54e88e615f2bb19bec43bacb7f11de8 (diff) | |
download | samba-522d6bc58891b8c25e935bcee3206f03c8ab73cb.tar.gz samba-522d6bc58891b8c25e935bcee3206f03c8ab73cb.tar.bz2 samba-522d6bc58891b8c25e935bcee3206f03c8ab73cb.zip |
s4 torture: Convert an error to a warning in RAW-OPLOCK-BATCH22
Some servers choose to mark a client as bad if they fail an oplock
break request by timing out (win7 is an example). Once the client is
marked as bad, future oplock requests will timeout instantly. This
causes subsequent runs of this test to fail, so rather than erroring
out as a failure, a warning is printed instead.
There is also a bug in w2k3 where it was incorrectly returning
contending a share mode lock. It worked in XP and has been re-fixed
in win7.
This can also now be run against samba3.
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/raw/oplock.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c index 85362d126f..2531989b8c 100644 --- a/source4/torture/raw/oplock.c +++ b/source4/torture/raw/oplock.c @@ -34,11 +34,11 @@ ret = false; \ }} while (0) -#define CHECK_RANGE(v, min, max) do { \ - if ((v) < (min) || (v) > (max)) { \ - torture_result(tctx, TORTURE_FAIL, "(%s): wrong value for %s got %d - should be between %d and %d\n", \ - __location__, #v, (int)v, (int)min, (int)max); \ - ret = false; \ +#define CHECK_RANGE(v, min, max) do { \ + if ((v) < (min) || (v) > (max)) { \ + torture_warning(tctx, "(%s): wrong value for %s got " \ + "%d - should be between %d and %d\n", \ + __location__, #v, (int)v, (int)min, (int)max); \ }} while (0) #define CHECK_STRMATCH(v, correct) do { \ @@ -2632,10 +2632,6 @@ static bool test_raw_oplock_batch22(struct torture_context *tctx, struct smbcli_ int timeout = torture_setting_int(tctx, "oplocktimeout", 30); int te; - if (torture_setting_bool(tctx, "samba3", false)) { - torture_skip(tctx, "BATCH22 disabled against samba3\n"); - } - if (!torture_setup_dir(cli1, BASEDIR)) { return false; } @@ -2644,7 +2640,6 @@ static bool test_raw_oplock_batch22(struct torture_context *tctx, struct smbcli_ smbcli_unlink(cli1->tree, fname); smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree); - /* base ntcreatex parms */ @@ -2681,9 +2676,23 @@ static bool test_raw_oplock_batch22(struct torture_context *tctx, struct smbcli_ tv = timeval_current(); smbcli_oplock_handler(cli1->transport, oplock_handler_timeout, cli1->tree); status = smb_raw_open(cli1->tree, tctx, &io); - CHECK_STATUS(tctx, status, NT_STATUS_SHARING_VIOLATION); + + if (TARGET_IS_W2K3(tctx)) { + /* 2k3 has an issue here. xp/win7 are ok. */ + CHECK_STATUS(tctx, status, NT_STATUS_SHARING_VIOLATION); + } else { + CHECK_STATUS(tctx, status, NT_STATUS_OK); + } + torture_wait_for_oplock_break(tctx); te = (int)timeval_elapsed(&tv); + + /* + * Some servers detect clients that let oplocks timeout, so this check + * only shows a warning message instead failing the test to eliminate + * failures from repeated runs of the test. This isn't ideal, but + * it's better than not running the test at all. + */ CHECK_RANGE(te, timeout - 1, timeout + 15); CHECK_VAL(break_info.count, 1); @@ -2698,7 +2707,13 @@ static bool test_raw_oplock_batch22(struct torture_context *tctx, struct smbcli_ smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree); status = smb_raw_open(cli1->tree, tctx, &io); CHECK_STATUS(tctx, status, NT_STATUS_OK); - CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN); + if (TARGET_IS_SAMBA3(tctx)) { + /* samba3 doesn't grant additional oplocks to bad clients. */ + CHECK_VAL(io.ntcreatex.out.oplock_level, NO_OPLOCK_RETURN); + } else { + CHECK_VAL(io.ntcreatex.out.oplock_level, + LEVEL_II_OPLOCK_RETURN); + } torture_wait_for_oplock_break(tctx); te = (int)timeval_elapsed(&tv); /* it should come in without delay */ |