s4:torture/vfs/fruit: update test "stream names" to work with macOS
authorRalph Boehme <slow@samba.org>
Mon, 15 Oct 2018 13:39:12 +0000 (15:39 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 31 Oct 2018 20:27:19 +0000 (21:27 +0100)
o create the basefile before trying to create a stream on it, otherwise
  this fails on macOS

o write something to the stream, otherwise the stream is not listed as
  macOS hides 0-byte sized streams

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source4/torture/vfs/fruit.c

index 0e463a7..681dde5 100644 (file)
@@ -3132,6 +3132,9 @@ static bool test_stream_names(struct torture_context *tctx,
        CHECK_STATUS(status, NT_STATUS_OK);
        smb2_util_close(tree, h);
 
+       ret = torture_setup_file(mem_ctx, tree, fname, false);
+       torture_assert_goto(tctx, ret, ret, done, "torture_setup_file");
+
        torture_comment(tctx, "(%s) testing stream names\n", __location__);
        ZERO_STRUCT(create);
        create.in.desired_access = SEC_FILE_WRITE_DATA;
@@ -3146,6 +3149,11 @@ static bool test_stream_names(struct torture_context *tctx,
 
        status = smb2_create(tree, mem_ctx, &create);
        CHECK_STATUS(status, NT_STATUS_OK);
+
+       status = smb2_util_write(tree, create.out.file.handle, "foo", 0, 3);
+       torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+                                       "smb2_util_write failed\n");
+
        smb2_util_close(tree, create.out.file.handle);
 
        ret = check_stream_list(tree, tctx, fname, 2, streams, false);