Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v1 3/3] tools/tester: Retry with debug on hciemu_new failure
Date: Wed,  6 May 2026 15:41:50 -0400	[thread overview]
Message-ID: <20260506194150.1701855-3-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20260506194150.1701855-1-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

When hciemu_new fails, retry using hciemu_new_debug to capture early
initialization errors before reporting the failure. This helps diagnose
issues like vhci or client creation failures in CI.
---
 tools/6lowpan-tester.c  | 3 +++
 tools/bnep-tester.c     | 3 +++
 tools/ioctl-tester.c    | 3 +++
 tools/iso-tester.c      | 4 ++++
 tools/l2cap-tester.c    | 3 +++
 tools/mesh-tester.c     | 3 +++
 tools/mgmt-tester.c     | 3 +++
 tools/rfcomm-tester.c   | 3 +++
 tools/sco-tester.c      | 3 +++
 tools/smp-tester.c      | 3 +++
 tools/userchan-tester.c | 3 +++
 11 files changed, 34 insertions(+)

diff --git a/tools/6lowpan-tester.c b/tools/6lowpan-tester.c
index 2b43719f153e..95fdf206fc0c 100644
--- a/tools/6lowpan-tester.c
+++ b/tools/6lowpan-tester.c
@@ -178,6 +178,9 @@ static void read_index_list_callback(uint8_t status, uint16_t length,
 					index_removed_callback, NULL, NULL);
 
 	data->hciemu = hciemu_new(HCIEMU_TYPE_LE);
+	if (!data->hciemu)
+		data->hciemu = hciemu_new_debug(HCIEMU_TYPE_LE, print_debug,
+							"hciemu: ", NULL);
 	if (!data->hciemu) {
 		tester_warn("Failed to setup HCI emulation");
 		tester_pre_setup_failed();
diff --git a/tools/bnep-tester.c b/tools/bnep-tester.c
index 581f54c20829..1c53d024c0f8 100644
--- a/tools/bnep-tester.c
+++ b/tools/bnep-tester.c
@@ -159,6 +159,9 @@ static void read_index_list_callback(uint8_t status, uint16_t length,
 					index_removed_callback, NULL, NULL);
 
 	data->hciemu = hciemu_new(data->hciemu_type);
+	if (!data->hciemu)
+		data->hciemu = hciemu_new_debug(data->hciemu_type, print_debug,
+							"hciemu: ", NULL);
 	if (!data->hciemu) {
 		tester_warn("Failed to setup HCI emulation");
 		tester_pre_setup_failed();
diff --git a/tools/ioctl-tester.c b/tools/ioctl-tester.c
index 969fbd955b76..e957b0d01bfa 100644
--- a/tools/ioctl-tester.c
+++ b/tools/ioctl-tester.c
@@ -227,6 +227,9 @@ static void read_index_list_callback(uint8_t status, uint16_t length,
 					index_removed_callback, NULL, NULL);
 
 	data->hciemu = hciemu_new(data->hciemu_type);
+	if (!data->hciemu)
+		data->hciemu = hciemu_new_debug(data->hciemu_type, print_debug,
+							"hciemu: ", NULL);
 	if (!data->hciemu) {
 		tester_warn("Failed to setup HCI emulation");
 		tester_pre_setup_failed();
diff --git a/tools/iso-tester.c b/tools/iso-tester.c
index 8dfea0b417f0..767ee0c57c47 100644
--- a/tools/iso-tester.c
+++ b/tools/iso-tester.c
@@ -634,6 +634,10 @@ static void read_index_list_callback(uint8_t status, uint16_t length,
 					index_removed_callback, NULL, NULL);
 
 	data->hciemu = hciemu_new_num(HCIEMU_TYPE_BREDRLE52, data->client_num);
+	if (!data->hciemu)
+		data->hciemu = hciemu_new_num_debug(HCIEMU_TYPE_BREDRLE52,
+						data->client_num, hciemu_debug,
+						"hciemu: ", NULL);
 	if (!data->hciemu) {
 		tester_warn("Failed to setup HCI emulation");
 		tester_pre_setup_failed();
diff --git a/tools/l2cap-tester.c b/tools/l2cap-tester.c
index 5c013d4704e5..a8cac3902b32 100644
--- a/tools/l2cap-tester.c
+++ b/tools/l2cap-tester.c
@@ -214,6 +214,9 @@ static void read_index_list_callback(uint8_t status, uint16_t length,
 					index_removed_callback, NULL, NULL);
 
 	data->hciemu = hciemu_new(data->hciemu_type);
+	if (!data->hciemu)
+		data->hciemu = hciemu_new_debug(data->hciemu_type, print_debug,
+							"hciemu: ", NULL);
 	if (!data->hciemu) {
 		tester_warn("Failed to setup HCI emulation");
 		tester_pre_setup_failed();
diff --git a/tools/mesh-tester.c b/tools/mesh-tester.c
index 27628b627957..4412bfdb727e 100644
--- a/tools/mesh-tester.c
+++ b/tools/mesh-tester.c
@@ -416,6 +416,9 @@ static void read_index_list_callback(uint8_t status, uint16_t length,
 			index_removed_callback, NULL, NULL);
 
 	data->hciemu = hciemu_new(data->hciemu_type);
+	if (!data->hciemu)
+		data->hciemu = hciemu_new_debug(data->hciemu_type, print_debug,
+							"hciemu: ", NULL);
 	if (!data->hciemu) {
 		tester_warn("Failed to setup HCI emulation");
 		test_pre_setup_failed();
diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index 213fd996b032..4d28090271e9 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -428,6 +428,9 @@ static void read_index_list_callback(uint8_t status, uint16_t length,
 					index_removed_callback, NULL, NULL);
 
 	data->hciemu = hciemu_new(data->hciemu_type);
+	if (!data->hciemu)
+		data->hciemu = hciemu_new_debug(data->hciemu_type, print_debug,
+							"hciemu: ", NULL);
 	if (!data->hciemu) {
 		tester_warn("Failed to setup HCI emulation");
 		test_pre_setup_failed();
diff --git a/tools/rfcomm-tester.c b/tools/rfcomm-tester.c
index 06e9fbdd6143..b7f7d9ebd794 100644
--- a/tools/rfcomm-tester.c
+++ b/tools/rfcomm-tester.c
@@ -164,6 +164,9 @@ static void read_index_list_callback(uint8_t status, uint16_t length,
 					index_removed_callback, NULL, NULL);
 
 	data->hciemu = hciemu_new(data->hciemu_type);
+	if (!data->hciemu)
+		data->hciemu = hciemu_new_debug(data->hciemu_type, print_debug,
+							"hciemu: ", NULL);
 	if (!data->hciemu) {
 		tester_warn("Failed to setup HCI emulation");
 		tester_pre_setup_failed();
diff --git a/tools/sco-tester.c b/tools/sco-tester.c
index f09ba04aeaf7..a2185b8ef198 100644
--- a/tools/sco-tester.c
+++ b/tools/sco-tester.c
@@ -192,6 +192,9 @@ static void read_index_list_callback(uint8_t status, uint16_t length,
 					index_removed_callback, NULL, NULL);
 
 	data->hciemu = hciemu_new(HCIEMU_TYPE_BREDRLE);
+	if (!data->hciemu)
+		data->hciemu = hciemu_new_debug(HCIEMU_TYPE_BREDRLE, print_debug,
+							"hciemu: ", NULL);
 	if (!data->hciemu) {
 		tester_warn("Failed to setup HCI emulation");
 		tester_pre_setup_failed();
diff --git a/tools/smp-tester.c b/tools/smp-tester.c
index aaf149c0deb7..581f3a233704 100644
--- a/tools/smp-tester.c
+++ b/tools/smp-tester.c
@@ -182,6 +182,9 @@ static void read_index_list_callback(uint8_t status, uint16_t length,
 					index_removed_callback, NULL, NULL);
 
 	data->hciemu = hciemu_new(data->hciemu_type);
+	if (!data->hciemu)
+		data->hciemu = hciemu_new_debug(data->hciemu_type, print_debug,
+							"hciemu: ", NULL);
 	if (!data->hciemu) {
 		tester_warn("Failed to setup HCI emulation");
 		tester_pre_setup_failed();
diff --git a/tools/userchan-tester.c b/tools/userchan-tester.c
index a03f64d84c0b..9164fc33f5d9 100644
--- a/tools/userchan-tester.c
+++ b/tools/userchan-tester.c
@@ -153,6 +153,9 @@ static void read_index_list_callback(uint8_t status, uint16_t length,
 					index_added_callback, NULL, NULL);
 
 	data->hciemu = hciemu_new(data->hciemu_type);
+	if (!data->hciemu)
+		data->hciemu = hciemu_new_debug(data->hciemu_type, mgmt_debug,
+							"hciemu: ", NULL);
 	if (!data->hciemu) {
 		tester_warn("Failed to setup HCI emulation");
 		tester_pre_setup_failed();
-- 
2.53.0


  parent reply	other threads:[~2026-05-06 19:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06 19:41 [PATCH BlueZ v1 1/3] tools/tester: Fix crash when hciemu_new fails Luiz Augusto von Dentz
2026-05-06 19:41 ` [PATCH BlueZ v1 2/3] emulator/hciemu: Add hciemu_new_debug/hciemu_new_num_debug Luiz Augusto von Dentz
2026-05-06 19:41 ` Luiz Augusto von Dentz [this message]
2026-05-06 21:12 ` [BlueZ,v1,1/3] tools/tester: Fix crash when hciemu_new fails bluez.test.bot
2026-05-07 16:10 ` [PATCH BlueZ v1 1/3] " patchwork-bot+bluetooth

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=20260506194150.1701855-3-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox