devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Peter Hurley <peter-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>
Cc: Jon Loeliger <jdl-CYoMK+44s/E@public.gmane.org>,
	devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Grant Likely
	<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH] libfdt/tests: Add fdt_path_offset_namelen() test
Date: Thu, 9 Apr 2015 11:25:02 +1000	[thread overview]
Message-ID: <20150409012502.GL28909@voom.redhat.com> (raw)
In-Reply-To: <5523C326.7010603-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1908 bytes --]

On Tue, Apr 07, 2015 at 07:44:38AM -0400, Peter Hurley wrote:
> On 04/07/2015 07:12 AM, Peter Hurley wrote:
> > On 04/07/2015 12:49 AM, David Gibson wrote:
> >> I did spot a case where the existing code is arguably incorrect: using
> >> fdt_path_offset_namelen(fdt, "/somenode\0foo", 13) will return the
> >> same as fdt_path_offset(fdt, "/somenode"), although I think ideally it
> >> should always return -FDT_ERR_NOTFOUND, or some other error, since
> >> node names can never include \0.
> > 
> > Ok, I'll fix that.
> 
> I think your memchr() is broken.
> 
> Patch below passes with the following output:
> ....
> Checking offset of "/subnode@2/subsubnode@0/more" [first 24 characters] is 380...
> Checking offset of "/subnode@2/subsubnode@0/more" [first 25 characters] is -1...
> Checking offset of "/subnode@1" [first 14 characters] is -1...
> PASS

Huh, weird.  I had a similar test to this, but not identical and the
other day it failed.  Today, your test passes for me, and I can't
remember what my test was or otherwise trigger a problem.

Oh well, I guess we just leave it for now, and debug if it ever
appears again.

> 
> Regards,
> Peter Hurley
> 
> --- >% ---
> diff --git a/tests/path_offset.c b/tests/path_offset.c
> index bfebe9f..2788957 100644
> --- a/tests/path_offset.c
> +++ b/tests/path_offset.c
> @@ -133,5 +133,7 @@ int main(int argc, char *argv[])
>  	check_path_offset_namelen(fdt, "/subnode@2/subsubnode@0/more", 24, subsubnode2_offset2);
>  	check_path_offset_namelen(fdt, "/subnode@2/subsubnode@0/more", 25, -FDT_ERR_NOTFOUND);
>  
> +	check_path_offset_namelen(fdt, "/subnode@1\0foo", 14, -FDT_ERR_NOTFOUND);
> +
>  	PASS();
>  }
> 
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

      parent reply	other threads:[~2015-04-09  1:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-05  4:05 [PATCH] libfdt/tests: Add fdt_path_offset_namelen() test Peter Hurley
     [not found] ` <1428206756-27160-1-git-send-email-peter-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>
2015-04-07  4:49   ` David Gibson
     [not found]     ` <20150407044942.GC3476-RXTfZT5YzpxwFLYp8hBm2A@public.gmane.org>
2015-04-07 11:12       ` Peter Hurley
     [not found]         ` <5523BBA7.8090504-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>
2015-04-07 11:44           ` Peter Hurley
     [not found]             ` <5523C326.7010603-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>
2015-04-09  1:25               ` David Gibson [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=20150409012502.GL28909@voom.redhat.com \
    --to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
    --cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=jdl-CYoMK+44s/E@public.gmane.org \
    --cc=peter-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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).