From patchwork Tue Oct 11 10:58:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 17587 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 08578C0DA4 for ; Tue, 11 Oct 2022 10:59:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C434462D74; Tue, 11 Oct 2022 12:59:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1665485972; bh=s9uknyDyrW6/tCcbTpz3ktrcMDk0rN/MVPr8Qg1iBfo=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=B7qMjspQtJSFiNFfnJdHD07KKZL6GVqMPFOepQzB3vQzVwytOPgpCdMP2Sg+8Yfc/ itdFgHqDFHzPzVrKTAk9bM2a3BgE6EpG7dcdFwPbcsokIaCCcnQ2RTxYtYEJqDM5EX Mxx51UvCa9XWrlbk9Phkl4Lj6p7TDOo6fPMr3g0ZJeBZPm6C3/A6UaKRWOgu9Lr2ab rjL2UAugp6H9Nifftbq4n7Xy9Q0mh5EDjY5bsr1xtxD3VJ85M3J/Y5cW/skB5kI0UU n2Xyo60mt5URmw2dkmJlgIqQWLtid60ZaguF2qWkxP/PgWu8uK16t7//k7iXmshCtE PRu/5iwUR/UXA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 21FFF62D91 for ; Tue, 11 Oct 2022 12:59:30 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="T64/GBfX"; dkim-atps=neutral Received: from pyrite.rasen.tech (h175-177-042-159.catv02.itscom.jp [175.177.42.159]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CBA1F907; Tue, 11 Oct 2022 12:59:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1665485969; bh=s9uknyDyrW6/tCcbTpz3ktrcMDk0rN/MVPr8Qg1iBfo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T64/GBfXSbdeF6Lg2o+CdtPxP1DpVQiH0DTmuf9bmHQL81Ad/uMjfE0c4b0cJB5Ae hw8Eszj9JW3D1uzXWuHfzbPAJhm9kxBQTdg6tDCdh/FpreshcteJypAGi+6G8UdkNp G8HB+h+S+XfnxJEk/pBLjJWaWKchVc/v0linrNhk= 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 Subject: [libcamera-devel] [PATCH v5 9/9] [RFC] test: generated_serializer: Test skipHeader enums and flags X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Paul Elder via libcamera-devel From: Paul Elder Reply-To: Paul Elder Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add fields to the test struct to test serialization/deserialization of scoped enums and flags of said scoped enums that are defined in a C++ header, which are thus designated by [skipHeader] in mojom. Signed-off-by: Paul Elder --- New in v5 RFC because this touches core stuff. This can be detached from the rest of the series. --- include/libcamera/ipa/core.mojom | 2 ++ include/libcamera/ipa/ipa_interface.h | 7 +++++++ .../generated_serializer_test.cpp | 11 +++++++++++ .../include/libcamera/ipa/test.mojom | 4 ++++ 4 files changed, 24 insertions(+) diff --git a/include/libcamera/ipa/core.mojom b/include/libcamera/ipa/core.mojom index 1ff674b0..3438af93 100644 --- a/include/libcamera/ipa/core.mojom +++ b/include/libcamera/ipa/core.mojom @@ -84,6 +84,8 @@ module libcamera; [skipSerdes, skipHeader] struct ControlList {}; [skipSerdes, skipHeader] struct SharedFD {}; +[skipHeader, scopedEnum] enum TestEnum {}; + [skipHeader] struct Point { int32 x; int32 y; diff --git a/include/libcamera/ipa/ipa_interface.h b/include/libcamera/ipa/ipa_interface.h index 8884f0ed..96fb8344 100644 --- a/include/libcamera/ipa/ipa_interface.h +++ b/include/libcamera/ipa/ipa_interface.h @@ -27,6 +27,13 @@ namespace libcamera { * tag must be #included here. */ +enum class TestEnum { + TestEnumValueA, + TestEnumValueB, + TestEnumValueC, + TestEnumValueD, +}; + class IPAInterface { public: diff --git a/test/serialization/generated_serializer/generated_serializer_test.cpp b/test/serialization/generated_serializer/generated_serializer_test.cpp index 4670fe46..6f01c3d4 100644 --- a/test/serialization/generated_serializer/generated_serializer_test.cpp +++ b/test/serialization/generated_serializer/generated_serializer_test.cpp @@ -11,6 +11,8 @@ #include "test.h" +#include + #include "test_ipa_interface.h" #include "test_ipa_serializer.h" @@ -59,6 +61,9 @@ if (struct1.field != struct2.field) { \ t.s3 = "lorem ipsum"; t.i = 58527; t.c = ipa::test::IPAOperationInit; + t.ex = TestEnum::TestEnumValueA; + t.exf |= TestEnum::TestEnumValueB; + t.e = ipa::test::ErrorFlags::Error1; Flags flags; @@ -87,6 +92,8 @@ if (struct1.field != struct2.field) { \ TEST_SCOPED_ENUM_EQUALITY(t, u, e); TEST_SCOPED_ENUM_EQUALITY(t, u, f); + TEST_SCOPED_ENUM_EQUALITY(t, u, ex); + TEST_SCOPED_ENUM_EQUALITY(t, u, exf); /* Test vector of generated structs */ std::vector v = { t, u }; @@ -113,6 +120,8 @@ if (struct1.field != struct2.field) { \ TEST_SCOPED_ENUM_EQUALITY(v[0], w[0], e); TEST_SCOPED_ENUM_EQUALITY(v[0], w[0], f); + TEST_SCOPED_ENUM_EQUALITY(v[0], w[0], ex); + TEST_SCOPED_ENUM_EQUALITY(v[0], w[0], exf); TEST_FIELD_EQUALITY(v[1], w[1], s1); TEST_FIELD_EQUALITY(v[1], w[1], s2); @@ -122,6 +131,8 @@ if (struct1.field != struct2.field) { \ TEST_SCOPED_ENUM_EQUALITY(v[1], w[1], e); TEST_SCOPED_ENUM_EQUALITY(v[1], w[1], f); + TEST_SCOPED_ENUM_EQUALITY(v[1], w[1], ex); + TEST_SCOPED_ENUM_EQUALITY(v[1], w[1], exf); return TestPass; } diff --git a/test/serialization/generated_serializer/include/libcamera/ipa/test.mojom b/test/serialization/generated_serializer/include/libcamera/ipa/test.mojom index 91c31642..1f1ba8dc 100644 --- a/test/serialization/generated_serializer/include/libcamera/ipa/test.mojom +++ b/test/serialization/generated_serializer/include/libcamera/ipa/test.mojom @@ -2,6 +2,8 @@ module ipa.test; +import "include/libcamera/ipa/core.mojom"; + enum IPAOperationCode { IPAOperationNone, IPAOperationInit, @@ -28,6 +30,8 @@ struct TestStruct { IPAOperationCode c; ErrorFlags e; [flags] ErrorFlags f; + libcamera.TestEnum ex; + [flags] libcamera.TestEnum exf; }; interface IPATestInterface {