From af8b7857ca4b9f81d2240d2592c4d02893b04f76 Mon Sep 17 00:00:00 2001 From: Tim Prouty Date: Tue, 1 Dec 2009 15:29:00 -0800 Subject: s4 torture: Allow some implementations to break from level1 to none with two breaks --- source4/torture/raw/oplock.c | 20 +++++++++++++------- source4/torture/smbtorture.c | 2 ++ source4/torture/smbtorture.h | 6 ++++++ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c index 283fed2252..106acfe793 100644 --- a/source4/torture/raw/oplock.c +++ b/source4/torture/raw/oplock.c @@ -253,6 +253,12 @@ done: return; } +static uint8_t get_break_level1_to_none_count(struct torture_context *tctx) +{ + return torture_setting_bool(tctx, "2_step_break_to_none", false) ? + 2 : 1; +} + static bool test_raw_oplock_exclusive1(struct torture_context *tctx, struct smbcli_state *cli1, struct smbcli_state *cli2) { const char *fname = BASEDIR "\\test_exclusive1.dat"; @@ -471,7 +477,7 @@ static bool test_raw_oplock_exclusive3(struct torture_context *tctx, struct smbc CHECK_STATUS(tctx, status, NT_STATUS_OK); torture_wait_for_oplock_break(tctx); - CHECK_VAL(break_info.count, 1); + CHECK_VAL(break_info.count, get_break_level1_to_none_count(tctx)); CHECK_VAL(break_info.failures, 0); CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_NONE); @@ -608,7 +614,7 @@ static bool test_raw_oplock_exclusive5(struct torture_context *tctx, struct smbc fnum2 = io.ntcreatex.out.file.fnum; CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN); torture_wait_for_oplock_break(tctx); - CHECK_VAL(break_info.count, 1); + CHECK_VAL(break_info.count, get_break_level1_to_none_count(tctx)); CHECK_VAL(break_info.failures, 0); smbcli_close(cli1->tree, fnum); @@ -1538,7 +1544,7 @@ static bool test_raw_oplock_batch11(struct torture_context *tctx, struct smbcli_ CHECK_STATUS(tctx, status, NT_STATUS_OK); torture_wait_for_oplock_break(tctx); - CHECK_VAL(break_info.count, 1); + CHECK_VAL(break_info.count, get_break_level1_to_none_count(tctx)); CHECK_VAL(break_info.failures, 0); CHECK_VAL(break_info.level, 0); @@ -1615,7 +1621,7 @@ static bool test_raw_oplock_batch12(struct torture_context *tctx, struct smbcli_ CHECK_STATUS(tctx, status, NT_STATUS_OK); torture_wait_for_oplock_break(tctx); - CHECK_VAL(break_info.count, 1); + CHECK_VAL(break_info.count, get_break_level1_to_none_count(tctx)); CHECK_VAL(break_info.failures, 0); CHECK_VAL(break_info.level, 0); @@ -1692,7 +1698,7 @@ static bool test_raw_oplock_batch13(struct torture_context *tctx, struct smbcli_ fnum2 = io.ntcreatex.out.file.fnum; torture_wait_for_oplock_break(tctx); CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN); - CHECK_VAL(break_info.count, 1); + CHECK_VAL(break_info.count, get_break_level1_to_none_count(tctx)); CHECK_VAL(break_info.failures, 0); smbcli_close(cli1->tree, fnum); @@ -1769,7 +1775,7 @@ static bool test_raw_oplock_batch14(struct torture_context *tctx, struct smbcli_ CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN); torture_wait_for_oplock_break(tctx); - CHECK_VAL(break_info.count, 1); + CHECK_VAL(break_info.count, get_break_level1_to_none_count(tctx)); CHECK_VAL(break_info.failures, 0); smbcli_close(cli1->tree, fnum); @@ -1921,7 +1927,7 @@ static bool test_raw_oplock_batch16(struct torture_context *tctx, struct smbcli_ CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN); torture_wait_for_oplock_break(tctx); - CHECK_VAL(break_info.count, 1); + CHECK_VAL(break_info.count, get_break_level1_to_none_count(tctx)); CHECK_VAL(break_info.failures, 0); smbcli_close(cli1->tree, fnum); diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c index cdf68bd2ca..b8ef48eeb1 100644 --- a/source4/torture/smbtorture.c +++ b/source4/torture/smbtorture.c @@ -540,6 +540,8 @@ int main(int argc,char *argv[]) lp_set_cmdline(cmdline_lp_ctx, "torture:sacl_support", "false"); lp_set_cmdline(cmdline_lp_ctx, "torture:smblock_pdu_support", "false"); + lp_set_cmdline(cmdline_lp_ctx, "torture:2_step_break_to_none", + "true"); } if (max_runtime) { diff --git a/source4/torture/smbtorture.h b/source4/torture/smbtorture.h index 97678040e1..c7bbcf2d9d 100644 --- a/source4/torture/smbtorture.h +++ b/source4/torture/smbtorture.h @@ -85,4 +85,10 @@ bool torture_register_suite(struct torture_suite *suite); * * This parameter specifies whether the server supports the SMBLock (0x0C) PDU. */ +/* torture:2_step_break_to_none + * + * If true this parameter tests servers that break from level 1 to none in two + * steps rather than 1. + */ + #endif /* __SMBTORTURE_H__ */ -- cgit