torture: Use torture_assert{,_int_equal}_goto() in smb2.kernel-oplocks
authorAndrew Bartlett <abartlet@samba.org>
Wed, 29 Nov 2017 20:35:20 +0000 (09:35 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 30 Nov 2017 04:48:34 +0000 (05:48 +0100)
This allows this test to be added as flapping.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
source4/torture/smb2/oplock.c

index b6d9f842336c29cefaf4b6da515caa4a88687be2..6d749f92c1c1ec4a5c88a7683f9b3380035f5495 100644 (file)
@@ -5040,7 +5040,8 @@ static bool test_smb2_kernel_oplocks8(struct torture_context *tctx,
        io.in.fname = fname;
 
        req = smb2_create_send(tree, &io);
-       torture_assert(tctx, req != NULL, "smb2_create_send");
+       torture_assert_goto(tctx, req != NULL,
+                           ret, done, "smb2_create_send");
 
        /* Ensure while the open is blocked the smbd is
           still serving other requests. */
@@ -5058,7 +5059,8 @@ static bool test_smb2_kernel_oplocks8(struct torture_context *tctx,
        h1 = io.out.file.handle;
 
        /* in less than 2 seconds. Otherwise the server blocks. */
-       torture_assert(tctx, end - start < 2, "server was blocked !");
+       torture_assert_goto(tctx, end - start < 2,
+                           ret, done, "server was blocked !");
 
        /* Pick up the return for the initial blocking open. */
        status = smb2_create_recv(req, tctx, &io);
@@ -5071,14 +5073,12 @@ static bool test_smb2_kernel_oplocks8(struct torture_context *tctx,
        /* Wait for the exit code from the child. */
        while (child_exit_code == -1) {
                int rval = tevent_loop_once(tctx->ev);
-               torture_assert(tctx, rval == 0, "tevent_loop_once error\n");
+               torture_assert_goto(tctx, rval == 0, ret,
+                                   done, "tevent_loop_once error\n");
        }
 
-       if (child_exit_code != 0) {
-               torture_comment(tctx, "Bad child exit code %d\n",
-                       child_exit_code);
-               ret = false;
-       }
+       torture_assert_int_equal_goto(tctx, child_exit_code, 0,
+                                     ret, done, "Bad child exit code");
 
 done:
        if (!smb2_util_handle_empty(h1)) {