summaryrefslogtreecommitdiff
path: root/source4/torture/local
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture/local')
-rw-r--r--source4/torture/local/binding_string.c48
-rw-r--r--source4/torture/local/event.c36
-rw-r--r--source4/torture/local/idtree.c14
-rw-r--r--source4/torture/local/irpc.c99
-rw-r--r--source4/torture/local/messaging.c42
-rw-r--r--source4/torture/local/ndr.c17
-rw-r--r--source4/torture/local/registry.c40
-rw-r--r--source4/torture/local/resolve.c19
8 files changed, 167 insertions, 148 deletions
diff --git a/source4/torture/local/binding_string.c b/source4/torture/local/binding_string.c
index 4405bf0256..a7b6cd14b4 100644
--- a/source4/torture/local/binding_string.c
+++ b/source4/torture/local/binding_string.c
@@ -26,38 +26,37 @@
#include "torture/torture.h"
#include "torture/ui.h"
-static BOOL test_BindingString(struct torture_context *torture, const char *binding)
+static BOOL test_BindingString(struct torture_context *torture,
+ const void *_binding)
{
+ const char *binding = _binding;
struct dcerpc_binding *b, *b2;
const char *s, *s2;
struct epm_tower tower;
- NTSTATUS status;
- struct torture_test *test = torture_test(torture, binding, binding);
/* Parse */
- torture_assert_ntstatus_ok(test,
- dcerpc_parse_binding(test, binding, &b),
+ torture_assert_ntstatus_ok(torture,
+ dcerpc_parse_binding(torture, binding, &b),
"Error parsing binding string");
- s = dcerpc_binding_string(test, b);
+ s = dcerpc_binding_string(torture, b);
if (!s) {
- torture_fail(test, "Error converting binding back to string");
- talloc_free(test);
+ torture_fail(torture, "Error converting binding back to string");
return False;
}
- torture_assert_casestr_equal(test, binding, s,
+ torture_assert_casestr_equal(torture, binding, s,
"Mismatch while comparing original and regenerated binding strings");
/* Generate protocol towers */
- torture_assert_ntstatus_ok(test,
- dcerpc_binding_build_tower(test, b, &tower),
+ torture_assert_ntstatus_ok(torture,
+ dcerpc_binding_build_tower(torture, b, &tower),
"Error generating protocol tower");
/* Convert back to binding and then back to string and compare */
- torture_assert_ntstatus_ok(test,
- dcerpc_binding_from_tower(test, &tower, &b2),
+ torture_assert_ntstatus_ok(torture,
+ dcerpc_binding_from_tower(torture, &tower, &b2),
"Error generating binding from tower for original binding");
/* Compare to a stripped down version of the binding string because
@@ -66,29 +65,24 @@ static BOOL test_BindingString(struct torture_context *torture, const char *bind
b->flags = 0;
- s = dcerpc_binding_string(test, b);
+ s = dcerpc_binding_string(torture, b);
if (!s) {
- torture_fail(test, "Error converting binding back to string for (stripped down)");
- talloc_free(test);
+ torture_fail(torture, "Error converting binding back to string for (stripped down)");
return False;
}
- s2 = dcerpc_binding_string(test, b2);
+ s2 = dcerpc_binding_string(torture, b2);
if (!s) {
- torture_fail(test, "Error converting binding back to string");
- talloc_free(test);
+ torture_fail(torture, "Error converting binding back to string");
return False;
}
if (is_ipaddress(b->host) && strcasecmp(s, s2) != 0) {
- torture_fail(test, "Mismatch while comparing original and from protocol tower generated binding strings: '%s' <> '%s'\n", s, s2);
- talloc_free(test);
+ torture_fail(torture, "Mismatch while comparing original and from protocol tower generated binding strings: '%s' <> '%s'\n", s, s2);
return False;
}
- torture_ok(test);
- talloc_free(test);
return True;
}
@@ -119,12 +113,14 @@ static const char *test_strings[] = {
BOOL torture_local_binding_string(struct torture_context *torture)
{
- BOOL ret = True;
int i;
+ struct torture_suite *suite = torture_suite_create(torture,
+ "LOCAL-BINDING");
for (i = 0; i < ARRAY_SIZE(test_strings); i++) {
- ret &= test_BindingString(torture, test_strings[i]);
+ torture_suite_add_simple_tcase(suite, test_strings[i],
+ test_BindingString, test_strings[i]);
}
- return ret;
+ return torture_run_suite(torture, suite);
}
diff --git a/source4/torture/local/event.c b/source4/torture/local/event.c
index 79f5413595..d886519220 100644
--- a/source4/torture/local/event.c
+++ b/source4/torture/local/event.c
@@ -34,7 +34,7 @@ static int write_fd, read_fd;
static struct fd_event *fde;
static int te_count;
static int fde_count;
-static struct torture_test *test;
+static struct torture_context *test;
static void fde_handler(struct event_context *ev_ctx, struct fd_event *f,
uint16_t flags, void *private)
@@ -75,11 +75,17 @@ static void timed_handler(struct event_context *ev_ctx, struct timed_event *te,
event_add_timed(ev_ctx, ev_ctx, timeval_current_ofs(0,500), timed_handler, private);
}
-static BOOL test_event_context(struct torture_context *torture, struct event_context *ev_ctx, const char *comment)
+static BOOL test_event_context(struct torture_context *torture, const void *_data)
{
+ struct event_context *ev_ctx;
int fd[2] = { -1, -1 };
+ BOOL try_epoll = (BOOL)_data;
+
+ ev_ctx = event_context_init_ops(torture,
+ event_standard_get_ops(),
+ &try_epoll);
- test = torture_test(torture, comment, comment);
+ test = torture;
/* reset globals */
write_fd = -1;
@@ -101,30 +107,24 @@ static BOOL test_event_context(struct torture_context *torture, struct event_con
close(read_fd);
close(write_fd);
+
+ talloc_free(ev_ctx);
- torture_ok(test);
- talloc_free(test);
return True;
}
BOOL torture_local_event(struct torture_context *torture)
{
- struct event_context *ev_ctx;
- BOOL try_epoll;
BOOL retv = True;
+ struct torture_suite *suite = torture_suite_create(torture, "LOCAL-EVENT");
- try_epoll = False;
- ev_ctx = event_context_init_ops(torture, event_standard_get_ops(),
- &try_epoll);
- retv &= test_event_context(torture, ev_ctx, "standard with select");
- talloc_free(ev_ctx);
+ torture_suite_add_simple_tcase(suite, "standard with select",
+ test_event_context,
+ (void *)False);
- try_epoll = True;
- ev_ctx = event_context_init_ops(torture, event_standard_get_ops(),
- &try_epoll);
- retv &= test_event_context(torture, ev_ctx,
- "standard try epool (or select)");
- talloc_free(ev_ctx);
+ torture_suite_add_simple_tcase(suite, "standard try epoll (or select)",
+ test_event_context,
+ (void *)True);
return retv;
}
diff --git a/source4/torture/local/idtree.c b/source4/torture/local/idtree.c
index 8d776219db..a81eddedc3 100644
--- a/source4/torture/local/idtree.c
+++ b/source4/torture/local/idtree.c
@@ -24,7 +24,8 @@
#include "torture/torture.h"
#include "torture/ui.h"
-BOOL torture_local_idtree(struct torture_context *torture)
+static BOOL torture_local_idtree_simple(struct torture_context *test,
+ const void *_data)
{
struct idr_context *idr;
int i;
@@ -32,7 +33,6 @@ BOOL torture_local_idtree(struct torture_context *torture)
int *present;
extern int torture_numops;
int n = torture_numops;
- struct torture_test *test = torture_test(torture, "idtree", "idtree");
idr = idr_init(test);
@@ -90,7 +90,13 @@ BOOL torture_local_idtree(struct torture_context *torture)
torture_comment(test, "cleaned up");
- talloc_free(test);
+ return True;
+}
- return torture_result(torture);
+BOOL torture_local_idtree(struct torture_context *torture)
+{
+ struct torture_suite *suite = torture_suite_create(torture, "LOCAL-IDTREE");
+ torture_suite_add_simple_tcase(suite, "idtree", torture_local_idtree_simple,
+ NULL);
+ return torture_run_suite(torture, suite);
}
diff --git a/source4/torture/local/irpc.c b/source4/torture/local/irpc.c
index 5fbf76beb2..b90f91d19b 100644
--- a/source4/torture/local/irpc.c
+++ b/source4/torture/local/irpc.c
@@ -31,6 +31,12 @@ const uint32_t MSG_ID1 = 1, MSG_ID2 = 2;
static BOOL test_debug;
+struct irpc_test_data
+{
+ struct messaging_context *msg_ctx1, *msg_ctx2;
+ struct event_context *ev;
+};
+
/*
serve up AddOne over the irpc system
*/
@@ -75,22 +81,19 @@ static NTSTATUS irpc_EchoData(struct irpc_message *irpc, struct echo_EchoData *r
/*
test a addone call over the internal messaging system
*/
-static BOOL test_addone(struct torture_test *parent_test,
- struct messaging_context *msg_ctx1,
- struct messaging_context *msg_ctx2,
- uint32_t value)
+static BOOL test_addone(struct torture_context *test, const void *_data,
+ const void *_value)
{
struct echo_AddOne r;
NTSTATUS status;
-
- struct torture_test *test = torture_subtest(parent_test, "test_addone",
- "test_addone");
+ const struct irpc_test_data *data = _data;
+ uint32_t value = (uint32_t)value;
/* make the call */
r.in.in_data = value;
test_debug = True;
- status = IRPC_CALL(msg_ctx1, MSG_ID2, rpcecho, ECHO_ADDONE, &r, test);
+ status = IRPC_CALL(data->msg_ctx1, MSG_ID2, rpcecho, ECHO_ADDONE, &r, test);
test_debug = False;
torture_assert_ntstatus_ok(test, status, "AddOne failed");
@@ -107,21 +110,19 @@ static BOOL test_addone(struct torture_test *parent_test,
/*
test a echodata call over the internal messaging system
*/
-static BOOL test_echodata(struct torture_test *parent_test,
- struct messaging_context *msg_ctx1,
- struct messaging_context *msg_ctx2)
+static BOOL test_echodata(struct torture_context *test,
+ const void *_data, const void *_data2)
{
struct echo_EchoData r;
NTSTATUS status;
-
- struct torture_test *test = torture_subtest(parent_test, "test_echodata",
- "test_echodata");
+ const struct irpc_test_data *data = _data;
/* make the call */
r.in.in_data = (unsigned char *)talloc_strdup(test, "0123456789");
r.in.len = strlen((char *)r.in.in_data);
- status = IRPC_CALL(msg_ctx1, MSG_ID2, rpcecho, ECHO_ECHODATA, &r, test);
+ status = IRPC_CALL(data->msg_ctx1, MSG_ID2, rpcecho, ECHO_ECHODATA, &r,
+ test);
torture_assert_ntstatus_ok(test, status, "EchoData failed");
/* check the answer */
@@ -159,20 +160,17 @@ static void irpc_callback(struct irpc_request *irpc)
/*
test echo speed
*/
-static BOOL test_speed(struct torture_test *parent_test,
- struct messaging_context *msg_ctx1,
- struct messaging_context *msg_ctx2,
- struct event_context *ev)
+static BOOL test_speed(struct torture_context *test,
+ const void *_data,
+ const void *_data2)
{
int ping_count = 0;
int pong_count = 0;
+ const struct irpc_test_data *data = _data;
struct timeval tv;
struct echo_AddOne r;
int timelimit = lp_parm_int(-1, "torture", "timelimit", 10);
- struct torture_test *test = torture_subtest(parent_test, "test_speed",
- "test_speed");
-
tv = timeval_current();
r.in.in_data = 0;
@@ -181,7 +179,8 @@ static BOOL test_speed(struct torture_test *parent_test,
while (timeval_elapsed(&tv) < timelimit) {
struct irpc_request *irpc;
- irpc = IRPC_CALL_SEND(msg_ctx1, MSG_ID2, rpcecho, ECHO_ADDONE, &r, test);
+ irpc = IRPC_CALL_SEND(data->msg_ctx1, MSG_ID2, rpcecho, ECHO_ADDONE,
+ &r, test);
torture_assert(test, irpc != NULL, "AddOne send failed");
irpc->async.fn = irpc_callback;
@@ -190,14 +189,14 @@ static BOOL test_speed(struct torture_test *parent_test,
ping_count++;
while (ping_count > pong_count + 20) {
- event_loop_once(ev);
+ event_loop_once(data->ev);
}
}
torture_comment(test, "waiting for %d remaining replies (done %d)",
ping_count - pong_count, pong_count);
while (timeval_elapsed(&tv) < 30 && pong_count < ping_count) {
- event_loop_once(ev);
+ event_loop_once(data->ev);
}
if (ping_count != pong_count) {
@@ -212,39 +211,49 @@ static BOOL test_speed(struct torture_test *parent_test,
}
-BOOL torture_local_irpc(struct torture_context *torture)
+static BOOL irpc_setup(struct torture_context *test, void **_data)
{
- struct torture_test *test = torture_test(torture, "torture_local_irpc", "");
- struct messaging_context *msg_ctx1, *msg_ctx2;
- struct event_context *ev;
+ struct irpc_test_data *data;
+
+ *_data = data = talloc(test, struct irpc_test_data);
lp_set_cmdline("lock dir", "lockdir.tmp");
- ev = event_context_init(test);
+ data->ev = event_context_init(test);
torture_assert(test,
- msg_ctx1 = messaging_init(test, MSG_ID1, ev),
+ data->msg_ctx1 = messaging_init(test, MSG_ID1, data->ev),
"Failed to init first messaging context");
torture_assert(test,
- msg_ctx2 = messaging_init(test, MSG_ID2, ev),
+ data->msg_ctx2 = messaging_init(test, MSG_ID2, data->ev),
"Failed to init second messaging context");
/* register the server side function */
- IRPC_REGISTER(msg_ctx1, rpcecho, ECHO_ADDONE, irpc_AddOne, NULL);
- IRPC_REGISTER(msg_ctx2, rpcecho, ECHO_ADDONE, irpc_AddOne, NULL);
+ IRPC_REGISTER(data->msg_ctx1, rpcecho, ECHO_ADDONE, irpc_AddOne, NULL);
+ IRPC_REGISTER(data->msg_ctx2, rpcecho, ECHO_ADDONE, irpc_AddOne, NULL);
- IRPC_REGISTER(msg_ctx1, rpcecho, ECHO_ECHODATA, irpc_EchoData, NULL);
- IRPC_REGISTER(msg_ctx2, rpcecho, ECHO_ECHODATA, irpc_EchoData, NULL);
+ IRPC_REGISTER(data->msg_ctx1, rpcecho, ECHO_ECHODATA, irpc_EchoData, NULL);
+ IRPC_REGISTER(data->msg_ctx2, rpcecho, ECHO_ECHODATA, irpc_EchoData, NULL);
- test_addone(test, msg_ctx1, msg_ctx2, 0);
- test_addone(test, msg_ctx1, msg_ctx2, 0x7FFFFFFE);
- test_addone(test, msg_ctx1, msg_ctx2, 0xFFFFFFFE);
- test_addone(test, msg_ctx1, msg_ctx2, 0xFFFFFFFF);
- test_addone(test, msg_ctx1, msg_ctx2, random() & 0xFFFFFFFF);
- test_echodata(test, msg_ctx1, msg_ctx2);
- test_speed(test, msg_ctx1, msg_ctx2, ev);
+ return True;
+}
- talloc_free(test);
+BOOL torture_local_irpc(struct torture_context *torture)
+{
+ struct torture_suite *suite = torture_suite_create(torture, "LOCAL-IRPC");
+ struct torture_tcase *tcase = torture_suite_add_tcase(suite, "irpc");
+ int i;
+ uint32_t values[] = {0, 0x7FFFFFFE, 0xFFFFFFFE, 0xFFFFFFFF,
+ random() & 0xFFFFFFFF};
+
+ tcase->setup = irpc_setup;
+
+ for (i = 0; i < ARRAY_SIZE(values); i++) {
+ torture_tcase_add_test(tcase, "addone", test_addone, (void *)values[i]);
+ }
+
+ torture_tcase_add_test(tcase, "echodata", test_echodata, NULL);
+ torture_tcase_add_test(tcase, "speed", test_speed, NULL);
- return torture_result(torture);
+ return torture_run_suite(torture, suite);
}
diff --git a/source4/torture/local/messaging.c b/source4/torture/local/messaging.c
index 572ace0448..38d3056f6e 100644
--- a/source4/torture/local/messaging.c
+++ b/source4/torture/local/messaging.c
@@ -56,7 +56,7 @@ static void exit_message(struct messaging_context *msg, void *private,
/*
test ping speed
*/
-static void test_ping_speed(struct torture_context *torture)
+static BOOL test_ping_speed(struct torture_context *torture, const void *_data)
{
struct event_context *ev;
struct messaging_context *msg_client_ctx;
@@ -66,36 +66,33 @@ static void test_ping_speed(struct torture_context *torture)
struct timeval tv;
int timelimit = lp_parm_int(-1, "torture", "timelimit", 10);
uint32_t msg_ping, msg_exit;
- struct torture_test *test = torture_test(torture, "ping_speed", "ping speed");
lp_set_cmdline("lock dir", "lockdir.tmp");
- ev = event_context_init(test);
+ ev = event_context_init(torture);
- msg_server_ctx = messaging_init(test, 1, ev);
+ msg_server_ctx = messaging_init(torture, 1, ev);
if (!msg_server_ctx) {
- torture_fail(test, "Failed to init ping messaging context");
- talloc_free(test);
- return;
+ torture_fail(torture, "Failed to init ping messaging context");
+ return False;
}
messaging_register_tmp(msg_server_ctx, NULL, ping_message, &msg_ping);
- messaging_register_tmp(msg_server_ctx, test, exit_message, &msg_exit);
+ messaging_register_tmp(msg_server_ctx, torture, exit_message, &msg_exit);
- msg_client_ctx = messaging_init(test, 2, ev);
+ msg_client_ctx = messaging_init(torture, 2, ev);
if (!msg_client_ctx) {
- torture_fail(test, "msg_client_ctx messaging_init() failed");
- talloc_free(test);
- return;
+ torture_fail(torture, "msg_client_ctx messaging_init() failed");
+ return False;
}
messaging_register_tmp(msg_client_ctx, &pong_count, pong_message, &msg_pong);
tv = timeval_current();
- torture_comment(test, "Sending pings for %d seconds", timelimit);
+ torture_comment(torture, "Sending pings for %d seconds", timelimit);
while (timeval_elapsed(&tv) < timelimit) {
DATA_BLOB data;
NTSTATUS status1, status2;
@@ -107,13 +104,13 @@ static void test_ping_speed(struct torture_context *torture)
status2 = messaging_send(msg_client_ctx, 1, msg_ping, NULL);
if (!NT_STATUS_IS_OK(status1)) {
- torture_fail(test, "msg1 failed - %s", nt_errstr(status1));
+ torture_fail(torture, "msg1 failed - %s", nt_errstr(status1));
} else {
ping_count++;
}
if (!NT_STATUS_IS_OK(status2)) {
- torture_fail(test, "msg2 failed - %s", nt_errstr(status2));
+ torture_fail(torture, "msg2 failed - %s", nt_errstr(status2));
} else {
ping_count++;
}
@@ -123,31 +120,34 @@ static void test_ping_speed(struct torture_context *torture)
}
}
- torture_comment(test, "waiting for %d remaining replies (done %d)",
+ torture_comment(torture, "waiting for %d remaining replies (done %d)",
ping_count - pong_count, pong_count);
while (timeval_elapsed(&tv) < 30 && pong_count < ping_count) {
event_loop_once(ev);
}
- torture_comment(test, "sending exit");
+ torture_comment(torture, "sending exit");
messaging_send(msg_client_ctx, 1, msg_exit, NULL);
if (ping_count != pong_count) {
- torture_fail(test, "ping test failed! received %d, sent %d",
+ torture_fail(torture, "ping test failed! received %d, sent %d",
pong_count, ping_count);
}
- torture_comment(test, "ping rate of %.0f messages/sec",
+ torture_comment(torture, "ping rate of %.0f messages/sec",
(ping_count+pong_count)/timeval_elapsed(&tv));
talloc_free(msg_client_ctx);
talloc_free(msg_server_ctx);
talloc_free(ev);
+
+ return True;
}
BOOL torture_local_messaging(struct torture_context *torture)
{
- test_ping_speed(torture);
- return torture_result(torture);
+ struct torture_suite *s = torture_suite_create(torture, "LOCAL-MESSAGING");
+ torture_suite_add_simple_tcase(s, "ping_speed", test_ping_speed, NULL);
+ return torture_run_suite(torture, s);
}
diff --git a/source4/torture/local/ndr.c b/source4/torture/local/ndr.c
index 9950531a26..4f743b5229 100644
--- a/source4/torture/local/ndr.c
+++ b/source4/torture/local/ndr.c
@@ -24,12 +24,11 @@
#include "torture/ui.h"
#include "librpc/ndr/libndr.h"
-static BOOL test_check_string_terminator(struct torture_context *torture)
+static BOOL test_check_string_terminator(struct torture_context *test,
+ const void *_data)
{
struct ndr_pull *ndr;
DATA_BLOB blob;
- struct torture_test *test = torture_test(torture, "string_terminator",
- "string terminator");
/* Simple test */
blob = strhex_to_data_blob("0000");
@@ -45,7 +44,6 @@ static BOOL test_check_string_terminator(struct torture_context *torture)
if (NT_STATUS_IS_OK(ndr_check_string_terminator(ndr, 1, 3))) {
torture_fail(test, "check_string_terminator checked beyond string boundaries");
- talloc_free(test);
return False;
}
@@ -68,21 +66,22 @@ static BOOL test_check_string_terminator(struct torture_context *torture)
if (NT_STATUS_IS_OK(ndr_check_string_terminator(ndr, 2, 1))) {
torture_fail(test,
"check_string_terminator erroneously reported terminator");
- talloc_free(test);
return False;
}
torture_assert (test, ndr->offset == 0,
"check_string_terminator did not reset offset");
- talloc_free(test);
-
return True;
}
BOOL torture_local_ndr(struct torture_context *torture)
{
- test_check_string_terminator(torture);
+ struct torture_suite *suite = torture_suite_create(torture, "LOCAL-NDR");
+
+ torture_suite_add_simple_tcase(suite, "string terminator",
+ test_check_string_terminator,
+ NULL);
- return torture_result(torture);
+ return torture_run_suite(torture, suite);
}
diff --git a/source4/torture/local/registry.c b/source4/torture/local/registry.c
index 49f019ba7a..4c8d773a44 100644
--- a/source4/torture/local/registry.c
+++ b/source4/torture/local/registry.c
@@ -26,19 +26,32 @@
#include "torture/torture.h"
#include "torture/ui.h"
-static bool test_hive(struct torture_context *parent_ctx, const char *backend, const char *location)
+const static struct test_backend_settings {
+ const char *name;
+ const char *location;
+} backends[] = {
+ { "nt4", "TEST.DAT" },
+ { "ldb", "test.ldb" },
+ { "gconf", "." },
+ { "dir", "." },
+ { NULL, NULL }
+};
+
+static BOOL test_hive(struct torture_context *ctx, const void *_backend)
{
WERROR error;
struct registry_key *root, *subkey;
uint32_t count;
- struct torture_test *ctx = torture_test(parent_ctx, "test_hive", backend);
-
- if (!reg_has_backend(backend)) {
- torture_skip(ctx, "Backend '%s' support not compiled in", backend);
+ const struct test_backend_settings *backend = _backend;
+
+ if (!reg_has_backend(backend->name)) {
+ torture_skip(ctx, "Backend '%s' support not compiled in",
+ backend->name);
return True;
}
- error = reg_open_hive(ctx, backend, location, NULL, cmdline_credentials, &root);
+ error = reg_open_hive(ctx, backend->name,
+ backend->location, NULL, cmdline_credentials, &root);
torture_assert_werr_ok(ctx, error, "reg_open_hive()");
/* This is a new backend. There should be no subkeys and no
@@ -61,21 +74,20 @@ static bool test_hive(struct torture_context *parent_ctx, const char *backend, c
talloc_free(root);
- torture_ok(ctx);
-
return True;
}
BOOL torture_registry(struct torture_context *torture)
{
- BOOL ret = True;
+ struct torture_suite *suite = torture_suite_create(torture,
+ "LOCAL-REGISTRY");
+ int i;
registry_init();
- ret &= test_hive(torture, "nt4", "TEST.DAT");
- ret &= test_hive(torture, "ldb", "test.ldb");
- ret &= test_hive(torture, "gconf", ".");
- ret &= test_hive(torture, "dir", ".");
+ for (i = 0; backends[i].name; i++) {
+ torture_suite_add_simple_tcase(suite, backends[i].name, test_hive, &backends[i]);
+ }
- return ret;
+ return torture_run_suite(torture, suite);
}
diff --git a/source4/torture/local/resolve.c b/source4/torture/local/resolve.c
index 29606f4966..da83b45341 100644
--- a/source4/torture/local/resolve.c
+++ b/source4/torture/local/resolve.c
@@ -26,11 +26,9 @@
#include "torture/torture.h"
#include "torture/ui.h"
-static BOOL test_async_resolve(struct torture_context *torture)
+static BOOL test_async_resolve(struct torture_context *test, const void *_data)
{
struct nbt_name n;
- struct torture_test *test = torture_test(torture, "async_resolve",
- "asynchronous resolve");
struct event_context *ev;
int timelimit = lp_parm_int(-1, "torture", "timelimit", 10);
const char *host = lp_parm_string(-1, "torture", "host");
@@ -56,21 +54,18 @@ static BOOL test_async_resolve(struct torture_context *torture)
torture_comment(test, "async rate of %.1f resolves/sec",
count/timeval_elapsed(&tv));
- talloc_free(test);
return True;
}
/*
test resolution using sync method
*/
-static BOOL test_sync_resolve(struct torture_context *torture)
+static BOOL test_sync_resolve(struct torture_context *test, const void *_data)
{
int timelimit = lp_parm_int(-1, "torture", "timelimit", 10);
struct timeval tv = timeval_current();
int count = 0;
const char *host = lp_parm_string(-1, "torture", "host");
- struct torture_test *test = torture_test(torture, "sync resolve",
- "synchronous resolve");
torture_comment(test, "Testing sync resolve of localhost for %d seconds",
timelimit);
@@ -82,15 +77,17 @@ static BOOL test_sync_resolve(struct torture_context *torture)
torture_comment(test, "sync rate of %.1f resolves/sec",
count/timeval_elapsed(&tv));
- talloc_free(test);
return True;
}
BOOL torture_local_resolve(struct torture_context *torture)
{
- test_async_resolve(torture);
- test_sync_resolve(torture);
+ struct torture_suite *suite = torture_suite_create(torture,
+ "LOCAL-RESOLVE");
- return torture_result(torture);
+ torture_suite_add_simple_tcase(suite, "async", test_async_resolve, NULL);
+ torture_suite_add_simple_tcase(suite, "sync", test_sync_resolve, NULL);
+
+ return torture_run_suite(torture, suite);
}