[{"id":31285,"web_url":"https://patchwork.libcamera.org/comment/31285/","msgid":"<m6ta5gxwgkn3dnmsfryxkmcg4ehgjbvdiasad7ketehe3272ax@jndsumf7stlu>","date":"2024-09-20T14:57:06","subject":"Re: [PATCH v3 2/3] libcanera: yaml-parser: Add failing test for\n\tunexpected behavior","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"The typo in the commit title will be fixed on merge/next update.\n\nOn Fri, Sep 20, 2024 at 03:28:09PM +0200, Stefan Klug wrote:\n> When accessing a nonexistent key on a dict the YamlObject returns an\n> empty element. This element can happily be cast to a string. This is\n> unexpected. For example the following statement:\n> \n> yamlDict[\"nonexistent\"].get<string>(\"default\")\n> \n> is expected to return \"default\" but actually returns \"\". Add a (failing)\n> testcase for that behavior.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> \n> ---\n> Changes in v3:\n> - Added separate patch for the failing test\n> ---\n>  test/yaml-parser.cpp | 6 ++++++\n>  1 file changed, 6 insertions(+)\n> \n> diff --git a/test/yaml-parser.cpp b/test/yaml-parser.cpp\n> index 347999831d61..4cc77e26ae39 100644\n> --- a/test/yaml-parser.cpp\n> +++ b/test/yaml-parser.cpp\n> @@ -536,6 +536,12 @@ protected:\n>  \t\t\treturn TestFail;\n>  \t\t}\n>  \n> +\t\t/* Test access to nonexistent member. */\n> +\t\tif (dictObj[\"nonexistent\"].get<std::string>(\"default\") != \"default\") {\n> +\t\t\tcerr << \"Accessing nonexistent dict entry fails to return default\" << std::endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n>  \t\t/* Make sure utils::map_keys() works on the adapter. */\n>  \t\t(void)utils::map_keys(dictObj.asDict());\n>  \n> -- \n> 2.43.0\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 70B0EC3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 20 Sep 2024 14:57:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 12F8F634FC;\n\tFri, 20 Sep 2024 16:57:12 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C13C7618E0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 Sep 2024 16:57:09 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:8ade:938d:48b1:cede])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BD96B3DA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 Sep 2024 16:55:45 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"S2t5lbwa\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1726844145;\n\tbh=3Ki9X3RB15fG5Mui2OTPLWxoiTlj5k5iCMchwt9Udmk=;\n\th=Date:From:To:Subject:References:In-Reply-To:From;\n\tb=S2t5lbwaC1bbgbwMjDN8DQis0VKHaB0JKriPkGjNKqFp6jRy6hzOhFICN6fNchpK9\n\tszVW2LCJdEdCVS7w2rT3811+iv3emp1KihXXQkaiughupHVoqtLH7E8hEtZly8Nlx9\n\tRecq7jgTtT0cj82pso1Z5N4iC2AQsJrAzc402me4=","Date":"Fri, 20 Sep 2024 16:57:06 +0200","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v3 2/3] libcanera: yaml-parser: Add failing test for\n\tunexpected behavior","Message-ID":"<m6ta5gxwgkn3dnmsfryxkmcg4ehgjbvdiasad7ketehe3272ax@jndsumf7stlu>","References":"<20240920132823.88433-1-stefan.klug@ideasonboard.com>\n\t<20240920132823.88433-3-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240920132823.88433-3-stefan.klug@ideasonboard.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":31288,"web_url":"https://patchwork.libcamera.org/comment/31288/","msgid":"<172692225760.2374548.6814247375207877360@ping.linuxembedded.co.uk>","date":"2024-09-21T12:37:37","subject":"Re: [PATCH v3 2/3] libcanera: yaml-parser: Add failing test for\n\tunexpected behavior","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Stefan Klug (2024-09-20 14:28:09)\n> When accessing a nonexistent key on a dict the YamlObject returns an\n> empty element. This element can happily be cast to a string. This is\n> unexpected. For example the following statement:\n> \n> yamlDict[\"nonexistent\"].get<string>(\"default\")\n> \n> is expected to return \"default\" but actually returns \"\". Add a (failing)\n> testcase for that behavior.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> \n> ---\n> Changes in v3:\n> - Added separate patch for the failing test\n> ---\n>  test/yaml-parser.cpp | 6 ++++++\n>  1 file changed, 6 insertions(+)\n> \n> diff --git a/test/yaml-parser.cpp b/test/yaml-parser.cpp\n> index 347999831d61..4cc77e26ae39 100644\n> --- a/test/yaml-parser.cpp\n> +++ b/test/yaml-parser.cpp\n> @@ -536,6 +536,12 @@ protected:\n>                         return TestFail;\n>                 }\n>  \n> +               /* Test access to nonexistent member. */\n> +               if (dictObj[\"nonexistent\"].get<std::string>(\"default\") != \"default\") {\n> +                       cerr << \"Accessing nonexistent dict entry fails to return default\" << std::endl;\n> +                       return TestFail;\n> +               }\n> +\n>                 /* Make sure utils::map_keys() works on the adapter. */\n>                 (void)utils::map_keys(dictObj.asDict());\n>  \n\nWe should also add the following change/hunk to this patch, or make test\nwill fail at bisection here:\n\ndiff --git a/test/meson.build b/test/meson.build\nindex 5ed052ed62c8..dcd169a8793e 100644\n--- a/test/meson.build\n+++ b/test/meson.build\n@@ -73,7 +73,7 @@ internal_tests = [\n     {'name': 'timer-thread', 'sources': ['timer-thread.cpp']},\n     {'name': 'unique-fd', 'sources': ['unique-fd.cpp']},\n     {'name': 'utils', 'sources': ['utils.cpp']},\n-    {'name': 'yaml-parser', 'sources': ['yaml-parser.cpp']},\n+    {'name': 'yaml-parser', 'sources': ['yaml-parser.cpp'], 'should_fail': true},\n ]\n\n internal_non_parallel_tests = [\n\n\nWith that:\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> -- \n> 2.43.0\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id E4C9CC3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 21 Sep 2024 12:37:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EE244634FC;\n\tSat, 21 Sep 2024 14:37:43 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 99BBF618E4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 21 Sep 2024 14:37:41 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2C2E4890;\n\tSat, 21 Sep 2024 14:36:16 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"LkS3OY5G\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1726922176;\n\tbh=ciB2hGYQiQwdVRnmYrtVRnDuha6GMHD9ixJPJooFadk=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=LkS3OY5GuodilITCjhYw7N32KfWCX3LzoO8pi4o4Z1pFifWnVX5AvTHm0yd0gbk0w\n\tBA4H01XALiEkry4ZSAlGcIbgV2u+zYQ3XxKhG6np7tKrub9mWo7tPIqq/6Qu1NtXW0\n\tjGlF3du6KetpsNM5d4cREA68+/VUx2ypLIT+RNew=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20240920132823.88433-3-stefan.klug@ideasonboard.com>","References":"<20240920132823.88433-1-stefan.klug@ideasonboard.com>\n\t<20240920132823.88433-3-stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH v3 2/3] libcanera: yaml-parser: Add failing test for\n\tunexpected behavior","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Sat, 21 Sep 2024 13:37:37 +0100","Message-ID":"<172692225760.2374548.6814247375207877360@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":31304,"web_url":"https://patchwork.libcamera.org/comment/31304/","msgid":"<ZvE-eaa71M6okYZ9@pyrite.rasen.tech>","date":"2024-09-23T10:10:01","subject":"Re: [PATCH v3 2/3] libcanera: yaml-parser: Add failing test for\n\tunexpected behavior","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"On Fri, Sep 20, 2024 at 03:28:09PM +0200, Stefan Klug wrote:\n> When accessing a nonexistent key on a dict the YamlObject returns an\n> empty element. This element can happily be cast to a string. This is\n> unexpected. For example the following statement:\n> \n> yamlDict[\"nonexistent\"].get<string>(\"default\")\n> \n> is expected to return \"default\" but actually returns \"\". Add a (failing)\n> testcase for that behavior.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\nWith either squashing or should_fail,\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> \n> ---\n> Changes in v3:\n> - Added separate patch for the failing test\n> ---\n>  test/yaml-parser.cpp | 6 ++++++\n>  1 file changed, 6 insertions(+)\n> \n> diff --git a/test/yaml-parser.cpp b/test/yaml-parser.cpp\n> index 347999831d61..4cc77e26ae39 100644\n> --- a/test/yaml-parser.cpp\n> +++ b/test/yaml-parser.cpp\n> @@ -536,6 +536,12 @@ protected:\n>  \t\t\treturn TestFail;\n>  \t\t}\n>  \n> +\t\t/* Test access to nonexistent member. */\n> +\t\tif (dictObj[\"nonexistent\"].get<std::string>(\"default\") != \"default\") {\n> +\t\t\tcerr << \"Accessing nonexistent dict entry fails to return default\" << std::endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n>  \t\t/* Make sure utils::map_keys() works on the adapter. */\n>  \t\t(void)utils::map_keys(dictObj.asDict());\n>  \n> -- \n> 2.43.0\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 14AD6C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 Sep 2024 10:10:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C67F36350C;\n\tMon, 23 Sep 2024 12:10:10 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 61AA46037E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Sep 2024 12:10:08 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2404:7a81:160:2100:2fac:fd68:a1d3:63f3])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 52BD42E0;\n\tMon, 23 Sep 2024 12:08:41 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"doRr1wts\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1727086122;\n\tbh=RClPWBymmaMbN3sjtXNYDpUlkykqYyA3ZFslTBFzf1A=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=doRr1wts9K6ZBc5VtUDQiYbrl+vopCmRjT8uI7C56MAjyQNUWPUH2ZDsvd0oOXrd2\n\tAWWIweeRy3kAy2ORi6TwPW8cCp+UGre+yopL7eGeqh3xyopQctTw1nONZlUxj7dA49\n\t5SSF8uAkmGSEtGq8rADQBzp4AePXoHIOq9EnhyFI=","Date":"Mon, 23 Sep 2024 19:10:01 +0900","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v3 2/3] libcanera: yaml-parser: Add failing test for\n\tunexpected behavior","Message-ID":"<ZvE-eaa71M6okYZ9@pyrite.rasen.tech>","References":"<20240920132823.88433-1-stefan.klug@ideasonboard.com>\n\t<20240920132823.88433-3-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20240920132823.88433-3-stefan.klug@ideasonboard.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]