From: Eric Blake <eblake@redhat.com>
To: "Marc-André Lureau" <mlureau@redhat.com>
Cc: marcandre lureau <marcandre.lureau@redhat.com>,
qemu-devel@nongnu.org, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 2/4] tests: add some qemu_strtosz() tests
Date: Fri, 18 Sep 2015 09:21:08 -0600 [thread overview]
Message-ID: <55FC2BE4.8050001@redhat.com> (raw)
In-Reply-To: <292263729.13770446.1442589049347.JavaMail.zimbra@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2115 bytes --]
On 09/18/2015 09:10 AM, Marc-André Lureau wrote:
> Hi
>
> ----- Original Message -----
>> On 09/18/2015 04:59 AM, marcandre.lureau@redhat.com wrote:
>>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>>>
>>> While reading the function I decided to write some tests.
>>>
>>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>>> Reviewed-by: Eric Blake <eblake@redhat.com>
>>> ---
>>> tests/test-cutils.c | 91
>>> +++++++++++++++++++++++++++++++++++++++++++++++++++++
>>> 1 file changed, 91 insertions(+)
>>
>> I accepted v1 because it was better than no tests at all, but did make
>> some suggestions for additional tests to perform. I'm surprised you
>> didn't include any of those suggestions in v2. For example, it would be
>> nice if the testsuite documents a contract on what happens with a bogus
>> suffix: is "1234x" outright rejected, or does it parse as "1234" leaving
>> the pointer at 'x'?
>
> I thought you were ok with this patch as is.
If there was no other reason for a respin. But once you are doing a
respin, you might as well consider it, or at least document after the
--- that you at least thought about it and had a reason for not doing it.
> But I can add some failing tests if you want (although it feels like testing strtod() at this point.
Not quite. strtod() doesn't parse suffixes, but does consume input
anyways; it then requires the user to do post-processing (so by itself
it is not an easy contract). The whole point of writing our own wrapper
is so that we can have sane semantics without the caller having to do
post-processing. That should include a sane contract for what we do on
a suffix we don't recognize is useful. In particular, there could be
arguments for both "parse as much as possible", and for "refuse to parse
anything that has trailing garbage"; and since I don't know which way it
currently is, it means we SHOULD be making it part of the contract and
giving it some testing.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2015-09-18 15:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-18 10:59 [Qemu-devel] [PATCH v2 1/4] utils: rename strtosz to use qemu prefix marcandre.lureau
2015-09-18 10:59 ` [Qemu-devel] [PATCH v2 2/4] tests: add some qemu_strtosz() tests marcandre.lureau
2015-09-18 15:05 ` Eric Blake
2015-09-18 15:10 ` Marc-André Lureau
2015-09-18 15:21 ` Eric Blake [this message]
2015-09-18 10:59 ` [Qemu-devel] [PATCH v2 3/4] checkpatch: recommend strtok_r marcandre.lureau
2015-09-18 10:59 ` [Qemu-devel] [PATCH v2 4/4] Replace strotok() by strtok_r() marcandre.lureau
2015-09-18 15:22 ` Paolo Bonzini
2015-09-18 15:44 ` Marc-André Lureau
2015-09-18 15:03 ` [Qemu-devel] [PATCH v2 1/4] utils: rename strtosz to use qemu prefix Eric Blake
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=55FC2BE4.8050001@redhat.com \
--to=eblake@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mlureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.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).