{"id":17587,"url":"https://patchwork.libcamera.org/api/patches/17587/?format=json","web_url":"https://patchwork.libcamera.org/patch/17587/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20221011105859.457567-10-paul.elder@ideasonboard.com>","date":"2022-10-11T10:58:59","name":"[libcamera-devel,v5,9/9,RFC] test: generated_serializer: Test skipHeader enums and flags","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"f80253094dc9e2e8db49745638a52a4c2514a923","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17587/mbox/","series":[{"id":3551,"url":"https://patchwork.libcamera.org/api/series/3551/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3551","date":"2022-10-11T10:58:50","name":"utils: ipc: Add support for enums and Flags","version":5,"mbox":"https://patchwork.libcamera.org/series/3551/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17587/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17587/checks/","tags":{},"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 08578C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 11 Oct 2022 10:59:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C434462D74;\n\tTue, 11 Oct 2022 12:59:32 +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 21FFF62D91\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 11 Oct 2022 12:59:30 +0200 (CEST)","from pyrite.rasen.tech (h175-177-042-159.catv02.itscom.jp\n\t[175.177.42.159])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CBA1F907;\n\tTue, 11 Oct 2022 12:59:28 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1665485972;\n\tbh=s9uknyDyrW6/tCcbTpz3ktrcMDk0rN/MVPr8Qg1iBfo=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=B7qMjspQtJSFiNFfnJdHD07KKZL6GVqMPFOepQzB3vQzVwytOPgpCdMP2Sg+8Yfc/\n\titdFgHqDFHzPzVrKTAk9bM2a3BgE6EpG7dcdFwPbcsokIaCCcnQ2RTxYtYEJqDM5EX\n\tMxx51UvCa9XWrlbk9Phkl4Lj6p7TDOo6fPMr3g0ZJeBZPm6C3/A6UaKRWOgu9Lr2ab\n\trjL2UAugp6H9Nifftbq4n7Xy9Q0mh5EDjY5bsr1xtxD3VJ85M3J/Y5cW/skB5kI0UU\n\tn2Xyo60mt5URmw2dkmJlgIqQWLtid60ZaguF2qWkxP/PgWu8uK16t7//k7iXmshCtE\n\tPRu/5iwUR/UXA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1665485969;\n\tbh=s9uknyDyrW6/tCcbTpz3ktrcMDk0rN/MVPr8Qg1iBfo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=T64/GBfXSbdeF6Lg2o+CdtPxP1DpVQiH0DTmuf9bmHQL81Ad/uMjfE0c4b0cJB5Ae\n\thw8Eszj9JW3D1uzXWuHfzbPAJhm9kxBQTdg6tDCdh/FpreshcteJypAGi+6G8UdkNp\n\tG8HB+h+S+XfnxJEk/pBLjJWaWKchVc/v0linrNhk="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"T64/GBfX\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 11 Oct 2022 19:58:59 +0900","Message-Id":"<20221011105859.457567-10-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.30.2","In-Reply-To":"<20221011105859.457567-1-paul.elder@ideasonboard.com>","References":"<20221011105859.457567-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 9/9] [RFC] test: generated_serializer:\n\tTest skipHeader enums and flags","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>","From":"Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Paul Elder <paul.elder@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add fields to the test struct to test serialization/deserialization of\nscoped enums and flags of said scoped enums that are defined in a C++\nheader, which are thus designated by [skipHeader] in mojom.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nNew in v5\n\nRFC because this touches core stuff. This can be detached from the rest\nof the series.\n---\n include/libcamera/ipa/core.mojom                      |  2 ++\n include/libcamera/ipa/ipa_interface.h                 |  7 +++++++\n .../generated_serializer_test.cpp                     | 11 +++++++++++\n .../include/libcamera/ipa/test.mojom                  |  4 ++++\n 4 files changed, 24 insertions(+)","diff":"diff --git a/include/libcamera/ipa/core.mojom b/include/libcamera/ipa/core.mojom\nindex 1ff674b0..3438af93 100644\n--- a/include/libcamera/ipa/core.mojom\n+++ b/include/libcamera/ipa/core.mojom\n@@ -84,6 +84,8 @@ module libcamera;\n [skipSerdes, skipHeader] struct ControlList {};\n [skipSerdes, skipHeader] struct SharedFD {};\n \n+[skipHeader, scopedEnum] enum TestEnum {};\n+\n [skipHeader] struct Point {\n \tint32 x;\n \tint32 y;\ndiff --git a/include/libcamera/ipa/ipa_interface.h b/include/libcamera/ipa/ipa_interface.h\nindex 8884f0ed..96fb8344 100644\n--- a/include/libcamera/ipa/ipa_interface.h\n+++ b/include/libcamera/ipa/ipa_interface.h\n@@ -27,6 +27,13 @@ namespace libcamera {\n  * tag must be #included here.\n  */\n \n+enum class TestEnum {\n+\tTestEnumValueA,\n+\tTestEnumValueB,\n+\tTestEnumValueC,\n+\tTestEnumValueD,\n+};\n+\n class IPAInterface\n {\n public:\ndiff --git a/test/serialization/generated_serializer/generated_serializer_test.cpp b/test/serialization/generated_serializer/generated_serializer_test.cpp\nindex 4670fe46..6f01c3d4 100644\n--- a/test/serialization/generated_serializer/generated_serializer_test.cpp\n+++ b/test/serialization/generated_serializer/generated_serializer_test.cpp\n@@ -11,6 +11,8 @@\n \n #include \"test.h\"\n \n+#include <libcamera/ipa/ipa_interface.h>\n+\n #include \"test_ipa_interface.h\"\n #include \"test_ipa_serializer.h\"\n \n@@ -59,6 +61,9 @@ if (struct1.field != struct2.field) {\t\t\t\t\\\n \t\tt.s3 = \"lorem ipsum\";\n \t\tt.i  = 58527;\n \t\tt.c = ipa::test::IPAOperationInit;\n+\t\tt.ex = TestEnum::TestEnumValueA;\n+\t\tt.exf |= TestEnum::TestEnumValueB;\n+\n \t\tt.e = ipa::test::ErrorFlags::Error1;\n \n \t\tFlags<ipa::test::ErrorFlags> flags;\n@@ -87,6 +92,8 @@ if (struct1.field != struct2.field) {\t\t\t\t\\\n \n \t\tTEST_SCOPED_ENUM_EQUALITY(t, u, e);\n \t\tTEST_SCOPED_ENUM_EQUALITY(t, u, f);\n+\t\tTEST_SCOPED_ENUM_EQUALITY(t, u, ex);\n+\t\tTEST_SCOPED_ENUM_EQUALITY(t, u, exf);\n \n \t\t/* Test vector of generated structs */\n \t\tstd::vector<ipa::test::TestStruct> v = { t, u };\n@@ -113,6 +120,8 @@ if (struct1.field != struct2.field) {\t\t\t\t\\\n \n \t\tTEST_SCOPED_ENUM_EQUALITY(v[0], w[0], e);\n \t\tTEST_SCOPED_ENUM_EQUALITY(v[0], w[0], f);\n+\t\tTEST_SCOPED_ENUM_EQUALITY(v[0], w[0], ex);\n+\t\tTEST_SCOPED_ENUM_EQUALITY(v[0], w[0], exf);\n \n \t\tTEST_FIELD_EQUALITY(v[1], w[1], s1);\n \t\tTEST_FIELD_EQUALITY(v[1], w[1], s2);\n@@ -122,6 +131,8 @@ if (struct1.field != struct2.field) {\t\t\t\t\\\n \n \t\tTEST_SCOPED_ENUM_EQUALITY(v[1], w[1], e);\n \t\tTEST_SCOPED_ENUM_EQUALITY(v[1], w[1], f);\n+\t\tTEST_SCOPED_ENUM_EQUALITY(v[1], w[1], ex);\n+\t\tTEST_SCOPED_ENUM_EQUALITY(v[1], w[1], exf);\n \n \t\treturn TestPass;\n \t}\ndiff --git a/test/serialization/generated_serializer/include/libcamera/ipa/test.mojom b/test/serialization/generated_serializer/include/libcamera/ipa/test.mojom\nindex 91c31642..1f1ba8dc 100644\n--- a/test/serialization/generated_serializer/include/libcamera/ipa/test.mojom\n+++ b/test/serialization/generated_serializer/include/libcamera/ipa/test.mojom\n@@ -2,6 +2,8 @@\n \n module ipa.test;\n \n+import \"include/libcamera/ipa/core.mojom\";\n+\n enum IPAOperationCode {\n \tIPAOperationNone,\n \tIPAOperationInit,\n@@ -28,6 +30,8 @@ struct TestStruct {\n \tIPAOperationCode c;\n \tErrorFlags e;\n \t[flags] ErrorFlags f;\n+\tlibcamera.TestEnum ex;\n+\t[flags] libcamera.TestEnum exf;\n };\n \n interface IPATestInterface {\n","prefixes":["libcamera-devel","v5","9/9","RFC"]}