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/rpc/unixinfo.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/rpc/unixinfo.c')
-rw-r--r-- | source4/torture/rpc/unixinfo.c | 65 |
1 files changed, 26 insertions, 39 deletions
diff --git a/source4/torture/rpc/unixinfo.c b/source4/torture/rpc/unixinfo.c index 4bf27b916b..567a85fd44 100644 --- a/source4/torture/rpc/unixinfo.c +++ b/source4/torture/rpc/unixinfo.c @@ -51,24 +51,21 @@ static BOOL test_sidtouid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) /* test the UidToSid interface */ -static BOOL test_uidtosid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +static bool test_uidtosid(struct torture_context *tctx, + struct dcerpc_pipe *p) { - NTSTATUS status; struct unixinfo_UidToSid r; r.in.uid = 1000; - status = dcerpc_unixinfo_UidToSid(p, mem_ctx, &r); - if (NT_STATUS_EQUAL(NT_STATUS_NO_SUCH_USER, status)) { - } else if (!NT_STATUS_IS_OK(status)) { - printf("UidToSid failed == %s\n", nt_errstr(status)); - return False; - } + torture_assert_ntstatus_ok(tctx, dcerpc_unixinfo_UidToSid(p, tctx, &r), + "UidToSid failed"); - return True; + return true; } -static BOOL test_getpwuid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +static bool test_getpwuid(struct torture_context *tctx, + struct dcerpc_pipe *p) { uint64_t uids[512]; uint32_t num_uids = ARRAY_SIZE(uids); @@ -83,11 +80,13 @@ static BOOL test_getpwuid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) r.in.count = &num_uids; r.in.uids = uids; r.out.count = &num_uids; - r.out.infos = talloc_array(mem_ctx, struct unixinfo_GetPWUidInfo, num_uids); + r.out.infos = talloc_array(tctx, struct unixinfo_GetPWUidInfo, num_uids); - result = dcerpc_unixinfo_GetPWUid(p, mem_ctx, &r); + result = dcerpc_unixinfo_GetPWUid(p, tctx, &r); - return NT_STATUS_IS_OK(result); + torture_assert_ntstatus_ok(tctx, result, "GetPWUid failed"); + + return true; } /* @@ -115,44 +114,32 @@ static BOOL test_sidtogid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) /* test the GidToSid interface */ -static BOOL test_gidtosid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +static BOOL test_gidtosid(struct torture_context *tctx, struct dcerpc_pipe *p) { NTSTATUS status; struct unixinfo_GidToSid r; r.in.gid = 1000; - status = dcerpc_unixinfo_GidToSid(p, mem_ctx, &r); + status = dcerpc_unixinfo_GidToSid(p, tctx, &r); if (NT_STATUS_EQUAL(NT_STATUS_NO_SUCH_GROUP, status)) { - } else if (!NT_STATUS_IS_OK(status)) { - printf("GidToSid failed == %s\n", nt_errstr(status)); - return False; - } + } else torture_assert_ntstatus_ok(tctx, status, "GidToSid failed"); - return True; + return true; } -BOOL torture_rpc_unixinfo(struct torture_context *torture) +struct torture_suite *torture_rpc_unixinfo(void) { - NTSTATUS status; - struct dcerpc_pipe *p; - TALLOC_CTX *mem_ctx; - BOOL ret = True; - - mem_ctx = talloc_init("torture_rpc_unixinfo"); + struct torture_suite *suite; + struct torture_tcase *tcase; - status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_unixinfo); - if (!NT_STATUS_IS_OK(status)) { - return False; - } + suite = torture_suite_create(talloc_autofree_context(), "UNIXINFO"); + tcase = torture_suite_add_rpc_iface_tcase(suite, "unixinfo", + &dcerpc_table_unixinfo); - ret &= test_uidtosid(p, mem_ctx); - ret &= test_getpwuid(p, mem_ctx); - ret &= test_gidtosid(p, mem_ctx); - - printf("\n"); - - talloc_free(mem_ctx); + torture_rpc_tcase_add_test(tcase, "uidtosid", test_uidtosid); + torture_rpc_tcase_add_test(tcase, "getpwuid", test_getpwuid); + torture_rpc_tcase_add_test(tcase, "gidtosid", test_gidtosid); - return ret; + return suite; } |