All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bluez PATCH 1/2] unit/gobex: remove timer only when it's not removed yet
@ 2021-05-03 10:03 Archie Pusaka
  2021-05-03 10:03 ` [Bluez PATCH 2/2] Makefile.am: Hide test-gobex* behind OBEX flag Archie Pusaka
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Archie Pusaka @ 2021-05-03 10:03 UTC (permalink / raw)
  To: linux-bluetooth, Luiz Augusto von Dentz
  Cc: CrosBT Upstreaming, Archie Pusaka, Sonny Sasaka, Yun-Hao Chung

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Bluez PATCH 2/2] Makefile.am: Hide test-gobex* behind OBEX flag
  2021-05-03 10:03 [Bluez PATCH 1/2] unit/gobex: remove timer only when it's not removed yet Archie Pusaka
@ 2021-05-03 10:03 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: Archie Pusaka @ 2021-05-03 10:03 UTC (permalink / raw)
  To: linux-bluetooth, Luiz Augusto von Dentz
  Cc: CrosBT Upstreaming, Archie Pusaka, Sonny Sasaka, Yun-Hao Chung

From: Archie Pusaka <apusaka@chromium.org>

If obex is disabled in the config, running gobex test is unnecessary.
This patch skips gobex tests if obex is disabled.

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

 Makefile.am | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 2a222167f7..add80dde9e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -492,6 +492,7 @@ unit_test_gdbus_client_SOURCES = unit/test-gdbus-client.c
 unit_test_gdbus_client_LDADD = gdbus/libgdbus-internal.la \
 				src/libshared-glib.la $(GLIB_LIBS) $(DBUS_LIBS)
 
+if OBEX
 unit_tests += unit/test-gobex-header unit/test-gobex-packet unit/test-gobex \
 			unit/test-gobex-transfer unit/test-gobex-apparam
 
@@ -514,6 +515,7 @@ unit_test_gobex_transfer_LDADD = $(GLIB_LIBS)
 unit_test_gobex_apparam_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
 						unit/test-gobex-apparam.c
 unit_test_gobex_apparam_LDADD = $(GLIB_LIBS)
+endif
 
 unit_tests += unit/test-lib
 
-- 
2.31.1.527.g47e6f16901-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [Bluez,1/2] unit/gobex: remove timer only when it's not removed yet
  2021-05-03 10:03 [Bluez PATCH 1/2] unit/gobex: remove timer only when it's not removed yet Archie Pusaka
  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.test.bot
  2021-05-03 15:04 ` [Bluez PATCH 1/2] " Luiz Augusto von Dentz
  2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2021-05-03 10:42 UTC (permalink / raw)
  To: linux-bluetooth, apusaka

[-- Attachment #1: Type: text/plain, Size: 2296 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=476307

---Test result---

Test Summary:
CheckPatch                    PASS      0.68 seconds
GitLint                       PASS      0.27 seconds
Prep - Setup ELL              PASS      50.39 seconds
Build - Prep                  PASS      0.11 seconds
Build - Configure             PASS      8.85 seconds
Build - Make                  PASS      210.42 seconds
Make Check                    PASS      9.36 seconds
Make Dist                     PASS      13.67 seconds
Make Dist - Configure         PASS      5.55 seconds
Make Dist - Make              PASS      86.39 seconds
Build w/ext ELL - Configure   PASS      8.88 seconds
Build w/ext ELL - Make        PASS      199.24 seconds

Details
##############################
Test: CheckPatch - PASS
Desc: Run checkpatch.pl script with rule in .checkpatch.conf

##############################
Test: GitLint - PASS
Desc: Run gitlint with rule in .gitlint

##############################
Test: Prep - Setup ELL - PASS
Desc: Clone, build, and install ELL

##############################
Test: Build - Prep - PASS
Desc: Prepare environment for build

##############################
Test: Build - Configure - PASS
Desc: Configure the BlueZ source tree

##############################
Test: Build - Make - PASS
Desc: Build the BlueZ source tree

##############################
Test: Make Check - PASS
Desc: Run 'make check'

##############################
Test: Make Dist - PASS
Desc: Run 'make dist' and build the distribution tarball

##############################
Test: Make Dist - Configure - PASS
Desc: Configure the source from distribution tarball

##############################
Test: Make Dist - Make - PASS
Desc: Build the source from distribution tarball

##############################
Test: Build w/ext ELL - Configure - PASS
Desc: Configure BlueZ source with '--enable-external-ell' configuration

##############################
Test: Build w/ext ELL - Make - PASS
Desc: Build BlueZ source with '--enable-external-ell' configuration



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Bluez PATCH 1/2] unit/gobex: remove timer only when it's not removed yet
  2021-05-03 10:03 [Bluez PATCH 1/2] unit/gobex: remove timer only when it's not removed yet Archie Pusaka
  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 ` Luiz Augusto von Dentz
  2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2021-05-03 15:04 UTC (permalink / raw)
  To: Archie Pusaka
  Cc: linux-bluetooth, CrosBT Upstreaming, Archie Pusaka, Sonny Sasaka,
	Yun-Hao Chung

Hi Archie,

On Mon, May 3, 2021 at 3:04 AM Archie Pusaka <apusaka@google.com> wrote:
>
> 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);

That is weird way to check if the timer is active, usually the
callback shall set the id to 0 and then we check it before removing,
and we might want to consider consolidating this code into a function.

>         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
>


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-03 15:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-03 10:03 [Bluez PATCH 1/2] unit/gobex: remove timer only when it's not removed yet Archie Pusaka
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

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.