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/resolve.c | |
parent | 0f2347e417dec4a50f95d64353b260cd53a44a2b (diff) | |
download | samba-8773e743c518578584d07d35ffdafdd598af88b0.tar.gz samba-8773e743c518578584d07d35ffdafdd598af88b0.tar.xz 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/resolve.c')
-rw-r--r-- | source4/torture/local/resolve.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/source4/torture/local/resolve.c b/source4/torture/local/resolve.c index a9878e88ee5..62aa600a3cf 100644 --- a/source4/torture/local/resolve.c +++ b/source4/torture/local/resolve.c @@ -25,68 +25,67 @@ #include "libcli/resolve/resolve.h" #include "torture/torture.h" -static BOOL test_async_resolve(struct torture_context *test, const void *_data) +static bool test_async_resolve(struct torture_context *tctx) { struct nbt_name n; struct event_context *ev; - int timelimit = lp_parm_int(-1, "torture", "timelimit", 10); - const char *host = lp_parm_string(-1, "torture", "host"); + int timelimit = torture_setting_int(tctx, "timelimit", 10); + const char *host = torture_setting_string(tctx, "host", NULL); int count = 0; struct timeval tv = timeval_current(); + TALLOC_CTX *mem_ctx = tctx; - ev = event_context_init(test); + ev = event_context_init(mem_ctx); ZERO_STRUCT(n); n.name = host; - torture_comment(test, "Testing async resolve of localhost for %d seconds", + torture_comment(tctx, "Testing async resolve of localhost for %d seconds\n", timelimit); while (timeval_elapsed(&tv) < timelimit) { const char *s; struct composite_context *c = resolve_name_host_send(&n, ev); - torture_assert(test, c, "resolve_name_host_send"); - torture_assert_ntstatus_ok(test, resolve_name_host_recv(c, test, &s), + torture_assert(tctx, c != NULL, "resolve_name_host_send"); + torture_assert_ntstatus_ok(tctx, resolve_name_host_recv(c, mem_ctx, &s), "async resolve failed"); count++; } - torture_comment(test, "async rate of %.1f resolves/sec", + torture_comment(tctx, "async rate of %.1f resolves/sec\n", count/timeval_elapsed(&tv)); - - return True; + return true; } /* test resolution using sync method */ -static BOOL test_sync_resolve(struct torture_context *test, const void *_data) +static bool test_sync_resolve(struct torture_context *tctx) { - int timelimit = lp_parm_int(-1, "torture", "timelimit", 10); + int timelimit = torture_setting_int(tctx, "timelimit", 10); struct timeval tv = timeval_current(); int count = 0; - const char *host = lp_parm_string(-1, "torture", "host"); + const char *host = torture_setting_string(tctx, "host", NULL); - torture_comment(test, "Testing sync resolve of localhost for %d seconds", + torture_comment(tctx, "Testing sync resolve of localhost for %d seconds\n", timelimit); while (timeval_elapsed(&tv) < timelimit) { sys_inet_ntoa(interpret_addr2(host)); count++; } - torture_comment(test, "sync rate of %.1f resolves/sec", + torture_comment(tctx, "sync rate of %.1f resolves/sec\n", count/timeval_elapsed(&tv)); - - return True; + return true; } struct torture_suite *torture_local_resolve(TALLOC_CTX *mem_ctx) { struct torture_suite *suite = torture_suite_create(mem_ctx, - "LOCAL-RESOLVE"); + "RESOLVE"); - torture_suite_add_simple_tcase(suite, "async", test_async_resolve, NULL); - torture_suite_add_simple_tcase(suite, "sync", test_sync_resolve, NULL); + torture_suite_add_simple_test(suite, "async", test_async_resolve); + torture_suite_add_simple_test(suite, "sync", test_sync_resolve); return suite; } |