diff options
author | Ralph Boehme <slow@samba.org> | 2015-12-17 19:22:12 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2016-01-06 10:07:15 +0100 |
commit | 3bf18468484cc38ef8f85df6730f1088d6b3244e (patch) | |
tree | b3ecd7a4d5b38d88611113a8b4c9b4889e64965f /source4/torture | |
parent | b883c09a2baa7e9645b4cfc0867928f1c6999d29 (diff) | |
download | samba-3bf18468484cc38ef8f85df6730f1088d6b3244e.tar.gz |
s4:torture:vfs_fruit: enhance check_stream
Don't sleep when create fails and use torture_ macros.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit fdf937e77da29ec47002855db69d9e3f95005479)
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/vfs/fruit.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/source4/torture/vfs/fruit.c b/source4/torture/vfs/fruit.c index 92dc24f6656..a102026f58c 100644 --- a/source4/torture/vfs/fruit.c +++ b/source4/torture/vfs/fruit.c @@ -900,7 +900,8 @@ static bool check_stream(struct smb2_tree *tree, struct smb2_create create; struct smb2_read r; NTSTATUS status; - const char *full_name; + char *full_name; + bool ret = true; full_name = talloc_asprintf(mem_ctx, "%s%s", fname, sname); if (full_name == NULL) { @@ -917,22 +918,21 @@ static bool check_stream(struct smb2_tree *tree, status = smb2_create(tree, mem_ctx, &create); if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(full_name); if (value == NULL) { return true; - } else { - torture_comment(tctx, "Unable to open stream %s\n", - full_name); - sleep(10000000); - return false; } + torture_comment(tctx, "Unable to open stream %s\n", full_name); + return false; } handle = create.out.file.handle; if (value == NULL) { + TALLOC_FREE(full_name); + smb2_util_close(tree, handle); return true; } - ZERO_STRUCT(r); r.in.file.handle = handle; r.in.length = read_count; @@ -940,19 +940,24 @@ static bool check_stream(struct smb2_tree *tree, status = smb2_read(tree, tree, &r); - if (!NT_STATUS_IS_OK(status)) { - torture_comment(tctx, "(%s) Failed to read %lu bytes from " - "stream '%s'\n", location, (long)strlen(value), full_name); - return false; - } + torture_assert_ntstatus_ok_goto( + tctx, status, ret, done, + talloc_asprintf(tctx, "(%s) Failed to read %lu bytes from stream '%s'\n", + location, (long)strlen(value), full_name)); - if (memcmp(r.out.data.data + comp_offset, value, comp_count) != 0) { - torture_comment(tctx, "(%s) Bad data in stream\n", location); - return false; - } + torture_assert_goto(tctx, r.out.data.length == read_count, ret, done, + talloc_asprintf(tctx, "smb2_read returned %jd bytes, expected %jd\n", + (intmax_t)r.out.data.length, (intmax_t)read_count)); + torture_assert_goto( + tctx, memcmp(r.out.data.data + comp_offset, value, comp_count) == 0, + ret, done, + talloc_asprintf(tctx, "(%s) Bad data in stream\n", location)); + +done: + TALLOC_FREE(full_name); smb2_util_close(tree, handle); - return true; + return ret; } /** |