<div dir="ltr"><div dir="ltr">Hi,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 13 Jun 2022 at 07:18, Laurent Pinchart <<a href="mailto:laurent.pinchart@ideasonboard.com">laurent.pinchart@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Paul,<br>
<br>
On Mon, Jun 13, 2022 at 01:22:19PM +0900, <a href="mailto:paul.elder@ideasonboard.com" target="_blank">paul.elder@ideasonboard.com</a> wrote:<br>
> Hi Laurent,<br>
> <br>
> On Sat, Jun 04, 2022 at 09:59:30PM +0300, Laurent Pinchart via libcamera-devel wrote:<br>
> > The order of items in a YAML dictionary may matter. Update the test to<br>
> > ensure that it is preserved. The test currently fails at the YamlParser<br>
> <br>
> My understanding is that YAML mappings are unordered [1] [2], and if<br>
> order in the mapping is significant, then either a sequence of mappings<br>
> [3] or flow mapping adjacent values [4] should be used.<br>
<br>
That's a very good point. [5] even mentions<br>
<br>
"while imposing a order on mapping keys is necessary for flattening YAML<br>
representations to a sequential access medium, this serialization detail<br>
must not be used to convey application level information."<br>
<br>
The same applies to JSON ([6]).<br>
<br>
Fixing this would require changing the syntax of the tuning files. It's<br>
inconvenient, but not doing so opens the door to more issues in the<br>
future :-S<br></blockquote><div><br></div><div>Given that the IPA does require ordering and we have been lucky with</div><div>Boost preserving order in the JSON parser, I think we probably ought</div><div>to specify ordering in the config file with a specific key.  When I get a</div><div>change, I'll look to add a patch to allow this on the existing codebase,</div><div>and this series ought to "just work" after that.</div><div><br></div><div>Thanks,</div><div>Naush</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> [1] <a href="https://yaml.org/spec/1.2.2/#mapping" rel="noreferrer" target="_blank">https://yaml.org/spec/1.2.2/#mapping</a><br>
> [2] <a href="https://yaml.org/spec/1.2.2/#3221-mapping-key-order" rel="noreferrer" target="_blank">https://yaml.org/spec/1.2.2/#3221-mapping-key-order</a><br>
> [3] <a href="https://yaml.org/spec/1.2.2/#example-ordered-mappings" rel="noreferrer" target="_blank">https://yaml.org/spec/1.2.2/#example-ordered-mappings</a><br>
> [4] <a href="https://yaml.org/spec/1.2.2/#example-flow-mapping-adjacent-values" rel="noreferrer" target="_blank">https://yaml.org/spec/1.2.2/#example-flow-mapping-adjacent-values</a><br>
<br>
[5] <a href="https://yaml.org/spec/1.2.2/#32-information-models" rel="noreferrer" target="_blank">https://yaml.org/spec/1.2.2/#32-information-models</a><br>
[6] <a href="https://www.json.org/json-en.html" rel="noreferrer" target="_blank">https://www.json.org/json-en.html</a><br>
<br>
> > doesn't correctly preserve the order, this will be fixed by the next<br>
> > commit.<br>
> > <br>
> > Signed-off-by: Laurent Pinchart <<a href="mailto:laurent.pinchart@ideasonboard.com" target="_blank">laurent.pinchart@ideasonboard.com</a>><br>
> > ---<br>
> >  test/yaml-parser.cpp | 7 +++----<br>
> >  1 file changed, 3 insertions(+), 4 deletions(-)<br>
> > <br>
> > diff --git a/test/yaml-parser.cpp b/test/yaml-parser.cpp<br>
> > index 5ff4c3236dbf..582c9caed836 100644<br>
> > --- a/test/yaml-parser.cpp<br>
> > +++ b/test/yaml-parser.cpp<br>
> > @@ -29,8 +29,8 @@ static const string testYaml =<br>
> >     "  - Mary\n"<br>
> >     "dictionary:\n"<br>
> >     "  a: 1\n"<br>
> > -   "  b: 2\n"<br>
> >     "  c: 3\n"<br>
> > +   "  b: 2\n"<br>
> >     "level1:\n"<br>
> >     "  level2:\n"<br>
> >     "    - [1, 2]\n"<br>
> > @@ -428,7 +428,6 @@ protected:<br>
> >             }<br>
> >  <br>
> >             auto memeberNames = dictObj.memberNames();<br>
> > -           sort(memeberNames.begin(), memeberNames.end());<br>
> >  <br>
> >             if (memeberNames.size() != 3) {<br>
> >                     cerr << "Dictionary object fail to extra member names" << std::endl;<br>
> > @@ -436,8 +435,8 @@ protected:<br>
> >             }<br>
> >  <br>
> >             if (memeberNames[0] != "a" ||<br>
> > -               memeberNames[1] != "b" ||<br>
> > -               memeberNames[2] != "c") {<br>
> > +               memeberNames[1] != "c" ||<br>
> > +               memeberNames[2] != "b") {<br>
> >                     cerr << "Dictionary object fail to parse member names" << std::endl;<br>
> >                     return TestFail;<br>
> >             }<br>
<br>
-- <br>
Regards,<br>
<br>
Laurent Pinchart<br>
</blockquote></div></div>