All of lore.kernel.org
 help / color / mirror / Atom feed
From: Archie Pusaka <apusaka@google.com>
To: linux-bluetooth <linux-bluetooth@vger.kernel.org>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: CrosBT Upstreaming <chromeos-bluetooth-upstreaming@chromium.org>,
	Archie Pusaka <apusaka@chromium.org>,
	Sonny Sasaka <sonnysasaka@chromium.org>,
	Yun-Hao Chung <howardchung@chromium.org>
Subject: [Bluez PATCH 1/2] unit/gobex: remove timer only when it's not removed yet
Date: Mon,  3 May 2021 18:03:44 +0800	[thread overview]
Message-ID: <20210503180321.Bluez.1.I462ae10efbf980757258cabcce883b212259a793@changeid> (raw)

From: Archie Pusaka <apusaka@chromium.org>

There are instances where timer is removed because timeout has
occurred, yet we still remove it again by the end of the test. This
causes double removal and prints ugly messages which obscures the
real culprit.

Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
Reviewed-by: Yun-Hao Chung <howardchung@chromium.org>
---

 unit/test-gobex.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/unit/test-gobex.c b/unit/test-gobex.c
index 6fbfa183ec..25a3646630 100644
--- a/unit/test-gobex.c
+++ b/unit/test-gobex.c
@@ -266,7 +266,8 @@ static void send_req(GObexPacket *req, GObexResponseFunc rsp_func,
 	g_main_loop_unref(mainloop);
 	mainloop = NULL;
 
-	g_source_remove(timer_id);
+	if (!g_error_matches(gerr, TEST_ERROR, TEST_ERROR_TIMEOUT))
+		g_source_remove(timer_id);
 	g_io_channel_unref(io);
 	g_obex_unref(obex);
 
@@ -450,7 +451,8 @@ static void test_cancel_req_delay(int transport_type)
 
 	g_assert_no_error(r.err);
 
-	g_source_remove(timer_id);
+	if (!g_error_matches(r.err, TEST_ERROR, TEST_ERROR_TIMEOUT))
+		g_source_remove(timer_id);
 	g_io_channel_unref(io);
 	g_source_remove(io_id);
 	g_obex_unref(r.obex);
@@ -551,7 +553,8 @@ static void test_send_connect(int transport_type)
 	g_main_loop_unref(mainloop);
 	mainloop = NULL;
 
-	g_source_remove(timer_id);
+	if (!g_error_matches(r.err, TEST_ERROR, TEST_ERROR_TIMEOUT))
+		g_source_remove(timer_id);
 	g_io_channel_unref(io);
 	if (!r.completed)
 		g_source_remove(io_id);
@@ -612,7 +615,8 @@ static void test_recv_unexpected(void)
 	g_main_loop_unref(mainloop);
 	mainloop = NULL;
 
-	g_source_remove(timer_id);
+	if (!g_error_matches(err, TEST_ERROR, TEST_ERROR_TIMEOUT))
+		g_source_remove(timer_id);
 	g_io_channel_unref(io);
 	g_obex_unref(obex);
 
@@ -667,7 +671,8 @@ static void test_send_on_demand(int transport_type, GObexDataProducer func)
 	g_main_loop_unref(mainloop);
 	mainloop = NULL;
 
-	g_source_remove(timer_id);
+	if (!g_error_matches(r.err, TEST_ERROR, TEST_ERROR_TIMEOUT))
+		g_source_remove(timer_id);
 	g_io_channel_unref(io);
 	if (!r.completed)
 		g_source_remove(io_id);
@@ -748,7 +753,8 @@ static void recv_connect(int transport_type)
 
 	g_main_loop_run(mainloop);
 
-	g_source_remove(timer_id);
+	if (!g_error_matches(gerr, TEST_ERROR, TEST_ERROR_TIMEOUT))
+		g_source_remove(timer_id);
 	g_obex_unref(obex);
 	g_io_channel_unref(io);
 
@@ -800,7 +806,8 @@ static void test_disconnect(void)
 
 	g_assert_no_error(gerr);
 
-	g_source_remove(timer_id);
+	if (!g_error_matches(gerr, TEST_ERROR, TEST_ERROR_TIMEOUT))
+		g_source_remove(timer_id);
 	g_io_channel_unref(io);
 	g_obex_unref(obex);
 
-- 
2.31.1.527.g47e6f16901-goog


             reply	other threads:[~2021-05-03 10:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-03 10:03 Archie Pusaka [this message]
2021-05-03 10:03 ` [Bluez PATCH 2/2] Makefile.am: Hide test-gobex* behind OBEX flag Archie Pusaka
2021-05-03 10:42 ` [Bluez,1/2] unit/gobex: remove timer only when it's not removed yet bluez.test.bot
2021-05-03 15:04 ` [Bluez PATCH 1/2] " Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210503180321.Bluez.1.I462ae10efbf980757258cabcce883b212259a793@changeid \
    --to=apusaka@google.com \
    --cc=apusaka@chromium.org \
    --cc=chromeos-bluetooth-upstreaming@chromium.org \
    --cc=howardchung@chromium.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=sonnysasaka@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.