diff options
author | Jeremy Allison <jra@samba.org> | 2009-06-05 16:06:05 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2009-06-05 16:06:05 -0700 |
commit | 64a1f17aff1d17b74398fb270aac5768fd312cf6 (patch) | |
tree | 1c72b2b6a127b46b8fdc6e6d0e90b1f07e9acbaa /source3/torture | |
parent | 68a1ef21971b5c15db5d0a82acc89791ffceaee0 (diff) | |
download | samba-64a1f17aff1d17b74398fb270aac5768fd312cf6.tar.gz samba-64a1f17aff1d17b74398fb270aac5768fd312cf6.tar.bz2 samba-64a1f17aff1d17b74398fb270aac5768fd312cf6.zip |
Make cli_ftruncate async. Also add a simple test.
Jeremy.
Diffstat (limited to 'source3/torture')
-rw-r--r-- | source3/torture/torture.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source3/torture/torture.c b/source3/torture/torture.c index d185a71727..056b74adea 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -4144,6 +4144,7 @@ static bool run_simple_posix_open_test(int dummy) uint16 major, minor; uint32 caplow, caphigh; uint16_t fnum1 = (uint16_t)-1; + SMB_STRUCT_STAT sbuf; bool correct = false; printf("Starting simple POSIX open test\n"); @@ -4191,6 +4192,29 @@ static bool run_simple_posix_open_test(int dummy) goto out; } + /* Test ftruncate - set file size. */ + if (!NT_STATUS_IS_OK(cli_ftruncate(cli1, fnum1, 1000))) { + printf("ftruncate failed (%s)\n", cli_errstr(cli1)); + goto out; + } + + /* Ensure st_size == 1000 */ + if (!NT_STATUS_IS_OK(cli_posix_stat(cli1, fname, &sbuf))) { + printf("stat failed (%s)\n", cli_errstr(cli1)); + goto out; + } + + if (sbuf.st_ex_size != 1000) { + printf("ftruncate - stat size (%u) != 1000\n", (unsigned int)sbuf.st_ex_size); + goto out; + } + + /* Test ftruncate - set file size back to zero. */ + if (!NT_STATUS_IS_OK(cli_ftruncate(cli1, fnum1, 0))) { + printf("ftruncate failed (%s)\n", cli_errstr(cli1)); + goto out; + } + if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) { printf("close failed (%s)\n", cli_errstr(cli1)); goto out; |