s3-torture: introduce test_cli_read()
authorBjörn Baumbach <bb@sernet.de>
Fri, 22 Jul 2011 08:48:35 +0000 (10:48 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 22 Jul 2011 15:06:08 +0000 (17:06 +0200)
test_cli_read calls cli_read and returns success or failure

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/torture/torture.c

index c197de98cb601de6ad1457c46027098a1297ea52..aa24a180122484b62b9db544dbe59c7cdf5459ee 100644 (file)
@@ -1905,6 +1905,28 @@ static bool run_locktest3(int dummy)
        return correct;
 }
 
+static bool test_cli_read(struct cli_state *cli, uint16_t fnum,
+                           char *buf, off_t offset, size_t size,
+                           size_t *nread, size_t expect)
+{
+       NTSTATUS status;
+       size_t l_nread;
+
+       status = cli_read(cli, fnum, buf, offset, size, &l_nread);
+
+       if(!NT_STATUS_IS_OK(status)) {
+               return false;
+       } else if (l_nread != expect) {
+               return false;
+       }
+
+       if (nread) {
+               *nread = l_nread;
+       }
+
+       return true;
+}
+
 #define EXPECTED(ret, v) if ((ret) != (v)) { \
         printf("** "); correct = False; \
         }