diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2006-06-16 22:06:09 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:09:09 -0500 |
commit | 582d46ec42144bddccddacadd52a0256f58cb453 (patch) | |
tree | 0545454b21f1ef986117f7c2e72fe957d2b662e2 /source4/torture/local/ndr.c | |
parent | cc9d70bbba4e326ba89dec8cdc58b64b89f33091 (diff) | |
download | samba-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/ndr.c')
-rw-r--r-- | source4/torture/local/ndr.c | 17 |
1 files changed, 8 insertions, 9 deletions
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); } |