diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2006-10-16 13:06:41 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:21:12 -0500 |
commit | 8773e743c518578584d07d35ffdafdd598af88b0 (patch) | |
tree | 89726232dd6ae9eca1c219e21729a9b2336ddaa9 /source4/torture/local/ndr.c | |
parent | 0f2347e417dec4a50f95d64353b260cd53a44a2b (diff) | |
download | samba-8773e743c518578584d07d35ffdafdd598af88b0.tar.gz samba-8773e743c518578584d07d35ffdafdd598af88b0.tar.bz2 samba-8773e743c518578584d07d35ffdafdd598af88b0.zip |
r19339: Merge my 4.0-unittest branch. This adds an API for more fine-grained
output in the testsuite rather than just True or False for a
set of tests.
The aim is to use this for:
* known failure lists (run all tests and detect tests that
started working or started failing). This
would allow us to get rid of the RPC-SAMBA3-* tests
* nicer torture output
* simplification of the testsuite system
* compatibility with other unit testing systems
* easier usage of smbtorture (being able to run one test
and automatically set up the environment for that)
This is still a work-in-progress; expect more updates over the next couple of
days.
(This used to be commit 0eb6097305776325c75081356309115f445a7218)
Diffstat (limited to 'source4/torture/local/ndr.c')
-rw-r--r-- | source4/torture/local/ndr.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/source4/torture/local/ndr.c b/source4/torture/local/ndr.c index a24c64746a..b14b066455 100644 --- a/source4/torture/local/ndr.c +++ b/source4/torture/local/ndr.c @@ -23,64 +23,59 @@ #include "torture/torture.h" #include "librpc/ndr/libndr.h" -static BOOL test_check_string_terminator(struct torture_context *test, - const void *_data) +static bool test_check_string_terminator(struct torture_context *tctx) { struct ndr_pull *ndr; DATA_BLOB blob; + TALLOC_CTX *mem_ctx = tctx; /* Simple test */ blob = strhex_to_data_blob("0000"); - ndr = ndr_pull_init_blob(&blob, test); + ndr = ndr_pull_init_blob(&blob, mem_ctx); - torture_assert_ntstatus_ok(test, - ndr_check_string_terminator(ndr, 1, 2), + torture_assert_ntstatus_ok(tctx, ndr_check_string_terminator(ndr, 1, 2), "simple check_string_terminator test failed"); - torture_assert(test, ndr->offset == 0, + torture_assert(tctx, ndr->offset == 0, "check_string_terminator did not reset offset"); if (NT_STATUS_IS_OK(ndr_check_string_terminator(ndr, 1, 3))) { - torture_fail(test, "check_string_terminator checked beyond string boundaries"); - return False; + torture_fail(tctx, "check_string_terminator checked beyond string boundaries"); } - torture_assert(test, ndr->offset == 0, + torture_assert(tctx, ndr->offset == 0, "check_string_terminator did not reset offset"); talloc_free(ndr); blob = strhex_to_data_blob("11220000"); - ndr = ndr_pull_init_blob(&blob, test); + ndr = ndr_pull_init_blob(&blob, mem_ctx); - torture_assert_ntstatus_ok(test, + torture_assert_ntstatus_ok(tctx, ndr_check_string_terminator(ndr, 4, 1), "check_string_terminator failed to recognize terminator"); - torture_assert_ntstatus_ok(test, + torture_assert_ntstatus_ok(tctx, ndr_check_string_terminator(ndr, 3, 1), "check_string_terminator failed to recognize terminator"); if (NT_STATUS_IS_OK(ndr_check_string_terminator(ndr, 2, 1))) { - torture_fail(test, + torture_fail(tctx, "check_string_terminator erroneously reported terminator"); - return False; } - torture_assert (test, ndr->offset == 0, + torture_assert(tctx, ndr->offset == 0, "check_string_terminator did not reset offset"); - - return True; + return true; } struct torture_suite *torture_local_ndr(TALLOC_CTX *mem_ctx) { - struct torture_suite *suite = torture_suite_create(mem_ctx, "LOCAL-NDR"); + struct torture_suite *suite = torture_suite_create(mem_ctx, "NDR"); - torture_suite_add_simple_tcase(suite, "string terminator", - test_check_string_terminator, - NULL); + torture_suite_add_simple_test(suite, "string terminator", + test_check_string_terminator); return suite; } |