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 smb_raw_exit(cli->session);
196 cli_deltree(cli, BASEDIR);
204 static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
211 const int maxsize = 90000;
212 const char *fname = BASEDIR "\\test.txt";
213 const char *test_data = "TEST DATA";
214 unsigned seed = time(NULL);
216 buf = talloc_zero(mem_ctx, maxsize);
218 if (cli_deltree(cli, BASEDIR) == -1 ||
219 !cli_mkdir(cli, BASEDIR)) {
220 printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
224 printf("Testing RAW_READ_LOCKREAD\n");
225 io.generic.level = RAW_READ_LOCKREAD;
227 fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
229 printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
234 printf("Trying empty file read\n");
235 io.lockread.in.fnum = fnum;
236 io.lockread.in.count = 1;
237 io.lockread.in.offset = 0;
238 io.lockread.in.remaining = 0;
239 io.lockread.out.data = buf;
240 status = smb_raw_read(cli->tree, &io);
242 CHECK_STATUS(status, NT_STATUS_OK);
243 CHECK_VALUE(io.lockread.out.nread, 0);
245 printf("Trying zero file read\n");
246 io.lockread.in.count = 0;
247 status = smb_raw_read(cli->tree, &io);
248 CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
250 printf("Trying bad fnum\n");
251 io.lockread.in.fnum = fnum+1;
252 status = smb_raw_read(cli->tree, &io);
253 CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
254 io.lockread.in.fnum = fnum;
256 cli_write(cli, fnum, 0, test_data, 0, strlen(test_data));
258 printf("Trying small read\n");
259 io.lockread.in.fnum = fnum;
260 io.lockread.in.offset = 0;
261 io.lockread.in.remaining = 0;
262 io.lockread.in.count = strlen(test_data);
263 status = smb_raw_read(cli->tree, &io);
264 CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
266 cli_unlock(cli, fnum, 0, 1);
268 status = smb_raw_read(cli->tree, &io);
269 CHECK_STATUS(status, NT_STATUS_OK);
270 CHECK_VALUE(io.lockread.out.nread, strlen(test_data));
271 if (memcmp(buf, test_data, strlen(test_data)) != 0) {
273 printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data, buf);
277 printf("Trying short read\n");
278 io.lockread.in.offset = 1;
279 io.lockread.in.count = strlen(test_data);
280 status = smb_raw_read(cli->tree, &io);
281 CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
282 cli_unlock(cli, fnum, 0, strlen(test_data));
283 status = smb_raw_read(cli->tree, &io);
284 CHECK_STATUS(status, NT_STATUS_OK);
286 CHECK_VALUE(io.lockread.out.nread, strlen(test_data)-1);
287 if (memcmp(buf, test_data+1, strlen(test_data)-1) != 0) {
289 printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data+1, buf);
293 printf("Trying max offset\n");
294 io.lockread.in.offset = ~0;
295 io.lockread.in.count = strlen(test_data);
296 status = smb_raw_read(cli->tree, &io);
297 CHECK_STATUS(status, NT_STATUS_OK);
298 CHECK_VALUE(io.lockread.out.nread, 0);
300 setup_buffer(buf, seed, maxsize);
301 cli_write(cli, fnum, 0, buf, 0, maxsize);
302 memset(buf, 0, maxsize);
304 printf("Trying large read\n");
305 io.lockread.in.offset = 0;
306 io.lockread.in.count = ~0;
307 status = smb_raw_read(cli->tree, &io);
308 CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
309 cli_unlock(cli, fnum, 1, strlen(test_data));
310 status = smb_raw_read(cli->tree, &io);
311 CHECK_STATUS(status, NT_STATUS_OK);
312 CHECK_BUFFER(buf, seed, io.lockread.out.nread);
313 cli_unlock(cli, fnum, 0, 0xFFFF);
316 printf("Trying locked region\n");
318 if (!cli_lock(cli, fnum, 103, 1, 0, WRITE_LOCK)) {
319 printf("Failed to lock file at %d\n", __LINE__);
324 memset(buf, 0, maxsize);
325 io.lockread.in.offset = 0;
326 io.lockread.in.count = ~0;
327 status = smb_raw_read(cli->tree, &io);
328 CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
332 cli_close(cli, fnum);
333 cli_deltree(cli, BASEDIR);
341 static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
348 const int maxsize = 90000;
349 const char *fname = BASEDIR "\\test.txt";
350 const char *test_data = "TEST DATA";
351 unsigned seed = time(NULL);
353 buf = talloc_zero(mem_ctx, maxsize);
355 if (cli_deltree(cli, BASEDIR) == -1 ||
356 !cli_mkdir(cli, BASEDIR)) {
357 printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
361 printf("Testing RAW_READ_READX\n");
363 fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
365 printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
370 printf("Trying empty file read\n");
371 io.generic.level = RAW_READ_READX;
372 io.readx.in.fnum = fnum;
373 io.readx.in.mincnt = 1;
374 io.readx.in.maxcnt = 1;
375 io.readx.in.offset = 0;
376 io.readx.in.remaining = 0;
377 io.readx.out.data = buf;
378 status = smb_raw_read(cli->tree, &io);
380 CHECK_STATUS(status, NT_STATUS_OK);
381 CHECK_VALUE(io.readx.out.nread, 0);
382 CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
383 CHECK_VALUE(io.readx.out.compaction_mode, 0);
385 printf("Trying zero file read\n");
386 io.readx.in.mincnt = 0;
387 io.readx.in.maxcnt = 0;
388 status = smb_raw_read(cli->tree, &io);
389 CHECK_STATUS(status, NT_STATUS_OK);
390 CHECK_VALUE(io.readx.out.nread, 0);
391 CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
392 CHECK_VALUE(io.readx.out.compaction_mode, 0);
394 printf("Trying bad fnum\n");
395 io.readx.in.fnum = fnum+1;
396 status = smb_raw_read(cli->tree, &io);
397 CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
398 io.readx.in.fnum = fnum;
400 cli_write(cli, fnum, 0, test_data, 0, strlen(test_data));
402 printf("Trying small read\n");
403 io.readx.in.fnum = fnum;
404 io.readx.in.offset = 0;
405 io.readx.in.remaining = 0;
406 io.readx.in.mincnt = strlen(test_data);
407 io.readx.in.maxcnt = strlen(test_data);
408 status = smb_raw_read(cli->tree, &io);
409 CHECK_STATUS(status, NT_STATUS_OK);
410 CHECK_VALUE(io.readx.out.nread, strlen(test_data));
411 CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
412 CHECK_VALUE(io.readx.out.compaction_mode, 0);
413 if (memcmp(buf, test_data, strlen(test_data)) != 0) {
415 printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data, buf);
419 printf("Trying short read\n");
420 io.readx.in.offset = 1;
421 io.readx.in.mincnt = strlen(test_data);
422 io.readx.in.maxcnt = strlen(test_data);
423 status = smb_raw_read(cli->tree, &io);
424 CHECK_STATUS(status, NT_STATUS_OK);
425 CHECK_VALUE(io.readx.out.nread, strlen(test_data)-1);
426 CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
427 CHECK_VALUE(io.readx.out.compaction_mode, 0);
428 if (memcmp(buf, test_data+1, strlen(test_data)-1) != 0) {
430 printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data+1, buf);
434 printf("Trying max offset\n");
435 io.readx.in.offset = 0xffffffff;
436 io.readx.in.mincnt = strlen(test_data);
437 io.readx.in.maxcnt = strlen(test_data);
438 status = smb_raw_read(cli->tree, &io);
439 CHECK_STATUS(status, NT_STATUS_OK);
440 CHECK_VALUE(io.readx.out.nread, 0);
441 CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
442 CHECK_VALUE(io.readx.out.compaction_mode, 0);
444 setup_buffer(buf, seed, maxsize);
445 cli_write(cli, fnum, 0, buf, 0, maxsize);
446 memset(buf, 0, maxsize);
448 printf("Trying large read\n");
449 io.readx.in.offset = 0;
450 io.readx.in.mincnt = ~0;
451 io.readx.in.maxcnt = ~0;
452 status = smb_raw_read(cli->tree, &io);
453 CHECK_STATUS(status, NT_STATUS_OK);
454 CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
455 CHECK_VALUE(io.readx.out.compaction_mode, 0);
456 CHECK_VALUE(io.readx.out.nread, io.readx.in.maxcnt);
457 CHECK_BUFFER(buf, seed, io.readx.out.nread);
459 printf("Trying mincnt > maxcnt\n");
460 memset(buf, 0, maxsize);
461 io.readx.in.offset = 0;
462 io.readx.in.mincnt = 30000;
463 io.readx.in.maxcnt = 20000;
464 status = smb_raw_read(cli->tree, &io);
465 CHECK_STATUS(status, NT_STATUS_OK);
466 CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
467 CHECK_VALUE(io.readx.out.compaction_mode, 0);
468 CHECK_VALUE(io.readx.out.nread, io.readx.in.maxcnt);
469 CHECK_BUFFER(buf, seed, io.readx.out.nread);
471 printf("Trying mincnt < maxcnt\n");
472 memset(buf, 0, maxsize);
473 io.readx.in.offset = 0;
474 io.readx.in.mincnt = 20000;
475 io.readx.in.maxcnt = 30000;
476 status = smb_raw_read(cli->tree, &io);
477 CHECK_STATUS(status, NT_STATUS_OK);
478 CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
479 CHECK_VALUE(io.readx.out.compaction_mode, 0);
480 CHECK_VALUE(io.readx.out.nread, io.readx.in.maxcnt);
481 CHECK_BUFFER(buf, seed, io.readx.out.nread);
483 printf("Trying locked region\n");
485 if (!cli_lock(cli, fnum, 103, 1, 0, WRITE_LOCK)) {
486 printf("Failed to lock file at %d\n", __LINE__);
491 memset(buf, 0, maxsize);
492 io.readx.in.offset = 0;
493 io.readx.in.mincnt = 100;
494 io.readx.in.maxcnt = 200;
495 status = smb_raw_read(cli->tree, &io);
496 CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
498 #ifdef LARGE_SMB_OFF_T
499 printf("Trying large offset read\n");
500 io.readx.in.offset = ((SMB_BIG_UINT)0x2) << 32;
501 io.readx.in.mincnt = 10;
502 io.readx.in.maxcnt = 10;
503 status = smb_raw_read(cli->tree, &io);
504 CHECK_STATUS(status, NT_STATUS_OK);
505 CHECK_VALUE(io.readx.out.nread, 0);
507 if (!cli_lock64(cli, fnum, io.readx.in.offset, 1, 0, WRITE_LOCK)) {
508 printf("Failed to lock file at %d\n", __LINE__);
513 status = smb_raw_read(cli->tree, &io);
514 CHECK_STATUS(status, NT_STATUS_OK);
515 CHECK_VALUE(io.readx.out.nread, 0);
519 cli_close(cli, fnum);
520 cli_deltree(cli, BASEDIR);
528 static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
535 const int maxsize = 90000;
536 const char *fname = BASEDIR "\\test.txt";
537 const char *test_data = "TEST DATA";
538 unsigned seed = time(NULL);
540 buf = talloc_zero(mem_ctx, maxsize);
542 if (cli_deltree(cli, BASEDIR) == -1 ||
543 !cli_mkdir(cli, BASEDIR)) {
544 printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
548 printf("Testing RAW_READ_READBRAW\n");
550 fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
552 printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
557 printf("Trying empty file read\n");
558 io.generic.level = RAW_READ_READBRAW;
559 io.readbraw.in.fnum = fnum;
560 io.readbraw.in.mincnt = 1;
561 io.readbraw.in.maxcnt = 1;
562 io.readbraw.in.offset = 0;
563 io.readbraw.in.timeout = 0;
564 io.readbraw.out.data = buf;
565 status = smb_raw_read(cli->tree, &io);
567 CHECK_STATUS(status, NT_STATUS_OK);
568 CHECK_VALUE(io.readbraw.out.nread, 0);
570 printf("Trying zero file read\n");
571 io.readbraw.in.mincnt = 0;
572 io.readbraw.in.maxcnt = 0;
573 status = smb_raw_read(cli->tree, &io);
574 CHECK_STATUS(status, NT_STATUS_OK);
575 CHECK_VALUE(io.readbraw.out.nread, 0);
577 printf("Trying bad fnum\n");
578 io.readbraw.in.fnum = fnum+1;
579 status = smb_raw_read(cli->tree, &io);
580 CHECK_STATUS(status, NT_STATUS_OK);
581 CHECK_VALUE(io.readbraw.out.nread, 0);
582 io.readbraw.in.fnum = fnum;
584 cli_write(cli, fnum, 0, test_data, 0, strlen(test_data));
586 printf("Trying small read\n");
587 io.readbraw.in.fnum = fnum;
588 io.readbraw.in.offset = 0;
589 io.readbraw.in.mincnt = strlen(test_data);
590 io.readbraw.in.maxcnt = strlen(test_data);
591 status = smb_raw_read(cli->tree, &io);
592 CHECK_STATUS(status, NT_STATUS_OK);
593 CHECK_VALUE(io.readbraw.out.nread, strlen(test_data));
594 if (memcmp(buf, test_data, strlen(test_data)) != 0) {
596 printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data, buf);
600 printf("Trying short read\n");
601 io.readbraw.in.offset = 1;
602 io.readbraw.in.mincnt = strlen(test_data);
603 io.readbraw.in.maxcnt = strlen(test_data);
604 status = smb_raw_read(cli->tree, &io);
605 CHECK_STATUS(status, NT_STATUS_OK);
606 CHECK_VALUE(io.readbraw.out.nread, strlen(test_data)-1);
607 if (memcmp(buf, test_data+1, strlen(test_data)-1) != 0) {
609 printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data+1, buf);
613 printf("Trying max offset\n");
614 io.readbraw.in.offset = ~0;
615 io.readbraw.in.mincnt = strlen(test_data);
616 io.readbraw.in.maxcnt = strlen(test_data);
617 status = smb_raw_read(cli->tree, &io);
618 CHECK_STATUS(status, NT_STATUS_OK);
619 CHECK_VALUE(io.readbraw.out.nread, 0);
621 setup_buffer(buf, seed, maxsize);
622 cli_write(cli, fnum, 0, buf, 0, maxsize);
623 memset(buf, 0, maxsize);
625 printf("Trying large read\n");
626 io.readbraw.in.offset = 0;
627 io.readbraw.in.mincnt = ~0;
628 io.readbraw.in.maxcnt = ~0;
629 status = smb_raw_read(cli->tree, &io);
630 CHECK_STATUS(status, NT_STATUS_OK);
631 CHECK_VALUE(io.readbraw.out.nread, 0xFFFF);
632 CHECK_BUFFER(buf, seed, io.readbraw.out.nread);
634 printf("Trying mincnt > maxcnt\n");
635 memset(buf, 0, maxsize);
636 io.readbraw.in.offset = 0;
637 io.readbraw.in.mincnt = 30000;
638 io.readbraw.in.maxcnt = 20000;
639 status = smb_raw_read(cli->tree, &io);
640 CHECK_STATUS(status, NT_STATUS_OK);
641 CHECK_VALUE(io.readbraw.out.nread, io.readbraw.in.maxcnt);
642 CHECK_BUFFER(buf, seed, io.readbraw.out.nread);
644 printf("Trying mincnt < maxcnt\n");
645 memset(buf, 0, maxsize);
646 io.readbraw.in.offset = 0;
647 io.readbraw.in.mincnt = 20000;
648 io.readbraw.in.maxcnt = 30000;
649 status = smb_raw_read(cli->tree, &io);
650 CHECK_STATUS(status, NT_STATUS_OK);
651 CHECK_VALUE(io.readbraw.out.nread, io.readbraw.in.maxcnt);
652 CHECK_BUFFER(buf, seed, io.readbraw.out.nread);
654 printf("Trying locked region\n");
656 if (!cli_lock(cli, fnum, 103, 1, 0, WRITE_LOCK)) {
657 printf("Failed to lock file at %d\n", __LINE__);
662 memset(buf, 0, maxsize);
663 io.readbraw.in.offset = 0;
664 io.readbraw.in.mincnt = 100;
665 io.readbraw.in.maxcnt = 200;
666 status = smb_raw_read(cli->tree, &io);
667 CHECK_STATUS(status, NT_STATUS_OK);
668 CHECK_VALUE(io.readbraw.out.nread, 0);
670 printf("Trying locked region with timeout\n");
671 memset(buf, 0, maxsize);
672 io.readbraw.in.offset = 0;
673 io.readbraw.in.mincnt = 100;
674 io.readbraw.in.maxcnt = 200;
675 io.readbraw.in.timeout = 10000;
676 status = smb_raw_read(cli->tree, &io);
677 CHECK_STATUS(status, NT_STATUS_OK);
678 CHECK_VALUE(io.readbraw.out.nread, 0);
680 #ifdef LARGE_SMB_OFF_T
681 printf("Trying large offset read\n");
682 io.readbraw.in.offset = ((SMB_BIG_UINT)0x2) << 32;
683 io.readbraw.in.mincnt = 10;
684 io.readbraw.in.maxcnt = 10;
685 io.readbraw.in.timeout = 0;
686 status = smb_raw_read(cli->tree, &io);
687 CHECK_STATUS(status, NT_STATUS_OK);
688 CHECK_VALUE(io.readbraw.out.nread, 0);
692 cli_close(cli, fnum);
693 cli_deltree(cli, BASEDIR);
699 basic testing of read calls
701 BOOL torture_raw_read(int dummy)
703 struct cli_state *cli;
707 if (!torture_open_connection(&cli)) {
711 mem_ctx = talloc_init("torture_raw_read");
713 if (!test_read(cli, mem_ctx)) {
717 if (!test_readx(cli, mem_ctx)) {
721 if (!test_lockread(cli, mem_ctx)) {
725 if (!test_readbraw(cli, mem_ctx)) {
729 torture_close_connection(cli);
730 talloc_destroy(mem_ctx);