libwbclient: torture-test wbcPing async functions.
authorKai Blin <kai@samba.org>
Fri, 29 Jan 2010 10:22:14 +0000 (11:22 +0100)
committerKai Blin <kai@samba.org>
Thu, 11 Feb 2010 22:56:32 +0000 (23:56 +0100)
nsswitch/libwbclient/tests/wbclient.c

index 9e4c348cb66b0b1c6a57fef259ad7ade2e5f44a2..83d8dacbcfca7b3d773319f719d76a3627493df4 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "includes.h"
 #include "nsswitch/libwbclient/wbclient.h"
+#include "nsswitch/libwbclient/wbc_async.h"
 #include "torture/smbtorture.h"
 #include "torture/winbind/proto.h"
 
@@ -43,6 +44,24 @@ static bool test_wbc_ping(struct torture_context *tctx)
        return true;
 }
 
+static bool test_wbc_ping_async(struct torture_context *tctx)
+{
+       struct wb_context *wb_ctx;
+       struct tevent_req *req;
+
+       wb_ctx = wb_context_init(tctx, NULL);
+
+       req = wbcPing_send(tctx, tctx->ev, wb_ctx);
+       torture_assert(tctx, req, "wbcPing_send failed");
+
+       if(!tevent_req_poll(req, tctx->ev)) {
+               return false;
+       }
+       torture_assert_wbc_ok(tctx, wbcPing_recv(req), "wbcPing_recv failed");
+       return true;
+}
+
+
 static bool test_wbc_pingdc(struct torture_context *tctx)
 {
        torture_assert_wbc_equal(tctx, wbcPingDc("random_string", NULL), WBC_ERR_NOT_IMPLEMENTED,
@@ -353,6 +372,7 @@ struct torture_suite *torture_wbclient(void)
        struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "WBCLIENT");
 
        torture_suite_add_simple_test(suite, "wbcPing", test_wbc_ping);
+       torture_suite_add_simple_test(suite, "wbcPing_async", test_wbc_ping_async);
        torture_suite_add_simple_test(suite, "wbcPingDc", test_wbc_pingdc);
        torture_suite_add_simple_test(suite, "wbcLibraryDetails", test_wbc_library_details);
        torture_suite_add_simple_test(suite, "wbcInterfaceDetails", test_wbc_interface_details);