[PATCH] Add winbind request profiling

Stefan Metzmacher metze at samba.org
Thu Jun 21 17:24:15 UTC 2018


Hi Volker,

>> If this needs more discussion, we can postpone this patchset. I'm
>> happy to keep it local and as a customer-specific patch. I know you're
>> busy to get your tevent patches in, I do not want to step on your
>> toes.
> 
> Ok, I'll take it as is.
> 
> It's still be possible to do some talloc_reparent tricks to pass the
> required talloc parent and then change to the desired memory layout.

Is it ok to squash the following patch to the torture test?
It still passes fine.

Thanks!
metze

-------------- next part --------------
From 11babb6078fdbb897d4056c714bda0e4f97fe761 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Thu, 21 Jun 2018 18:11:00 +0200
Subject: [PATCH] sq lib/tevent/test_req.c Reviewed-by: Stefan Metzmacher
 <metze at samba.org>

---
 lib/tevent/test_req.c | 41 +++++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/lib/tevent/test_req.c b/lib/tevent/test_req.c
index 888bd40bf2b0..565ef31024fb 100644
--- a/lib/tevent/test_req.c
+++ b/lib/tevent/test_req.c
@@ -43,8 +43,8 @@ static bool test_tevent_req_create(struct torture_context *tctx,
 
 	req = tevent_req_create(tctx, &state,
 				struct tevent_req_create_state);
-	torture_assert(tctx, req != NULL, "tevent_req_create failed\n");
-	torture_assert(tctx, state->val == 0, "state not initialized\n");
+	torture_assert_not_null(tctx, req, "tevent_req_create failed\n");
+	torture_assert_int_equal(tctx, state->val, 0, "state not initialized\n");
 
 	TALLOC_FREE(req);
 
@@ -67,7 +67,7 @@ static bool test_tevent_req_profile1(struct torture_context *tctx,
 	int cmp;
 
 	req = tevent_req_create(tctx, &state, struct profile1_state);
-	torture_assert(tctx, req != NULL, "tevent_req_create failed\n");
+	torture_assert_not_null(tctx, req, "tevent_req_create failed\n");
 
 	p1 = tevent_req_get_profile(req);
 	torture_assert(tctx, p1 == NULL, "profile not initialized to NULL\n");
@@ -78,9 +78,9 @@ static bool test_tevent_req_profile1(struct torture_context *tctx,
 	tevent_req_done(req);
 
 	p2 = tevent_req_move_profile(req, tctx);
-	torture_assert(tctx, p2 != NULL, "get_profile failed\n");
+	torture_assert_not_null(tctx, p2, "get_profile failed\n");
 
-	/* Demonstrate sure "p" outlives req */
+	/* Demonstrate sure "p2" outlives req */
 	TALLOC_FREE(req);
 
 	tevent_req_profile_get_start(p2, NULL, &start);
@@ -175,16 +175,16 @@ static bool test_tevent_req_profile2(struct torture_context *tctx,
 	bool ok;
 
 	ev = samba_tevent_context_init(tctx);
-	torture_assert(tctx, ev != NULL, "samba_tevent_context_init failed\n");
+	torture_assert_not_null(tctx, ev, "samba_tevent_context_init failed\n");
 
 	req = profile2_send(tctx, ev);
-	torture_assert(tctx, req != NULL, "profile2_send failed\n");
+	torture_assert_not_null(tctx, req, "profile2_send failed\n");
 
 	ok = tevent_req_poll_unix(req, ev, &err);
 	torture_assert(tctx, ok, "tevent_req_poll_unix failed\n");
 
 	err = profile2_recv(req, tctx, &p1);
-	torture_assert(tctx, err == 0, "profile2_recv failed\n");
+	torture_assert_int_equal(tctx, err, 0, "profile2_recv failed\n");
 
 	TALLOC_FREE(req);
 	TALLOC_FREE(ev);
@@ -206,43 +206,44 @@ static bool test_tevent_req_profile2(struct torture_context *tctx,
 			pack_len,
 			tctx,
 			&p2);
-		torture_assert(tctx,
-			       pack_len==unpack_len,
-			       "profile_unpack failed\n");
+		torture_assert_int_equal(tctx,
+					 pack_len,
+					 unpack_len,
+					 "profile_unpack failed\n");
 	}
 
 	tevent_req_profile_print(p2, stdout, 0, UINT_MAX);
 
 	tevent_req_profile_get_name(p1, &str1);
 	tevent_req_profile_get_name(p2, &str2);
-	torture_assert(tctx, strcmp(str1,str2)==0, "names differ\n");
+	torture_assert_str_equal(tctx, str1, str2, "names differ\n");
 
 	tevent_req_profile_get_start(p1, &str1, &tv1);
 	tevent_req_profile_get_start(p2, &str2, &tv2);
-	torture_assert(tctx, strcmp(str1,str2)==0, "start strings differ\n");
+	torture_assert_str_equal(tctx, str1, str2, "start strings differ\n");
 	torture_assert(tctx,
 		       tevent_timeval_compare(&tv1, &tv2) == 0,
 		       "start times differ\n");
 
 	tevent_req_profile_get_stop(p1, &str1, &tv1);
 	tevent_req_profile_get_stop(p2, &str2, &tv2);
-	torture_assert(tctx, strcmp(str1,str2)==0, "stop strings differ\n");
+	torture_assert_str_equal(tctx, str1, str2, "stop strings differ\n");
 	torture_assert(tctx,
 		       tevent_timeval_compare(&tv1, &tv2) == 0,
 		       "stop times differ\n");
 
 	tevent_req_profile_get_status(p1, &pid1, &state1, &err1);
 	tevent_req_profile_get_status(p2, &pid2, &state2, &err2);
-	torture_assert(tctx, pid1==pid2, "pids differ\n");
-	torture_assert(tctx, state1==state2, "states differ\n");
-	torture_assert(tctx, err1==err2, "user errors differ\n");
+	torture_assert_int_equal(tctx, pid1, pid2, "pids differ\n");
+	torture_assert_int_equal(tctx, state1, state2, "states differ\n");
+	torture_assert_int_equal(tctx, err1, err2, "user errors differ\n");
 
 	str1 = tevent_req_profile_string(p1, p1, 0, UINT_MAX);
-	torture_assert(tctx, str1!=NULL, "profile_string failed\n");
+	torture_assert_not_null(tctx, str1, "profile_string failed\n");
 	str2 = tevent_req_profile_string(p2, p2, 0, UINT_MAX);
-	torture_assert(tctx, str2!=NULL, "profile_string failed\n");
+	torture_assert_not_null(tctx, str2, "profile_string failed\n");
 
-	torture_assert(tctx, strcmp(str1,str2)==0, "result strings differ\n");
+	torture_assert_str_equal(tctx, str1, str2, "result strings differ\n");
 
 	TALLOC_FREE(p1);
 	TALLOC_FREE(p2);
-- 
2.17.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20180621/9d71945b/signature.sig>


More information about the samba-technical mailing list