2 Unix SMB/CIFS implementation.
3 test suite for various read operations
4 Copyright (C) Andrew Tridgell 2003
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #define CHECK_STATUS(status, correct) do { \
24 if (!NT_STATUS_EQUAL(status, correct)) { \
25 printf("(%d) Incorrect status %s - should be %s\n", \
26 __LINE__, nt_errstr(status), nt_errstr(correct)); \
31 #define CHECK_VALUE(v, correct) do { \
32 if ((v) != (correct)) { \
33 printf("(%d) Incorrect value %s=%d - should be %d\n", \
34 __LINE__, #v, v, correct); \
39 #define CHECK_BUFFER(buf, seed, len) do { \
40 if (!check_buffer(buf, seed, len, __LINE__)) { \
45 #define BASEDIR "\\testread"
49 setup a random buffer based on a seed
51 static void setup_buffer(char *buf, unsigned seed, int len)
55 for (i=0;i<len;i++) buf[i] = random();
59 check a random buffer based on a seed
61 static BOOL check_buffer(char *buf, unsigned seed, int len, int line)
68 printf("Buffer incorrect at line %d! ofs=%d v1=0x%x v2=0x%x\n",
79 static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
86 const int maxsize = 90000;
87 const char *fname = BASEDIR "\\test.txt";
88 const char *test_data = "TEST DATA";
89 unsigned seed = time(NULL);
91 buf = talloc_zero(mem_ctx, maxsize);
93 if (cli_deltree(cli, BASEDIR) == -1 ||
94 !cli_mkdir(cli, BASEDIR)) {
95 printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
99 printf("Testing RAW_READ_READ\n");
100 io.generic.level = RAW_READ_READ;
102 fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
104 printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
109 printf("Trying empty file read\n");
110 io.read.in.fnum = fnum;
111 io.read.in.count = 1;
112 io.read.in.offset = 0;
113 io.read.in.remaining = 0;
114 io.read.out.data = buf;
115 status = smb_raw_read(cli->tree, &io);
117 CHECK_STATUS(status, NT_STATUS_OK);
118 CHECK_VALUE(io.read.out.nread, 0);
120 printf("Trying zero file read\n");
121 io.read.in.count = 0;
122 status = smb_raw_read(cli->tree, &io);
123 CHECK_STATUS(status, NT_STATUS_OK);
124 CHECK_VALUE(io.read.out.nread, 0);
126 printf("Trying bad fnum\n");
127 io.read.in.fnum = fnum+1;
128 status = smb_raw_read(cli->tree, &io);
129 CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
130 io.read.in.fnum = fnum;
132 cli_write(cli, fnum, 0, test_data, 0, strlen(test_data));
134 printf("Trying small read\n");
135 io.read.in.fnum = fnum;
136 io.read.in.offset = 0;
137 io.read.in.remaining = 0;
138 io.read.in.count = strlen(test_data);
139 status = smb_raw_read(cli->tree, &io);
140 CHECK_STATUS(status, NT_STATUS_OK);
141 CHECK_VALUE(io.read.out.nread, strlen(test_data));
142 if (memcmp(buf, test_data, strlen(test_data)) != 0) {
144 printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data, buf);
148 printf("Trying short read\n");
149 io.read.in.offset = 1;
150 io.read.in.count = strlen(test_data);
151 status = smb_raw_read(cli->tree, &io);
152 CHECK_STATUS(status, NT_STATUS_OK);
153 CHECK_VALUE(io.read.out.nread, strlen(test_data)-1);
154 if (memcmp(buf, test_data+1, strlen(test_data)-1) != 0) {
156 printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data+1, buf);
160 printf("Trying max offset\n");
161 io.read.in.offset = ~0;
162 io.read.in.count = strlen(test_data);
163 status = smb_raw_read(cli->tree, &io);
164 CHECK_STATUS(status, NT_STATUS_OK);
165 CHECK_VALUE(io.read.out.nread, 0);
167 setup_buffer(buf, seed, maxsize);
168 cli_write(cli, fnum, 0, buf, 0, maxsize);
169 memset(buf, 0, maxsize);
171 printf("Trying large read\n");
172 io.read.in.offset = 0;
173 io.read.in.count = ~0;
174 status = smb_raw_read(cli->tree, &io);
175 CHECK_STATUS(status, NT_STATUS_OK);
176 CHECK_BUFFER(buf, seed, io.read.out.nread);
179 printf("Trying locked region\n");
181 if (!cli_lock(cli, fnum, 103, 1, 0, WRITE_LOCK)) {
182 printf("Failed to lock file at %d\n", __LINE__);
187 memset(buf, 0, maxsize);
188 io.read.in.offset = 0;
189 io.read.in.count = ~0;
190 status = smb_raw_read(cli->tree, &io);
191 CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
195 cli_close(cli, fnum);
196 smb_raw_exit(cli->session);
197 cli_deltree(cli, BASEDIR);
205 static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
212 const int maxsize = 90000;
213 const char *fname = BASEDIR "\\test.txt";
214 const char *test_data = "TEST DATA";
215 unsigned seed = time(NULL);
217 buf = talloc_zero(mem_ctx, maxsize);
219 if (cli_deltree(cli, BASEDIR) == -1 ||
220 !cli_mkdir(cli, BASEDIR)) {
221 printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
225 printf("Testing RAW_READ_LOCKREAD\n");
226 io.generic.level = RAW_READ_LOCKREAD;
228 fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
230 printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
235 printf("Trying empty file read\n");
236 io.lockread.in.fnum = fnum;
237 io.lockread.in.count = 1;
238 io.lockread.in.offset = 0;
239 io.lockread.in.remaining = 0;
240 io.lockread.out.data = buf;
241 status = smb_raw_read(cli->tree, &io);
243 CHECK_STATUS(status, NT_STATUS_OK);
244 CHECK_VALUE(io.lockread.out.nread, 0);
246 printf("Trying zero file read\n");
247 io.lockread.in.count = 0;
248 status = smb_raw_read(cli->tree, &io);
249 CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
251 printf("Trying bad fnum\n");
252 io.lockread.in.fnum = fnum+1;
253 status = smb_raw_read(cli->tree, &io);
254 CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
255 io.lockread.in.fnum = fnum;
257 cli_write(cli, fnum, 0, test_data, 0, strlen(test_data));
259 printf("Trying small read\n");
260 io.lockread.in.fnum = fnum;
261 io.lockread.in.offset = 0;
262 io.lockread.in.remaining = 0;
263 io.lockread.in.count = strlen(test_data);
264 status = smb_raw_read(cli->tree, &io);
265 CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
267 cli_unlock(cli, fnum, 0, 1);
269 status = smb_raw_read(cli->tree, &io);
270 CHECK_STATUS(status, NT_STATUS_OK);
271 CHECK_VALUE(io.lockread.out.nread, strlen(test_data));
272 if (memcmp(buf, test_data, strlen(test_data)) != 0) {
274 printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data, buf);
278 printf("Trying short read\n");
279 io.lockread.in.offset = 1;
280 io.lockread.in.count = strlen(test_data);
281 status = smb_raw_read(cli->tree, &io);
282 CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
283 cli_unlock(cli, fnum, 0, strlen(test_data));
284 status = smb_raw_read(cli->tree, &io);
285 CHECK_STATUS(status, NT_STATUS_OK);
287 CHECK_VALUE(io.lockread.out.nread, strlen(test_data)-1);
288 if (memcmp(buf, test_data+1, strlen(test_data)-1) != 0) {
290 printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data+1, buf);
294 printf("Trying max offset\n");
295 io.lockread.in.offset = ~0;
296 io.lockread.in.count = strlen(test_data);
297 status = smb_raw_read(cli->tree, &io);
298 CHECK_STATUS(status, NT_STATUS_OK);
299 CHECK_VALUE(io.lockread.out.nread, 0);
301 setup_buffer(buf, seed, maxsize);
302 cli_write(cli, fnum, 0, buf, 0, maxsize);
303 memset(buf, 0, maxsize);
305 printf("Trying large read\n");
306 io.lockread.in.offset = 0;
307 io.lockread.in.count = ~0;
308 status = smb_raw_read(cli->tree, &io);
309 CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
310 cli_unlock(cli, fnum, 1, strlen(test_data));
311 status = smb_raw_read(cli->tree, &io);
312 CHECK_STATUS(status, NT_STATUS_OK);
313 CHECK_BUFFER(buf, seed, io.lockread.out.nread);
314 cli_unlock(cli, fnum, 0, 0xFFFF);
317 printf("Trying locked region\n");
319 if (!cli_lock(cli, fnum, 103, 1, 0, WRITE_LOCK)) {
320 printf("Failed to lock file at %d\n", __LINE__);
325 memset(buf, 0, maxsize);
326 io.lockread.in.offset = 0;
327 io.lockread.in.count = ~0;
328 status = smb_raw_read(cli->tree, &io);
329 CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
333 cli_close(cli, fnum);
334 cli_deltree(cli, BASEDIR);
342 static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
349 const int maxsize = 90000;
350 const char *fname = BASEDIR "\\test.txt";
351 const char *test_data = "TEST DATA";
352 unsigned seed = time(NULL);
354 buf = talloc_zero(mem_ctx, maxsize);
356 if (cli_deltree(cli, BASEDIR) == -1 ||
357 !cli_mkdir(cli, BASEDIR)) {
358 printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
362 printf("Testing RAW_READ_READX\n");
364 fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
366 printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
371 printf("Trying empty file read\n");
372 io.generic.level = RAW_READ_READX;
373 io.readx.in.fnum = fnum;
374 io.readx.in.mincnt = 1;
375 io.readx.in.maxcnt = 1;
376 io.readx.in.offset = 0;
377 io.readx.in.remaining = 0;
378 io.readx.out.data = buf;
379 status = smb_raw_read(cli->tree, &io);
381 CHECK_STATUS(status, NT_STATUS_OK);
382 CHECK_VALUE(io.readx.out.nread, 0);
383 CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
384 CHECK_VALUE(io.readx.out.compaction_mode, 0);
386 printf("Trying zero file read\n");
387 io.readx.in.mincnt = 0;
388 io.readx.in.maxcnt = 0;
389 status = smb_raw_read(cli->tree, &io);
390 CHECK_STATUS(status, NT_STATUS_OK);
391 CHECK_VALUE(io.readx.out.nread, 0);
392 CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
393 CHECK_VALUE(io.readx.out.compaction_mode, 0);
395 printf("Trying bad fnum\n");
396 io.readx.in.fnum = fnum+1;
397 status = smb_raw_read(cli->tree, &io);
398 CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
399 io.readx.in.fnum = fnum;
401 cli_write(cli, fnum, 0, test_data, 0, strlen(test_data));
403 printf("Trying small read\n");
404 io.readx.in.fnum = fnum;
405 io.readx.in.offset = 0;
406 io.readx.in.remaining = 0;
407 io.readx.in.mincnt = strlen(test_data);
408 io.readx.in.maxcnt = strlen(test_data);
409 status = smb_raw_read(cli->tree, &io);
410 CHECK_STATUS(status, NT_STATUS_OK);
411 CHECK_VALUE(io.readx.out.nread, strlen(test_data));
412 CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
413 CHECK_VALUE(io.readx.out.compaction_mode, 0);
414 if (memcmp(buf, test_data, strlen(test_data)) != 0) {
416 printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data, buf);
420 printf("Trying short read\n");
421 io.readx.in.offset = 1;
422 io.readx.in.mincnt = strlen(test_data);
423 io.readx.in.maxcnt = strlen(test_data);
424 status = smb_raw_read(cli->tree, &io);
425 CHECK_STATUS(status, NT_STATUS_OK);
426 CHECK_VALUE(io.readx.out.nread, strlen(test_data)-1);
427 CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
428 CHECK_VALUE(io.readx.out.compaction_mode, 0);
429 if (memcmp(buf, test_data+1, strlen(test_data)-1) != 0) {
431 printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data+1, buf);
435 printf("Trying max offset\n");
436 io.readx.in.offset = 0xffffffff;
437 io.readx.in.mincnt = strlen(test_data);
438 io.readx.in.maxcnt = strlen(test_data);
439 status = smb_raw_read(cli->tree, &io);
440 CHECK_STATUS(status, NT_STATUS_OK);
441 CHECK_VALUE(io.readx.out.nread, 0);
442 CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
443 CHECK_VALUE(io.readx.out.compaction_mode, 0);
445 setup_buffer(buf, seed, maxsize);
446 cli_write(cli, fnum, 0, buf, 0, maxsize);
447 memset(buf, 0, maxsize);
449 printf("Trying large read\n");
450 io.readx.in.offset = 0;
451 io.readx.in.mincnt = ~0;
452 io.readx.in.maxcnt = ~0;
453 status = smb_raw_read(cli->tree, &io);
454 CHECK_STATUS(status, NT_STATUS_OK);
455 CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
456 CHECK_VALUE(io.readx.out.compaction_mode, 0);
457 CHECK_VALUE(io.readx.out.nread, io.readx.in.maxcnt);
458 CHECK_BUFFER(buf, seed, io.readx.out.nread);
460 printf("Trying mincnt > maxcnt\n");
461 memset(buf, 0, maxsize);
462 io.readx.in.offset = 0;
463 io.readx.in.mincnt = 30000;
464 io.readx.in.maxcnt = 20000;
465 status = smb_raw_read(cli->tree, &io);
466 CHECK_STATUS(status, NT_STATUS_OK);
467 CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
468 CHECK_VALUE(io.readx.out.compaction_mode, 0);
469 CHECK_VALUE(io.readx.out.nread, io.readx.in.maxcnt);
470 CHECK_BUFFER(buf, seed, io.readx.out.nread);
472 printf("Trying mincnt < maxcnt\n");
473 memset(buf, 0, maxsize);
474 io.readx.in.offset = 0;
475 io.readx.in.mincnt = 20000;
476 io.readx.in.maxcnt = 30000;
477 status = smb_raw_read(cli->tree, &io);
478 CHECK_STATUS(status, NT_STATUS_OK);
479 CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
480 CHECK_VALUE(io.readx.out.compaction_mode, 0);
481 CHECK_VALUE(io.readx.out.nread, io.readx.in.maxcnt);
482 CHECK_BUFFER(buf, seed, io.readx.out.nread);
484 printf("Trying locked region\n");
486 if (!cli_lock(cli, fnum, 103, 1, 0, WRITE_LOCK)) {
487 printf("Failed to lock file at %d\n", __LINE__);
492 memset(buf, 0, maxsize);
493 io.readx.in.offset = 0;
494 io.readx.in.mincnt = 100;
495 io.readx.in.maxcnt = 200;
496 status = smb_raw_read(cli->tree, &io);
497 CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
499 #ifdef LARGE_SMB_OFF_T
500 printf("Trying large offset read\n");
501 io.readx.in.offset = ((SMB_BIG_UINT)0x2) << 32;
502 io.readx.in.mincnt = 10;
503 io.readx.in.maxcnt = 10;
504 status = smb_raw_read(cli->tree, &io);
505 CHECK_STATUS(status, NT_STATUS_OK);
506 CHECK_VALUE(io.readx.out.nread, 0);
508 if (!cli_lock64(cli, fnum, io.readx.in.offset, 1, 0, WRITE_LOCK)) {
509 printf("Failed to lock file at %d\n", __LINE__);
514 status = smb_raw_read(cli->tree, &io);
515 CHECK_STATUS(status, NT_STATUS_OK);
516 CHECK_VALUE(io.readx.out.nread, 0);
520 cli_close(cli, fnum);
521 cli_deltree(cli, BASEDIR);
529 static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
536 const int maxsize = 90000;
537 const char *fname = BASEDIR "\\test.txt";
538 const char *test_data = "TEST DATA";
539 unsigned seed = time(NULL);
541 buf = talloc_zero(mem_ctx, maxsize);
543 if (cli_deltree(cli, BASEDIR) == -1 ||
544 !cli_mkdir(cli, BASEDIR)) {
545 printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
549 printf("Testing RAW_READ_READBRAW\n");
551 fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
553 printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
558 printf("Trying empty file read\n");
559 io.generic.level = RAW_READ_READBRAW;
560 io.readbraw.in.fnum = fnum;
561 io.readbraw.in.mincnt = 1;
562 io.readbraw.in.maxcnt = 1;
563 io.readbraw.in.offset = 0;
564 io.readbraw.in.timeout = 0;
565 io.readbraw.out.data = buf;
566 status = smb_raw_read(cli->tree, &io);
568 CHECK_STATUS(status, NT_STATUS_OK);
569 CHECK_VALUE(io.readbraw.out.nread, 0);
571 printf("Trying zero file read\n");
572 io.readbraw.in.mincnt = 0;
573 io.readbraw.in.maxcnt = 0;
574 status = smb_raw_read(cli->tree, &io);
575 CHECK_STATUS(status, NT_STATUS_OK);
576 CHECK_VALUE(io.readbraw.out.nread, 0);
578 printf("Trying bad fnum\n");
579 io.readbraw.in.fnum = fnum+1;
580 status = smb_raw_read(cli->tree, &io);
581 CHECK_STATUS(status, NT_STATUS_OK);
582 CHECK_VALUE(io.readbraw.out.nread, 0);
583 io.readbraw.in.fnum = fnum;
585 cli_write(cli, fnum, 0, test_data, 0, strlen(test_data));
587 printf("Trying small read\n");
588 io.readbraw.in.fnum = fnum;
589 io.readbraw.in.offset = 0;
590 io.readbraw.in.mincnt = strlen(test_data);
591 io.readbraw.in.maxcnt = strlen(test_data);
592 status = smb_raw_read(cli->tree, &io);
593 CHECK_STATUS(status, NT_STATUS_OK);
594 CHECK_VALUE(io.readbraw.out.nread, strlen(test_data));
595 if (memcmp(buf, test_data, strlen(test_data)) != 0) {
597 printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data, buf);
601 printf("Trying short read\n");
602 io.readbraw.in.offset = 1;
603 io.readbraw.in.mincnt = strlen(test_data);
604 io.readbraw.in.maxcnt = strlen(test_data);
605 status = smb_raw_read(cli->tree, &io);
606 CHECK_STATUS(status, NT_STATUS_OK);
607 CHECK_VALUE(io.readbraw.out.nread, strlen(test_data)-1);
608 if (memcmp(buf, test_data+1, strlen(test_data)-1) != 0) {
610 printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data+1, buf);
614 printf("Trying max offset\n");
615 io.readbraw.in.offset = ~0;
616 io.readbraw.in.mincnt = strlen(test_data);
617 io.readbraw.in.maxcnt = strlen(test_data);
618 status = smb_raw_read(cli->tree, &io);
619 CHECK_STATUS(status, NT_STATUS_OK);
620 CHECK_VALUE(io.readbraw.out.nread, 0);
622 setup_buffer(buf, seed, maxsize);
623 cli_write(cli, fnum, 0, buf, 0, maxsize);
624 memset(buf, 0, maxsize);
626 printf("Trying large read\n");
627 io.readbraw.in.offset = 0;
628 io.readbraw.in.mincnt = ~0;
629 io.readbraw.in.maxcnt = ~0;
630 status = smb_raw_read(cli->tree, &io);
631 CHECK_STATUS(status, NT_STATUS_OK);
632 CHECK_VALUE(io.readbraw.out.nread, 0xFFFF);
633 CHECK_BUFFER(buf, seed, io.readbraw.out.nread);
635 printf("Trying mincnt > maxcnt\n");
636 memset(buf, 0, maxsize);
637 io.readbraw.in.offset = 0;
638 io.readbraw.in.mincnt = 30000;
639 io.readbraw.in.maxcnt = 20000;
640 status = smb_raw_read(cli->tree, &io);
641 CHECK_STATUS(status, NT_STATUS_OK);
642 CHECK_VALUE(io.readbraw.out.nread, io.readbraw.in.maxcnt);
643 CHECK_BUFFER(buf, seed, io.readbraw.out.nread);
645 printf("Trying mincnt < maxcnt\n");
646 memset(buf, 0, maxsize);
647 io.readbraw.in.offset = 0;
648 io.readbraw.in.mincnt = 20000;
649 io.readbraw.in.maxcnt = 30000;
650 status = smb_raw_read(cli->tree, &io);
651 CHECK_STATUS(status, NT_STATUS_OK);
652 CHECK_VALUE(io.readbraw.out.nread, io.readbraw.in.maxcnt);
653 CHECK_BUFFER(buf, seed, io.readbraw.out.nread);
655 printf("Trying locked region\n");
657 if (!cli_lock(cli, fnum, 103, 1, 0, WRITE_LOCK)) {
658 printf("Failed to lock file at %d\n", __LINE__);
663 memset(buf, 0, maxsize);
664 io.readbraw.in.offset = 0;
665 io.readbraw.in.mincnt = 100;
666 io.readbraw.in.maxcnt = 200;
667 status = smb_raw_read(cli->tree, &io);
668 CHECK_STATUS(status, NT_STATUS_OK);
669 CHECK_VALUE(io.readbraw.out.nread, 0);
671 printf("Trying locked region with timeout\n");
672 memset(buf, 0, maxsize);
673 io.readbraw.in.offset = 0;
674 io.readbraw.in.mincnt = 100;
675 io.readbraw.in.maxcnt = 200;
676 io.readbraw.in.timeout = 10000;
677 status = smb_raw_read(cli->tree, &io);
678 CHECK_STATUS(status, NT_STATUS_OK);
679 CHECK_VALUE(io.readbraw.out.nread, 0);
681 #ifdef LARGE_SMB_OFF_T
682 printf("Trying large offset read\n");
683 io.readbraw.in.offset = ((SMB_BIG_UINT)0x2) << 32;
684 io.readbraw.in.mincnt = 10;
685 io.readbraw.in.maxcnt = 10;
686 io.readbraw.in.timeout = 0;
687 status = smb_raw_read(cli->tree, &io);
688 CHECK_STATUS(status, NT_STATUS_OK);
689 CHECK_VALUE(io.readbraw.out.nread, 0);
693 cli_close(cli, fnum);
694 cli_deltree(cli, BASEDIR);
700 basic testing of read calls
702 BOOL torture_raw_read(int dummy)
704 struct cli_state *cli;
708 if (!torture_open_connection(&cli)) {
712 mem_ctx = talloc_init("torture_raw_read");
714 if (!test_read(cli, mem_ctx)) {
718 if (!test_readx(cli, mem_ctx)) {
722 if (!test_lockread(cli, mem_ctx)) {
726 if (!test_readbraw(cli, mem_ctx)) {
730 torture_close_connection(cli);
731 talloc_destroy(mem_ctx);