summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-08-14 01:03:56 +0000
committerAndrew Tridgell <tridge@samba.org>2003-08-14 01:03:56 +0000
commitb34df4fa86e7336244914acbbc48b99432a3b5c4 (patch)
tree2dda9886d9a823f5f83cbe9a356a3389612dd027 /source4
parent11d32f259f3a7b6634218c6625113aeb05f3f56b (diff)
downloadsamba-b34df4fa86e7336244914acbbc48b99432a3b5c4.tar.gz
samba-b34df4fa86e7336244914acbbc48b99432a3b5c4.tar.bz2
samba-b34df4fa86e7336244914acbbc48b99432a3b5c4.zip
added read/write seek testing
(This used to be commit 66691dc9582d4752ff1ab04a1b53c1e3c8fe64a1)
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/raw/seek.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/source4/torture/raw/seek.c b/source4/torture/raw/seek.c
index 7a69283347..de62f88695 100644
--- a/source4/torture/raw/seek.c
+++ b/source4/torture/raw/seek.c
@@ -50,6 +50,7 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
BOOL ret = True;
int fnum, fnum2;
const char *fname = BASEDIR "\\test.txt";
+ char c[2];
if (cli_deltree(cli, BASEDIR) == -1 ||
!cli_mkdir(cli, BASEDIR)) {
@@ -121,6 +122,29 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(io.out.offset, 999);
+ printf("trying read to update offset\n");
+ ZERO_STRUCT(c);
+ if (cli_write(cli, fnum, 0, c, 0, 2) != 2) {
+ printf("Write failed - %s\n", cli_errstr(cli));
+ ret = False;
+ goto done;
+ }
+ io.in.fnum = fnum;
+ io.in.mode = SEEK_MODE_CURRENT;
+ io.in.offset = 0;
+ status = smb_raw_seek(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_VALUE(io.out.offset, 2);
+
+ if (cli_read(cli, fnum, c, 0, 1) != 1) {
+ printf("Read failed - %s\n", cli_errstr(cli));
+ ret = False;
+ goto done;
+ }
+ status = smb_raw_seek(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_VALUE(io.out.offset, 1);
+
printf("Testing position information\n");
fnum2 = cli_open(cli, fname, O_RDWR, DENY_NONE);
if (fnum2 == -1) {
@@ -144,7 +168,7 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
finfo.position_information.in.fnum = fnum;
status = smb_raw_fileinfo(cli->tree, mem_ctx, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
- CHECK_VALUE(finfo.position_information.out.position, 0);
+ CHECK_VALUE(finfo.position_information.out.position, 1);
printf("position_information via paths\n");