linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Anderson Lizardo <anderson.lizardo@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH BlueZ 1/2] unit: Add initial tests for sdp_extract_attr()
Date: Tue, 08 Jan 2013 14:46:27 -0800	[thread overview]
Message-ID: <1357685187.1806.40.camel@aeonflux> (raw)
In-Reply-To: <CAJdJm_Nij11_3FdUaCD7s4Z6B3wnncVrKHg8YaF2wHHbEd1-1g@mail.gmail.com>

Hi Anderson,

> > can we make this a bit more generic with a bit more details on what you
> > are testing.
> >
> > Also having a separate test case for str8, str16 and also str32 of
> > course would be a good idea. Same for url8, url16 and url32. In addition
> > checking empty strings and really long strings is a good idea.
> > Especially long strings that match the max len size.
> 
> This was supposed to be a set of initial tests, specially to validate
> the fix I sent on the other patch. I was going to improve the test
> coverage as I read more of the code.
> 
> But I can work on a set of tests which cover all reachable cases for
> sdp_extract_attr() (I want to focus on this function for now because
> it is less used than others and could hide other bugs.) and send them
> at once, including corner cases.

I want to make our life easier in the long term. Otherwise you end up
with copy&paste all over the place.

> > What I actually like to see is that we can specific element sequences in
> > raw and also what they are suppose to match. So we need to ensure that
> > we also extract the right string value and types. And not just the size.
> 
> The "match" data could be raw bytes which I get by converting the
> returned sdp_data_t to PDU format using sdp_gen_pdu(). What do you
> think?

A better test case data could look like this:

	struct test_data {
		const void *input_data;
		size_t input_size;
		uint8_t dtd;
	};

And we can add combinations of structs and unions here to represent the
different testes.

Also I would create a nice helper define like I did with define_ssa()
for example to create the test data and the test with a nice name.

Regards

Marcel



  reply	other threads:[~2013-01-08 22:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-08 18:43 [PATCH BlueZ 1/2] unit: Add initial tests for sdp_extract_attr() Anderson Lizardo
2013-01-08 18:43 ` [PATCH BlueZ 2/2] lib: Fix SDP_TEXT_STR16/SDP_URL_STR16 parsing Anderson Lizardo
2013-01-08 19:13   ` Marcel Holtmann
2013-01-08 20:27     ` Anderson Lizardo
2013-01-08 22:41       ` Marcel Holtmann
2013-01-08 23:05   ` [PATCH v2 BlueZ] " Anderson Lizardo
2013-01-09  2:25     ` Marcel Holtmann
2013-01-08 19:10 ` [PATCH BlueZ 1/2] unit: Add initial tests for sdp_extract_attr() Marcel Holtmann
2013-01-08 20:45   ` Anderson Lizardo
2013-01-08 22:46     ` Marcel Holtmann [this message]
2013-01-09 15:14       ` Anderson Lizardo

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=1357685187.1806.40.camel@aeonflux \
    --to=marcel@holtmann.org \
    --cc=anderson.lizardo@openbossa.org \
    --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;
as well as URLs for NNTP newsgroup(s).