summaryrefslogtreecommitdiff
path: root/source4/torture/raw/write.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-08-28 12:54:27 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:03:00 -0500
commit919aa6b27e5fe49b70c814210aa026c19be66e8a (patch)
tree4f1cff79459133a014a32e3f42fa787c7d83de67 /source4/torture/raw/write.c
parentb42691ee167415c7dc89d50b4ba18909bacd40c1 (diff)
downloadsamba-919aa6b27e5fe49b70c814210aa026c19be66e8a.tar.gz
samba-919aa6b27e5fe49b70c814210aa026c19be66e8a.tar.bz2
samba-919aa6b27e5fe49b70c814210aa026c19be66e8a.zip
r24735: Use torture API in more places.
(This used to be commit 1319d88c099496be29dd9214fa2492c81e848369)
Diffstat (limited to 'source4/torture/raw/write.c')
-rw-r--r--source4/torture/raw/write.c48
1 files changed, 21 insertions, 27 deletions
diff --git a/source4/torture/raw/write.c b/source4/torture/raw/write.c
index 9b043bfe2c..75d275fc3c 100644
--- a/source4/torture/raw/write.c
+++ b/source4/torture/raw/write.c
@@ -51,12 +51,12 @@
#define CHECK_ALL_INFO(v, field) do { \
finfo.all_info.level = RAW_FILEINFO_ALL_INFO; \
finfo.all_info.in.file.path = fname; \
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo); \
+ status = smb_raw_pathinfo(cli->tree, tctx, &finfo); \
CHECK_STATUS(status, NT_STATUS_OK); \
if ((v) != finfo.all_info.out.field) { \
printf("(%s) wrong value for field %s %.0f - %.0f\n", \
__location__, #field, (double)v, (double)finfo.all_info.out.field); \
- dump_all_info(mem_ctx, &finfo); \
+ dump_all_info(tctx, &finfo); \
ret = False; \
}} while (0)
@@ -95,7 +95,8 @@ static BOOL check_buffer(uint8_t *buf, uint_t seed, int len, const char *locatio
/*
test write ops
*/
-static BOOL test_write(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_write(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
union smb_write io;
NTSTATUS status;
@@ -107,7 +108,7 @@ static BOOL test_write(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
uint_t seed = time(NULL);
union smb_fileinfo finfo;
- buf = talloc_zero_size(mem_ctx, maxsize);
+ buf = talloc_zero_size(tctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
@@ -222,7 +223,8 @@ done:
/*
test writex ops
*/
-static BOOL test_writex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_writex(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
union smb_write io;
NTSTATUS status;
@@ -240,7 +242,7 @@ static BOOL test_writex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("dangerous not set - limiting range of test to 2^%d\n", max_bits);
}
- buf = talloc_zero_size(mem_ctx, maxsize);
+ buf = talloc_zero_size(tctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
@@ -409,7 +411,8 @@ done:
/*
test write unlock ops
*/
-static BOOL test_writeunlock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_writeunlock(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
union smb_write io;
NTSTATUS status;
@@ -421,7 +424,7 @@ static BOOL test_writeunlock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
uint_t seed = time(NULL);
union smb_fileinfo finfo;
- buf = talloc_zero_size(mem_ctx, maxsize);
+ buf = talloc_zero_size(tctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
@@ -551,7 +554,8 @@ done:
/*
test write close ops
*/
-static BOOL test_writeclose(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_writeclose(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
union smb_write io;
NTSTATUS status;
@@ -563,7 +567,7 @@ static BOOL test_writeclose(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
uint_t seed = time(NULL);
union smb_fileinfo finfo;
- buf = talloc_zero_size(mem_ctx, maxsize);
+ buf = talloc_zero_size(tctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
@@ -706,24 +710,14 @@ done:
/*
basic testing of write calls
*/
-BOOL torture_raw_write(struct torture_context *torture)
+struct torture_suite *torture_raw_write(TALLOC_CTX *mem_ctx)
{
- struct smbcli_state *cli;
- BOOL ret = True;
- TALLOC_CTX *mem_ctx;
-
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_raw_write");
+ struct torture_suite *suite = torture_suite_create(mem_ctx, "WRITE");
- ret &= test_write(cli, mem_ctx);
- ret &= test_writeunlock(cli, mem_ctx);
- ret &= test_writeclose(cli, mem_ctx);
- ret &= test_writex(cli, mem_ctx);
+ torture_suite_add_1smb_test(suite, "write", test_write);
+ torture_suite_add_1smb_test(suite, "write unlock", test_writeunlock);
+ torture_suite_add_1smb_test(suite, "write close", test_writeclose);
+ torture_suite_add_1smb_test(suite, "writex", test_writex);
- torture_close_connection(cli);
- talloc_free(mem_ctx);
- return ret;
+ return suite;
}