s4:torture:base: add torture_comments to the loop of the deferopen test.
authorMichael Adam <obnox@samba.org>
Wed, 20 Aug 2014 13:42:27 +0000 (15:42 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 10 Sep 2014 08:49:10 +0000 (10:49 +0200)
This is to be able to better tell what went wrong if something
went wrong. This is currently one of the main flapping tests.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source4/torture/basic/base.c

index c7a7d8dc321c0997b9e5ad7c7a146d52053a3ed6..bd9a304f94317449f503e8b7f7fd8158c210fba8 100644 (file)
@@ -665,27 +665,55 @@ static bool run_deferopen(struct torture_context *tctx, struct smbcli_state *cli
 
        while (i < 4) {
                int fnum = -1;
+               int j = 1;
 
                do {
                        struct timeval tv;
                        tv = timeval_current();
+
+                       torture_comment(tctx,
+                                       "pid %u: create[%d,%d]...\n",
+                                       (unsigned)getpid(), i, j);
+
                        fnum = smbcli_nt_create_full(cli->tree, fname, 0, 
                                                     SEC_RIGHTS_FILE_ALL,
                                                     FILE_ATTRIBUTE_NORMAL, 
                                                     NTCREATEX_SHARE_ACCESS_NONE,
                                                     NTCREATEX_DISP_OPEN_IF, 0, 0);
+                       status = smbcli_nt_error(cli->tree);
+
+                       torture_comment(tctx,
+                                       "pid %u: create[%d,%d] gave fnum %d, status %s\n",
+                                       (unsigned)getpid(), i, j, fnum,
+                                       nt_errstr(status));
+
                        if (fnum != -1) {
                                break;
                        }
-                       if (NT_STATUS_EQUAL(smbcli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION)) {
+
+                       if (NT_STATUS_EQUAL(status, NT_STATUS_SHARING_VIOLATION)) {
                                double e = timeval_elapsed(&tv);
+
+                               torture_comment(tctx, "pid %u: create[%d,%d] "
+                                               "time elapsed: %.2f (1 sec = %.2f)\n",
+                                               (unsigned)getpid(), i, j, e, sec);
                                if (e < (0.5 * sec) || e > ((1.5 * sec) + 1)) {
+                                       torture_comment(tctx, "pid %u: create[%d,%d] "
+                                                       "timing incorrect\n",
+                                                       (unsigned)getpid(), i, j);
                                        torture_result(tctx, TORTURE_FAIL, "Timing incorrect %.2f violation 1 sec == %.2f\n",
                                                e, sec);
                                        return false;
                                }
                        }
-               } while (NT_STATUS_EQUAL(smbcli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION));
+
+                       j++;
+
+               } while (NT_STATUS_EQUAL(status, NT_STATUS_SHARING_VIOLATION));
+
+               torture_comment(tctx,
+                               "pid %u: create loop %d done: fnum %d, status %s\n",
+                               (unsigned)getpid(), i, fnum, nt_errstr(status));
 
                torture_assert(tctx, fnum != -1,
                               talloc_asprintf(tctx,
@@ -698,6 +726,10 @@ static bool run_deferopen(struct torture_context *tctx, struct smbcli_state *cli
                smb_msleep(10 * msec);
 
                status = smbcli_close(cli->tree, fnum);
+
+               torture_comment(tctx, "pid %u: open %d closed, status %s\n",
+                               (unsigned)getpid(), i, nt_errstr(status));
+
                torture_assert(tctx, !NT_STATUS_IS_ERR(status),
                               talloc_asprintf(tctx,
                                               "pid %u: Failed to close %s, "