diff options
author | Michael Adam <obnox@samba.org> | 2014-08-20 15:42:27 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2014-09-10 10:49:10 +0200 |
commit | 589344802df9916bbfcd12317e703d3b6cbbba8e (patch) | |
tree | db0f2794854eebdafb2efc9ad74a049e604670dc | |
parent | 485cf5654d33d540bb57c3c481295ac90d06dadc (diff) | |
download | samba-589344802df9916bbfcd12317e703d3b6cbbba8e.tar.gz samba-589344802df9916bbfcd12317e703d3b6cbbba8e.tar.xz samba-589344802df9916bbfcd12317e703d3b6cbbba8e.zip |
s4:torture:base: add torture_comments to the loop of the deferopen test.
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>
-rw-r--r-- | source4/torture/basic/base.c | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index c7a7d8dc32..bd9a304f94 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -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, " |