linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/3] unit/test-hfp: Re-order TS tests in alphabetical order
@ 2025-09-01 15:49 Frédéric Danis
  2025-09-01 15:49 ` [PATCH BlueZ 2/3] shared/hfp: Fix typos Frédéric Danis
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Frédéric Danis @ 2025-09-01 15:49 UTC (permalink / raw)
  To: linux-bluetooth

This will simplify when looking for a test.
---
 unit/test-hfp.c | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/unit/test-hfp.c b/unit/test-hfp.c
index 9be1b05ae..0a6828b7c 100644
--- a/unit/test-hfp.c
+++ b/unit/test-hfp.c
@@ -771,15 +771,7 @@ static void hf_update_indicator(enum hfp_indicator indicator, uint32_t val,
 		return;
 	}
 
-	if (g_str_equal(test_name, "/HFP/HF/TRS/BV-01-C")) {
-		context->session.step++;
-		g_assert_cmpint(indicator, ==, HFP_INDICATOR_SERVICE);
-		g_assert_cmpint(val, ==, context->session.step % 2);
-
-		if (context->session.step == 3)
-			context->data->response_func(HFP_RESULT_OK, 0,
-								context);
-	} else if (g_str_equal(test_name, "/HFP/HF/PSI/BV-01-C")) {
+	if (g_str_equal(test_name, "/HFP/HF/PSI/BV-01-C")) {
 		g_assert_cmpint(indicator, ==, HFP_INDICATOR_SIGNAL);
 		g_assert_cmpint(val, ==, 3);
 		context->data->response_func(HFP_RESULT_OK, 0, context);
@@ -795,6 +787,14 @@ static void hf_update_indicator(enum hfp_indicator indicator, uint32_t val,
 		g_assert_cmpint(indicator, ==, HFP_INDICATOR_BATTCHG);
 		g_assert_cmpint(val, ==, 3);
 		context->data->response_func(HFP_RESULT_OK, 0, context);
+	} else if (g_str_equal(test_name, "/HFP/HF/TRS/BV-01-C")) {
+		context->session.step++;
+		g_assert_cmpint(indicator, ==, HFP_INDICATOR_SERVICE);
+		g_assert_cmpint(val, ==, context->session.step % 2);
+
+		if (context->session.step == 3)
+			context->data->response_func(HFP_RESULT_OK, 0,
+								context);
 	}
 }
 
@@ -1008,18 +1008,6 @@ int main(int argc, char *argv[])
 			MINIMAL_SLC_SESSION,
 			data_end());
 
-	/* Transfer Registration Status - HF */
-	define_hf_test("/HFP/HF/TRS/BV-01-C", test_hf_session,
-			NULL, test_hf_session_done,
-			MINIMAL_SLC_SESSION,
-			frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':'),
-			frg_pdu(' ', '1', ',', '1', '\r', '\n'),
-			frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':'),
-			frg_pdu(' ', '1', ',', '0', '\r', '\n'),
-			frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':'),
-			frg_pdu(' ', '1', ',', '1', '\r', '\n'),
-			data_end());
-
 	/* Transfer Signal Strength Indication - HF */
 	define_hf_test("/HFP/HF/PSI/BV-01-C", test_hf_session,
 			NULL, test_hf_session_done,
@@ -1046,5 +1034,17 @@ int main(int argc, char *argv[])
 			frg_pdu(' ', '7', ',', '3', '\r', '\n'),
 			data_end());
 
+	/* Transfer Registration Status - HF */
+	define_hf_test("/HFP/HF/TRS/BV-01-C", test_hf_session,
+			NULL, test_hf_session_done,
+			MINIMAL_SLC_SESSION,
+			frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':'),
+			frg_pdu(' ', '1', ',', '1', '\r', '\n'),
+			frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':'),
+			frg_pdu(' ', '1', ',', '0', '\r', '\n'),
+			frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':'),
+			frg_pdu(' ', '1', ',', '1', '\r', '\n'),
+			data_end());
+
 	return tester_run();
 }
-- 
2.43.0


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

* [PATCH BlueZ 2/3] shared/hfp: Fix typos
  2025-09-01 15:49 [PATCH BlueZ 1/3] unit/test-hfp: Re-order TS tests in alphabetical order Frédéric Danis
@ 2025-09-01 15:49 ` Frédéric Danis
  2025-09-01 15:49 ` [PATCH BlueZ 3/3] unit/test-hfp: Play PDUs up to the last one for HF tests Frédéric Danis
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Frédéric Danis @ 2025-09-01 15:49 UTC (permalink / raw)
  To: linux-bluetooth

---
 src/shared/hfp.c | 14 +++++++-------
 src/shared/hfp.h |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/shared/hfp.c b/src/shared/hfp.c
index 71f193f83..d01915ab1 100644
--- a/src/shared/hfp.c
+++ b/src/shared/hfp.c
@@ -1576,7 +1576,7 @@ static void ciev_service_cb(uint8_t val, void *user_data)
 
 	if (val < hfp->ag_ind[HFP_INDICATOR_SERVICE].min ||
 			val > hfp->ag_ind[HFP_INDICATOR_SERVICE].max) {
-		DBG(hfp, "hf: Incorrect state %u:", val);
+		DBG(hfp, "hf: Incorrect state: %u", val);
 		return;
 	}
 
@@ -1594,7 +1594,7 @@ static void ciev_call_cb(uint8_t val, void *user_data)
 
 	if (val < hfp->ag_ind[HFP_INDICATOR_CALL].min ||
 			val > hfp->ag_ind[HFP_INDICATOR_CALL].max) {
-		DBG(hfp, "hf: Incorrect call state %u:", val);
+		DBG(hfp, "hf: Incorrect call state: %u", val);
 		return;
 	}
 }
@@ -1607,7 +1607,7 @@ static void ciev_callsetup_cb(uint8_t val, void *user_data)
 
 	if (val < hfp->ag_ind[HFP_INDICATOR_CALLSETUP].min ||
 			val > hfp->ag_ind[HFP_INDICATOR_CALLSETUP].max) {
-		DBG(hfp, "hf: Incorrect call setup state %u:", val);
+		DBG(hfp, "hf: Incorrect call setup state: %u", val);
 		return;
 	}
 }
@@ -1620,7 +1620,7 @@ static void ciev_callheld_cb(uint8_t val, void *user_data)
 
 	if (val < hfp->ag_ind[HFP_INDICATOR_CALLHELD].min ||
 			val > hfp->ag_ind[HFP_INDICATOR_CALLHELD].max) {
-		DBG(hfp, "hf: Incorrect call held state %u:", val);
+		DBG(hfp, "hf: Incorrect call held state: %u", val);
 		return;
 	}
 }
@@ -1633,7 +1633,7 @@ static void ciev_signal_cb(uint8_t val, void *user_data)
 
 	if (val < hfp->ag_ind[HFP_INDICATOR_SIGNAL].min ||
 			val > hfp->ag_ind[HFP_INDICATOR_SIGNAL].max) {
-		DBG(hfp, "hf: Incorrect signal value %u:", val);
+		DBG(hfp, "hf: Incorrect signal value: %u", val);
 		return;
 	}
 
@@ -1651,7 +1651,7 @@ static void ciev_roam_cb(uint8_t val, void *user_data)
 
 	if (val < hfp->ag_ind[HFP_INDICATOR_ROAM].min ||
 			val > hfp->ag_ind[HFP_INDICATOR_ROAM].max) {
-		DBG(hfp, "hf: Incorrect roaming state %u:", val);
+		DBG(hfp, "hf: Incorrect roaming state: %u", val);
 		return;
 	}
 
@@ -1669,7 +1669,7 @@ static void ciev_battchg_cb(uint8_t val, void *user_data)
 
 	if (val < hfp->ag_ind[HFP_INDICATOR_BATTCHG].min ||
 			val > hfp->ag_ind[HFP_INDICATOR_BATTCHG].max) {
-		DBG(hfp, "hf: Incorrect battery charge value %u:", val);
+		DBG(hfp, "hf: Incorrect battery charge value: %u", val);
 		return;
 	}
 
diff --git a/src/shared/hfp.h b/src/shared/hfp.h
index f54b86a92..e6f7bbbb6 100644
--- a/src/shared/hfp.h
+++ b/src/shared/hfp.h
@@ -36,7 +36,7 @@
 #define HFP_AG_FEAT_HF_INDICATORS			0x00000400
 #define HFP_AG_FEAT_ESCO_S4_T2				0x00000800
 #define HFP_AG_FEAT_ENHANCED_VOICE_RECOGNITION_STATUS	0x00001000
-#define HFP_AG_FEAT_VOICE_RECOGNITION_TEXT		0x00001000
+#define HFP_AG_FEAT_VOICE_RECOGNITION_TEXT		0x00002000
 
 enum hfp_result {
 	HFP_RESULT_OK		= 0,
-- 
2.43.0


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

* [PATCH BlueZ 3/3] unit/test-hfp: Play PDUs up to the last one for HF tests
  2025-09-01 15:49 [PATCH BlueZ 1/3] unit/test-hfp: Re-order TS tests in alphabetical order Frédéric Danis
  2025-09-01 15:49 ` [PATCH BlueZ 2/3] shared/hfp: Fix typos Frédéric Danis
@ 2025-09-01 15:49 ` Frédéric Danis
  2025-09-01 17:09 ` [BlueZ,1/3] unit/test-hfp: Re-order TS tests in alphabetical order bluez.test.bot
  2025-09-04 16:10 ` [PATCH BlueZ 1/3] " patchwork-bot+bluetooth
  3 siblings, 0 replies; 5+ messages in thread
From: Frédéric Danis @ 2025-09-01 15:49 UTC (permalink / raw)
  To: linux-bluetooth

This will allows to create PDU set for TS tests which may end with
events not triggering actions, e.g. when receiving +CIEV:<callsetup>,0
where call status has already been updated by +CIEV:<call>,1

Free context->data only after completing hfp_*_unref calls.
---
 unit/test-hfp.c | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/unit/test-hfp.c b/unit/test-hfp.c
index 0a6828b7c..9b4d60a3b 100644
--- a/unit/test-hfp.c
+++ b/unit/test-hfp.c
@@ -136,14 +136,14 @@ static void destroy_context(struct context *context)
 	if (context->watch_id)
 		g_source_remove(context->watch_id);
 
-	test_free(context->data);
-
 	if (context->hfp)
 		hfp_gw_unref(context->hfp);
 
 	if (context->hfp_hf)
 		hfp_hf_unref(context->hfp_hf);
 
+	test_free(context->data);
+
 	g_free(context);
 }
 
@@ -182,14 +182,19 @@ static gboolean send_pdu(gpointer user_data)
 	ssize_t len;
 
 	pdu = &context->data->pdu_list[context->pdu_offset++];
-	if (!pdu || !pdu->valid)
+	if (!pdu)
 		return FALSE;
 
+	if (!pdu->valid) {
+		context->data->response_func(HFP_RESULT_OK, 0, context);
+		return FALSE;
+	}
+
 	len = write(context->fd_server, pdu->data, pdu->size);
 	g_assert_cmpint(len, ==, pdu->size);
 
 	pdu = &context->data->pdu_list[context->pdu_offset];
-	if (pdu->fragmented)
+	if (pdu->fragmented || (!pdu->valid && context->data->response_func))
 		g_idle_add(send_pdu, context);
 
 	return FALSE;
@@ -726,13 +731,9 @@ static void hf_session_ready_cb(enum hfp_result res, enum hfp_error cme_err,
 							void *user_data)
 {
 	struct context *context = user_data;
-	const char *test_name = context->data->test_name;
 
 	g_assert_cmpint(res, ==, HFP_RESULT_OK);
 	context->session.completed = true;
-
-	if (g_str_equal(test_name, "/hfp_hf/test_session_minimal"))
-		context->data->response_func(res, cme_err, context);
 }
 
 static void hf_update_indicator(enum hfp_indicator indicator, uint32_t val,
@@ -774,27 +775,17 @@ static void hf_update_indicator(enum hfp_indicator indicator, uint32_t val,
 	if (g_str_equal(test_name, "/HFP/HF/PSI/BV-01-C")) {
 		g_assert_cmpint(indicator, ==, HFP_INDICATOR_SIGNAL);
 		g_assert_cmpint(val, ==, 3);
-		context->data->response_func(HFP_RESULT_OK, 0, context);
 	} else if (g_str_equal(test_name, "/HFP/HF/PSI/BV-02-C")) {
 		context->session.step++;
 		g_assert_cmpint(indicator, ==, HFP_INDICATOR_ROAM);
 		g_assert_cmpint(val, ==, context->session.step % 2);
-
-		if (context->session.step == 2)
-			context->data->response_func(HFP_RESULT_OK, 0,
-								context);
 	} else if (g_str_equal(test_name, "/HFP/HF/PSI/BV-03-C")) {
 		g_assert_cmpint(indicator, ==, HFP_INDICATOR_BATTCHG);
 		g_assert_cmpint(val, ==, 3);
-		context->data->response_func(HFP_RESULT_OK, 0, context);
 	} else if (g_str_equal(test_name, "/HFP/HF/TRS/BV-01-C")) {
 		context->session.step++;
 		g_assert_cmpint(indicator, ==, HFP_INDICATOR_SERVICE);
 		g_assert_cmpint(val, ==, context->session.step % 2);
-
-		if (context->session.step == 3)
-			context->data->response_func(HFP_RESULT_OK, 0,
-								context);
 	}
 }
 
-- 
2.43.0


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

* RE: [BlueZ,1/3] unit/test-hfp: Re-order TS tests in alphabetical order
  2025-09-01 15:49 [PATCH BlueZ 1/3] unit/test-hfp: Re-order TS tests in alphabetical order Frédéric Danis
  2025-09-01 15:49 ` [PATCH BlueZ 2/3] shared/hfp: Fix typos Frédéric Danis
  2025-09-01 15:49 ` [PATCH BlueZ 3/3] unit/test-hfp: Play PDUs up to the last one for HF tests Frédéric Danis
@ 2025-09-01 17:09 ` bluez.test.bot
  2025-09-04 16:10 ` [PATCH BlueZ 1/3] " patchwork-bot+bluetooth
  3 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2025-09-01 17:09 UTC (permalink / raw)
  To: linux-bluetooth, frederic.danis

[-- Attachment #1: Type: text/plain, Size: 1261 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=997681

---Test result---

Test Summary:
CheckPatch                    PENDING   0.30 seconds
GitLint                       PENDING   0.34 seconds
BuildEll                      PASS      19.84 seconds
BluezMake                     PASS      2581.64 seconds
MakeCheck                     PASS      19.75 seconds
MakeDistcheck                 PASS      183.17 seconds
CheckValgrind                 PASS      235.06 seconds
CheckSmatch                   PASS      303.85 seconds
bluezmakeextell               PASS      126.71 seconds
IncrementalBuild              PENDING   0.30 seconds
ScanBuild                     PASS      908.11 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


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

* Re: [PATCH BlueZ 1/3] unit/test-hfp: Re-order TS tests in alphabetical order
  2025-09-01 15:49 [PATCH BlueZ 1/3] unit/test-hfp: Re-order TS tests in alphabetical order Frédéric Danis
                   ` (2 preceding siblings ...)
  2025-09-01 17:09 ` [BlueZ,1/3] unit/test-hfp: Re-order TS tests in alphabetical order bluez.test.bot
@ 2025-09-04 16:10 ` patchwork-bot+bluetooth
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+bluetooth @ 2025-09-04 16:10 UTC (permalink / raw)
  To: =?utf-8?b?RnLDqWTDqXJpYyBEYW5pcyA8ZnJlZGVyaWMuZGFuaXNAY29sbGFib3JhLmNvbT4=?=
  Cc: linux-bluetooth

Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Mon,  1 Sep 2025 17:49:01 +0200 you wrote:
> This will simplify when looking for a test.
> ---
>  unit/test-hfp.c | 42 +++++++++++++++++++++---------------------
>  1 file changed, 21 insertions(+), 21 deletions(-)

Here is the summary with links:
  - [BlueZ,1/3] unit/test-hfp: Re-order TS tests in alphabetical order
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=c779eb8183a7
  - [BlueZ,2/3] shared/hfp: Fix typos
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=bef16e9c4d8d
  - [BlueZ,3/3] unit/test-hfp: Play PDUs up to the last one for HF tests
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=f9a98ff26e50

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-09-04 16:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-01 15:49 [PATCH BlueZ 1/3] unit/test-hfp: Re-order TS tests in alphabetical order Frédéric Danis
2025-09-01 15:49 ` [PATCH BlueZ 2/3] shared/hfp: Fix typos Frédéric Danis
2025-09-01 15:49 ` [PATCH BlueZ 3/3] unit/test-hfp: Play PDUs up to the last one for HF tests Frédéric Danis
2025-09-01 17:09 ` [BlueZ,1/3] unit/test-hfp: Re-order TS tests in alphabetical order bluez.test.bot
2025-09-04 16:10 ` [PATCH BlueZ 1/3] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).