From cf794355456b82927cecfd183e49b47be6568385 Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Thu, 27 May 2010 17:24:10 +0300 Subject: s4/test: refactor NET-USERINFO test to be more 'torture' friendly Test may be further refactored to be converted as a test case (what it is actually) --- source4/torture/libnet/userinfo.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) (limited to 'source4/torture/libnet') diff --git a/source4/torture/libnet/userinfo.c b/source4/torture/libnet/userinfo.c index d28534f53e..d6ea609a43 100644 --- a/source4/torture/libnet/userinfo.c +++ b/source4/torture/libnet/userinfo.c @@ -48,10 +48,7 @@ static bool test_userinfo(struct torture_context *tctx, torture_comment(tctx, "Testing sync libnet_rpc_userinfo (SID argument)\n"); status = libnet_rpc_userinfo(p, mem_ctx, &user); - if (!NT_STATUS_IS_OK(status)) { - torture_comment(tctx, "Failed to call sync libnet_rpc_userinfo - %s\n", nt_errstr(status)); - return false; - } + torture_assert_ntstatus_ok(tctx, status, "Calling sync libnet_rpc_userinfo() failed"); ZERO_STRUCT(user); @@ -62,10 +59,7 @@ static bool test_userinfo(struct torture_context *tctx, torture_comment(tctx, "Testing sync libnet_rpc_userinfo (username argument)\n"); status = libnet_rpc_userinfo(p, mem_ctx, &user); - if (!NT_STATUS_IS_OK(status)) { - torture_comment(tctx, "Failed to call sync libnet_rpc_userinfo - %s\n", nt_errstr(status)); - return false; - } + torture_assert_ntstatus_ok(tctx, status, "Calling sync libnet_rpc_userinfo failed"); return true; } @@ -92,16 +86,10 @@ static bool test_userinfo_async(struct torture_context *tctx, torture_comment(tctx, "Testing async libnet_rpc_userinfo (SID argument)\n"); c = libnet_rpc_userinfo_send(p, &user, msg_handler); - if (!c) { - torture_comment(tctx, "Failed to call sync libnet_rpc_userinfo_send\n"); - return false; - } + torture_assert(tctx, c != NULL, "Failed to call async libnet_rpc_userinfo_send"); status = libnet_rpc_userinfo_recv(c, mem_ctx, &user); - if (!NT_STATUS_IS_OK(status)) { - torture_comment(tctx, "Calling async libnet_rpc_userinfo failed - %s\n", nt_errstr(status)); - return false; - } + torture_assert_ntstatus_ok(tctx, status, "Calling async libnet_rpc_userinfo_recv failed"); ZERO_STRUCT(user); @@ -113,16 +101,10 @@ static bool test_userinfo_async(struct torture_context *tctx, torture_comment(tctx, "Testing async libnet_rpc_userinfo (username argument)\n"); c = libnet_rpc_userinfo_send(p, &user, msg_handler); - if (!c) { - torture_comment(tctx, "Failed to call sync libnet_rpc_userinfo_send\n"); - return false; - } + torture_assert(tctx, c != NULL, "Failed to call async libnet_rpc_userinfo_send"); status = libnet_rpc_userinfo_recv(c, mem_ctx, &user); - if (!NT_STATUS_IS_OK(status)) { - torture_comment(tctx, "Calling async libnet_rpc_userinfo failed - %s\n", nt_errstr(status)); - return false; - } + torture_assert_ntstatus_ok(tctx, status, "Calling async libnet_rpc_userinfo_recv failed"); return true; } -- cgit