Linux bluetooth development
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Marcin Kraglak <marcin.kraglak@tieto.com>
Cc: "linux-bluetooth@vger.kernel.org development"
	<linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH 7/7] Add /hfp/test_hfp_gw_register_3 and /hfp/test_hfp_gw_register_4
Date: Tue, 4 Mar 2014 00:51:35 -0800	[thread overview]
Message-ID: <40496779-C0F9-45CC-8C2A-ECF72151C758@holtmann.org> (raw)
In-Reply-To: <CABD6X-+-pUjd36JQ_wb+LKQWimB4_TwL+aqk7koZkiLz_k5FaA@mail.gmail.com>

Hi Marcin,

>>> unit/test-hfp.c | 31 +++++++++++++++++++++++++++++++
>>> 1 file changed, 31 insertions(+)
>>> 
>>> diff --git a/unit/test-hfp.c b/unit/test-hfp.c
>>> index 5e4fc11..64ecc60 100644
>>> --- a/unit/test-hfp.c
>>> +++ b/unit/test-hfp.c
>>> @@ -266,6 +266,33 @@ static const struct test_data test_register_2 = {
>>>      .prefix = prefix_brsf
>>> };
>>> 
>>> +static const char atbrsf_read[] = {'A', 'T', '+', 'B', 'R', 'S', 'F', '?',
>>> +                                                                     '\r'};
>>> +
>> 
>>        = "AT+BRSF?\r";
>> 
>>> +static const struct test_data test_register_3 = {
>>> +     .command_cb = cmd_handler,
>>> +     .server_send = atbrsf_read,
>>> +     .data_len = sizeof(atbrsf_read),
>>> +     .expected_rsp = err_rsp,
>>> +     .expected_rsp_len = sizeof(err_rsp),
>>> +     .result_cb = prefix_handler,
>>> +     .expected_cmd_type = HFP_GW_CMD_TYPE_READ,
>>> +     .prefix = prefix_brsf
>>> +};
>>> +
>>> +static const char prefix_d[] = "D";
>> 
>> I wonder why here it is acceptable and above you are making the huge effort to give every character separately.
> 
> I thought it will be more readable if raw data passed to socket will
> be declared as array, not string. Prefixes are passed as strings,
> because they are used in hfp_gw_register()  Anyway Luiz suggested to
> use common framework for this test like raw_pdu(args...) ,
> define_test(name, function, args...), (it is used in test-avctp and
> test-avrcp). Will it look better for you?

besides the ending \0, what is actually the difference? It is just wasted effort to put in strings in array from. Just call strlen() instead of sizeof() and you have what you need.

The raw_pdu approach might actually work nicely. Since what you really want is to send an AT command and get the right response back from the gateway. In that sense it is similar to what we do for SDP and AVRCP. Of course you need to have also a preamble for the whole SLC setup. And in addition you want to test the stream handling by for example sending an AT command one byte at a time.

Regards

Marcel


      reply	other threads:[~2014-03-04  8:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-03  8:36 [PATCH 1/7] shared/hfp: Fix not freeing cmd_handler prefix Marcin Kraglak
2014-03-03  8:36 ` [PATCH 2/7] unit: Initial version of test-hfp Marcin Kraglak
2014-03-03  8:36 ` [PATCH 3/7] unit/test-hfp: Add /hfp/test_cmd_handler_1 Marcin Kraglak
2014-03-03  9:10   ` Luiz Augusto von Dentz
2014-03-03  9:21     ` Marcin Kraglak
2014-03-03  8:36 ` [PATCH 4/7] unit/test-hfp: Add /hfp/test_cmd_handler_2 Marcin Kraglak
2014-03-03  8:36 ` [PATCH 5/7] unit/test-hfp: Add /hfp/test_hfp_gw_register_1 Marcin Kraglak
2014-03-03  8:36 ` [PATCH 6/7] unit/test-hfp: Add /hfp/test_hfp_gw_register_2 Marcin Kraglak
2014-03-03  8:36 ` [PATCH 7/7] Add /hfp/test_hfp_gw_register_3 and /hfp/test_hfp_gw_register_4 Marcin Kraglak
2014-03-03 15:23   ` Marcel Holtmann
2014-03-04  7:16     ` Marcin Kraglak
2014-03-04  8:51       ` Marcel Holtmann [this message]

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=40496779-C0F9-45CC-8C2A-ECF72151C758@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcin.kraglak@tieto.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