public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: "Frédéric Danis" <frederic.danis@collabora.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH BlueZ 2/4] unit/test-hfp: Add Operator name test for HF
Date: Thu, 11 Sep 2025 19:32:55 +0200	[thread overview]
Message-ID: <b4e36f0d-130e-49f8-b2b3-dde10a5ef3cb@collabora.com> (raw)
In-Reply-To: <CABBYNZ+fnsntwwbZY=u0_5J6O5oxCQhBq8Y-HcnaXXsDtTE-9A@mail.gmail.com>

Hi Luiz,

On 11/09/2025 19:28, Luiz Augusto von Dentz wrote:
> Hi Frédéric,
>
> On Thu, Sep 11, 2025 at 6:37 AM Frédéric Danis
> <frederic.danis@collabora.com> wrote:
>> This add the following test:
>> - HFP/HF/PSI/BV-04-C
>>    Verify that the HF can query the currently selected operator name.
>>
>> Improve MINIMAL_SLC_SESSION macro to be able to set the service, call,
>> callsetup and callheld indicators at connection time.
>> ---
>>   unit/test-hfp.c | 50 +++++++++++++++++++++++++++++++++++++++----------
>>   1 file changed, 40 insertions(+), 10 deletions(-)
>>
>> diff --git a/unit/test-hfp.c b/unit/test-hfp.c
>> index 371415a68..8ab6c7bf5 100644
>> --- a/unit/test-hfp.c
>> +++ b/unit/test-hfp.c
>> @@ -699,7 +699,7 @@ static void test_hf_robustness(gconstpointer data)
>>          context_quit(context);
>>   }
>>
>> -#define MINIMAL_SLC_SESSION \
>> +#define MINIMAL_SLC_SESSION(service, call, callsetup, callheld) \
> WARNING:MACRO_ARG_UNUSED: Argument 'service' is not used in function-like macro
> #10: FILE: unit/test-hfp.c:702:
> +#define MINIMAL_SLC_SESSION(service, call, callsetup, callheld) \
>       raw_pdu('\r', '\n', '+', 'B', 'R', 'S', 'F', ':', \
>           ' ', '0', '\r', '\n'), \
>       frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
>
> WARNING:MACRO_ARG_UNUSED: Argument 'call' is not used in function-like macro
> #10: FILE: unit/test-hfp.c:702:
> +#define MINIMAL_SLC_SESSION(service, call, callsetup, callheld) \
>       raw_pdu('\r', '\n', '+', 'B', 'R', 'S', 'F', ':', \
>           ' ', '0', '\r', '\n'), \
>       frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
>
> WARNING:MACRO_ARG_UNUSED: Argument 'callsetup' is not used in
> function-like macro
> #10: FILE: unit/test-hfp.c:702:
> +#define MINIMAL_SLC_SESSION(service, call, callsetup, callheld) \
>       raw_pdu('\r', '\n', '+', 'B', 'R', 'S', 'F', ':', \
>           ' ', '0', '\r', '\n'), \
>       frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
>
> WARNING:MACRO_ARG_UNUSED: Argument 'callheld' is not used in function-like macro
> #10: FILE: unit/test-hfp.c:702:
> +#define MINIMAL_SLC_SESSION(service, call, callsetup, callheld) \
>       raw_pdu('\r', '\n', '+', 'B', 'R', 'S', 'F', ':', \
>           ' ', '0', '\r', '\n'), \
>       frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
>
> - total: 0 errors, 4 warnings, 108 lines checked

Yes, I saw this, it is due to argument usage is done in the next hunk, 
and checkpatch failsto parse it.
>>          raw_pdu('\r', '\n', '+', 'B', 'R', 'S', 'F', ':', \
>>                  ' ', '0', '\r', '\n'), \
>>          frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
>> @@ -722,10 +722,15 @@ static void test_hf_robustness(gconstpointer data)
>>          frg_pdu('\r', '\n'), \
>>          frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
>>          raw_pdu('\r', '\n', '+', 'C', 'I', 'N', 'D', ':', ' '), \
>> -       frg_pdu('0', ',', '0', ',', '0', ',', '0', ',', '5'), \
>> -       frg_pdu(',', '0', ',', '5', '\r', '\n'), \
>> +       frg_pdu(service, ',', call, ',', callsetup, ',', callheld, ','), \
>> +       frg_pdu('5', ',', '0', ',', '5', '\r', '\n'), \
>>          frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
>> -       raw_pdu('\r', '\n', 'O', 'K', '\r', '\n')
>> +       raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
>> +       raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
>> +       raw_pdu('\r', '\n', '+', 'C', 'O', 'P', 'S', ':', ' '), \
>> +       frg_pdu('0', ',', '0', ',', '\"', 'T', 'E', 'S', 'T'), \
>> +       frg_pdu('\"', '\r', '\n'), \
>> +       frg_pdu('\r', '\n', 'O', 'K', '\r', '\n')
>>
>>   static void hf_session_ready_cb(enum hfp_result res, enum hfp_error cme_err,
>>                                                          void *user_data)
>> @@ -745,7 +750,13 @@ static void hf_update_indicator(enum hfp_indicator indicator, uint32_t val,
>>          if (!context->session.completed) {
>>                  switch (indicator) {
>>                  case HFP_INDICATOR_SERVICE:
>> -                       g_assert_cmpint(val, ==, 0);
>> +                       if (g_str_equal(test_name, "/HFP/HF/PSI/BV-03-C") ||
>> +                               g_str_equal(test_name, "/HFP/HF/TRS/BV-01-C") ||
>> +                               g_str_equal(test_name,
>> +                                               "/hfp_hf/test_session_minimal"))
>> +                               g_assert_cmpint(val, ==, 0);
>> +                       else
>> +                               g_assert_cmpint(val, ==, 1);
>>                          break;
>>                  case HFP_INDICATOR_CALL:
>>                          g_assert_cmpint(val, ==, 0);
>> @@ -789,9 +800,22 @@ static void hf_update_indicator(enum hfp_indicator indicator, uint32_t val,
>>          }
>>   }
>>
>> +static void hf_update_operator(const char *operator_name, void *user_data)
>> +{
>> +       struct context *context = user_data;
>> +       const char *test_name = context->data->test_name;
>> +
>> +       if (tester_use_debug())
>> +               tester_debug("operator updated: %s", operator_name);
>> +
>> +       if (g_str_equal(test_name, "/HFP/HF/PSI/BV-04-C"))
>> +               g_assert_cmpstr(operator_name, ==, "TEST");
>> +}
>> +
>>   static struct hfp_hf_callbacks hf_session_callbacks = {
>>          .session_ready = hf_session_ready_cb,
>>          .update_indicator = hf_update_indicator,
>> +       .update_operator = hf_update_operator,
>>   };
>>
>>   static void test_hf_session_done(enum hfp_result res, enum hfp_error cme_err,
>> @@ -996,13 +1020,13 @@ int main(int argc, char *argv[])
>>
>>          define_hf_test("/hfp_hf/test_session_minimal", test_hf_session,
>>                          NULL, test_hf_session_done,
>> -                       MINIMAL_SLC_SESSION,
>> +                       MINIMAL_SLC_SESSION('0', '0', '0', '0'),
>>                          data_end());
>>
>>          /* Transfer Signal Strength Indication - HF */
>>          define_hf_test("/HFP/HF/PSI/BV-01-C", test_hf_session,
>>                          NULL, test_hf_session_done,
>> -                       MINIMAL_SLC_SESSION,
>> +                       MINIMAL_SLC_SESSION('1', '0', '0', '0'),
>>                          frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':'),
>>                          frg_pdu(' ', '5', ',', '3', '\r', '\n'),
>>                          data_end());
>> @@ -1010,7 +1034,7 @@ int main(int argc, char *argv[])
>>          /* Transfer Roaming Status Indication - HF */
>>          define_hf_test("/HFP/HF/PSI/BV-02-C", test_hf_session,
>>                          NULL, test_hf_session_done,
>> -                       MINIMAL_SLC_SESSION,
>> +                       MINIMAL_SLC_SESSION('1', '0', '0', '0'),
>>                          frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':'),
>>                          frg_pdu(' ', '6', ',', '1', '\r', '\n'),
>>                          frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':'),
>> @@ -1020,15 +1044,21 @@ int main(int argc, char *argv[])
>>          /* Transfer Battery Level Indication - HF */
>>          define_hf_test("/HFP/HF/PSI/BV-03-C", test_hf_session,
>>                          NULL, test_hf_session_done,
>> -                       MINIMAL_SLC_SESSION,
>> +                       MINIMAL_SLC_SESSION('0', '0', '0', '0'),
>>                          frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':'),
>>                          frg_pdu(' ', '7', ',', '3', '\r', '\n'),
>>                          data_end());
>>
>> +       /* Transfer Operator name - HF */
>> +       define_hf_test("/HFP/HF/PSI/BV-04-C", test_hf_session,
>> +                       NULL, test_hf_session_done,
>> +                       MINIMAL_SLC_SESSION('1', '0', '0', '0'),
>> +                       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,
>> +                       MINIMAL_SLC_SESSION('0', '0', '0', '0'),
>>                          frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':'),
>>                          frg_pdu(' ', '1', ',', '1', '\r', '\n'),
>>                          frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':'),
>> --
>> 2.43.0
>>
>>
>
Regards,

Fred

-- 
Frédéric Danis
Senior Software Engineer

Collabora Ltd.
Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, United Kingdom
Registered in England & Wales, no. 5513718


  reply	other threads:[~2025-09-11 17:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-11 10:28 [PATCH BlueZ 1/4] shared/hfp: Add Operator name support Frédéric Danis
2025-09-11 10:28 ` [PATCH BlueZ 2/4] unit/test-hfp: Add Operator name test for HF Frédéric Danis
2025-09-11 17:28   ` Luiz Augusto von Dentz
2025-09-11 17:32     ` Frédéric Danis [this message]
2025-09-15 13:30       ` Luiz Augusto von Dentz
2025-09-11 10:28 ` [PATCH BlueZ 3/4] shared/hfp: Add Call Line Identification support Frédéric Danis
2025-09-11 10:28 ` [PATCH BlueZ 4/4] unit/test-hfp: Add Call Line Identification test for HF Frédéric Danis
2025-09-11 11:59 ` [BlueZ,1/4] shared/hfp: Add Operator name support bluez.test.bot

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=b4e36f0d-130e-49f8-b2b3-dde10a5ef3cb@collabora.com \
    --to=frederic.danis@collabora.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /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