summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachary Loafman <zachary.loafman@isilon.com>2009-11-16 21:13:26 +0000
committerTim Prouty <tprouty@samba.org>2009-12-03 20:21:22 -0800
commit5882282deaf3ce06c18fe2102f7f8dcc6e79b409 (patch)
tree06f03444ccda7cc9b9907a9441d89ef3917c1362
parent60d9828ade304dc7aa9b01f1be1dfea86b04248e (diff)
downloadsamba-5882282deaf3ce06c18fe2102f7f8dcc6e79b409.tar.gz
samba-5882282deaf3ce06c18fe2102f7f8dcc6e79b409.tar.bz2
samba-5882282deaf3ce06c18fe2102f7f8dcc6e79b409.zip
s4 torture: Allow READ to be parameterized, add more readx tests
Signed-off-by: Tim Prouty <tprouty@samba.org>
-rw-r--r--source4/torture/raw/read.c31
-rw-r--r--source4/torture/smbtorture.c1
2 files changed, 30 insertions, 2 deletions
diff --git a/source4/torture/raw/read.c b/source4/torture/raw/read.c
index 3b48aac848..90ca18d5b6 100644
--- a/source4/torture/raw/read.c
+++ b/source4/torture/raw/read.c
@@ -94,13 +94,18 @@ static bool test_read(struct torture_context *tctx, struct smbcli_state *cli)
buf = talloc_zero_array(tctx, uint8_t, maxsize);
+ if (!torture_setting_bool(tctx, "read_support", true)) {
+ printf("server refuses to support READ\n");
+ return true;
+ }
+
if (!torture_setup_dir(cli, BASEDIR)) {
return false;
}
printf("Testing RAW_READ_READ\n");
io.generic.level = RAW_READ_READ;
-
+
fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
@@ -478,7 +483,29 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli)
smbcli_write(cli->tree, fnum, 0, buf, 0, maxsize);
memset(buf, 0, maxsize);
- printf("Trying large read\n");
+ printf("Trying page sized read\n");
+ io.readx.in.offset = 0;
+ io.readx.in.mincnt = 0x1000;
+ io.readx.in.maxcnt = 0x1000;
+ status = smb_raw_read(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
+ CHECK_VALUE(io.readx.out.compaction_mode, 0);
+ CHECK_VALUE(io.readx.out.nread, io.readx.in.maxcnt);
+ CHECK_BUFFER(buf, seed, io.readx.out.nread);
+
+ printf("Trying page + 1 sized read (check alignment)\n");
+ io.readx.in.offset = 0;
+ io.readx.in.mincnt = 0x1001;
+ io.readx.in.maxcnt = 0x1001;
+ status = smb_raw_read(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
+ CHECK_VALUE(io.readx.out.compaction_mode, 0);
+ CHECK_VALUE(io.readx.out.nread, io.readx.in.maxcnt);
+ CHECK_BUFFER(buf, seed, io.readx.out.nread);
+
+ printf("Trying large read (UINT16_MAX)\n");
io.readx.in.offset = 0;
io.readx.in.mincnt = 0xFFFF;
io.readx.in.maxcnt = 0xFFFF;
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index 747911e5a9..d02ec2961b 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -548,6 +548,7 @@ int main(int argc,char *argv[])
"true");
lp_set_cmdline(cmdline_lp_ctx, "torture:deny_dos_support", "false");
lp_set_cmdline(cmdline_lp_ctx, "torture:deny_fcb_support", "false");
+ lp_set_cmdline(cmdline_lp_ctx, "torture:read_support", "false");
}
if (max_runtime) {