s4 torture: Allow some implementations to break from level1 to none with two breaks
authorTim Prouty <tprouty@samba.org>
Tue, 1 Dec 2009 23:29:00 +0000 (15:29 -0800)
committerTim Prouty <tprouty@samba.org>
Fri, 4 Dec 2009 02:54:52 +0000 (18:54 -0800)
source4/torture/raw/oplock.c
source4/torture/smbtorture.c
source4/torture/smbtorture.h

index 283fed2252f694e6a5bccf66a265c75cf199ac18..106acfe7933b62ca02eb1ce5bfd888f7c60c03b5 100644 (file)
@@ -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);
index cdf68bd2cab845e8a3911d3fd746d21017e13e3a..b8ef48eeb16fa191ea2838b2a96ce0e8ce0684f8 100644 (file)
@@ -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) {
index 97678040e14c01d1ad8502703cf9564de087a9da..c7bbcf2d9d6ef82ca850b99555bd4553c4d783bf 100644 (file)
@@ -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__ */