summaryrefslogtreecommitdiff
path: root/source4/torture/local/binding_string.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-06-16 22:06:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:09 -0500
commit582d46ec42144bddccddacadd52a0256f58cb453 (patch)
tree0545454b21f1ef986117f7c2e72fe957d2b662e2 /source4/torture/local/binding_string.c
parentcc9d70bbba4e326ba89dec8cdc58b64b89f33091 (diff)
downloadsamba-582d46ec42144bddccddacadd52a0256f58cb453.tar.gz
samba-582d46ec42144bddccddacadd52a0256f58cb453.tar.bz2
samba-582d46ec42144bddccddacadd52a0256f58cb453.zip
r16304: Improve testing UI API. This now allows registering the full
test suite tree, looks a bit more like other unit testing API's, fixes some memory responsibility issues, introduces testcases, and removes the need for tests to call torture_ok(). (This used to be commit 0445b1a56a02552f895f400960b9ced39244a144)
Diffstat (limited to 'source4/torture/local/binding_string.c')
-rw-r--r--source4/torture/local/binding_string.c48
1 files changed, 22 insertions, 26 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);
}