[{"id":18555,"web_url":"https://patchwork.libcamera.org/comment/18555/","msgid":"<ba99d1d9-51e1-4837-c53c-be0803bc49e2@ideasonboard.com>","date":"2021-08-04T12:01:21","subject":"Re: [libcamera-devel] [RFC PATCH] tests: ipa_data_serializer_test:\n\tTest serializing fds","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Paul\n\nOn 8/4/21 5:05 PM, Paul Elder wrote:\n> Add tests to test IPADataSerializer serializing FileDescriptors.\n>\n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> ---\n>   include/libcamera/file_descriptor.h           |  1 +\n>   src/libcamera/file_descriptor.cpp             |  9 ++++\n>   .../ipa_data_serializer_test.cpp              | 43 +++++++++++++++++++\n>   3 files changed, 53 insertions(+)\n>\n> diff --git a/include/libcamera/file_descriptor.h b/include/libcamera/file_descriptor.h\n> index d514aac7..8f1d6f21 100644\n> --- a/include/libcamera/file_descriptor.h\n> +++ b/include/libcamera/file_descriptor.h\n> @@ -22,6 +22,7 @@ public:\n>   \n>   \tFileDescriptor &operator=(const FileDescriptor &other);\n>   \tFileDescriptor &operator=(FileDescriptor &&other);\n> +\tbool operator==(const FileDescriptor &other) const;\n>   \n>   \tbool isValid() const { return fd_ != nullptr; }\n>   \tint fd() const { return fd_ ? fd_->fd() : -1; }\n> diff --git a/src/libcamera/file_descriptor.cpp b/src/libcamera/file_descriptor.cpp\n> index 638b3bbe..f1394153 100644\n> --- a/src/libcamera/file_descriptor.cpp\n> +++ b/src/libcamera/file_descriptor.cpp\n> @@ -191,6 +191,15 @@ FileDescriptor &FileDescriptor::operator=(FileDescriptor &&other)\n>   \treturn *this;\n>   }\n>   \n> +/**\n> + * \\brief Compare FileDescriptor instances for equality\n> + * \\return True if the underlying file descriptor is equal, false otherwise\n> + */\n> +bool FileDescriptor::operator==(const FileDescriptor &other) const\n> +{\n> +\treturn this->fd() == other.fd();\n\nIn context of testVectorSerdes() which serdes a vector of \nFileDescriptors, this makes sense to me.\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n> +}\n> +\n>   /**\n>    * \\fn FileDescriptor::isValid()\n>    * \\brief Check if the FileDescriptor instance is valid\n> diff --git a/test/serialization/ipa_data_serializer_test.cpp b/test/serialization/ipa_data_serializer_test.cpp\n> index 1e8f7e21..9c8ff69c 100644\n> --- a/test/serialization/ipa_data_serializer_test.cpp\n> +++ b/test/serialization/ipa_data_serializer_test.cpp\n> @@ -11,6 +11,7 @@\n>   #include <iostream>\n>   #include <limits>\n>   #include <stdlib.h>\n> +#include <sys/mman.h>\n>   #include <sys/stat.h>\n>   #include <sys/types.h>\n>   #include <tuple>\n> @@ -144,6 +145,10 @@ protected:\n>   \t\tif (ret != TestPass)\n>   \t\t\treturn ret;\n>   \n> +\t\tret = testFd();\n> +\t\tif (ret != TestPass)\n> +\t\t\treturn ret;\n> +\n>   \t\treturn TestPass;\n>   \t}\n>   \n> @@ -435,6 +440,44 @@ private:\n>   \n>   \t\treturn TestPass;\n>   \t}\n> +\n> +\tint testFd()\n> +\t{\n> +\t\t/* Test serdes of single fd */\n> +\t\tint memfd = memfd_create(\"test\", 0);\n> +\t\tif (memfd < 0) {\n> +\t\t\tcerr << \"Failed to create memfd\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\tFileDescriptor fd = FileDescriptor(std::move(memfd));\n> +\t\tif (memfd != -1) {\n> +\t\t\tcerr << \"FileDescriptor move constructor failed\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\tif (testPodSerdes(fd) != TestPass)\n> +\t\t\treturn TestFail;\n> +\n> +\t\t/* Test serdes of vector of fds */\n> +\t\tstd::vector<FileDescriptor> vecFds;\n> +\n> +\t\tfor (unsigned int i = 0; i < 10; i++) {\n> +\t\t\tstd::string name = \"test\" + std::to_string(i);\n> +\t\t\tint mfd = memfd_create(name.c_str(), 0);\n> +\t\t\tif (mfd < 0)\n> +\t\t\t\treturn TestFail;\n> +\n> +\t\t\tvecFds.push_back(FileDescriptor(std::move(mfd)));\n> +\t\t\tif (mfd != -1)\n> +\t\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\tif (testVectorSerdes(vecFds) != TestPass)\n> +\t\t\treturn TestFail;\n> +\n> +\t\treturn TestPass;\n> +\t}\n>   };\n>   \n>   TEST_REGISTER(IPADataSerializerTest)","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 0F0C9C3235\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  4 Aug 2021 12:01:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7606E687B6;\n\tWed,  4 Aug 2021 14:01:28 +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 D07456026E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  4 Aug 2021 14:01:26 +0200 (CEST)","from [192.168.1.104] (unknown [103.251.226.40])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DDDE724F;\n\tWed,  4 Aug 2021 14:01:25 +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=\"uFfnZZWL\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1628078486;\n\tbh=jUyVyHTbaQ5EmKPug1zHxoi8ZH+lWJRqAL0kHnNZq7M=;\n\th=Subject:To:References:From:Date:In-Reply-To:From;\n\tb=uFfnZZWLM0pSSZw5PNlTmLLfVmnjZtejxQ/YFwAQjxcgNgk8Aq1SdTCtpP0KaaIIs\n\t1VKTXWNp8Ynpt35//lemEiuIjlIFvPJWJwAHD/6b1gakpfA3r01an2sQAP1gcjswa3\n\tmg1Me+931L8FTqizqV7rvjrvMnHG4BzTu5au7MSU=","To":"Paul Elder <paul.elder@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20210804113529.418162-1-paul.elder@ideasonboard.com>","From":"Umang Jain <umang.jain@ideasonboard.com>","Message-ID":"<ba99d1d9-51e1-4837-c53c-be0803bc49e2@ideasonboard.com>","Date":"Wed, 4 Aug 2021 17:31:21 +0530","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.10.2","MIME-Version":"1.0","In-Reply-To":"<20210804113529.418162-1-paul.elder@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Transfer-Encoding":"7bit","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [RFC PATCH] tests: ipa_data_serializer_test:\n\tTest serializing fds","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":18558,"web_url":"https://patchwork.libcamera.org/comment/18558/","msgid":"<YQqI5Vcqcy4AvTsZ@pendragon.ideasonboard.com>","date":"2021-08-04T12:32:37","subject":"Re: [libcamera-devel] [RFC PATCH] tests: ipa_data_serializer_test:\n\tTest serializing fds","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Paul,\n\nThank you for the patch.\n\nOn Wed, Aug 04, 2021 at 08:35:29PM +0900, Paul Elder wrote:\n> Add tests to test IPADataSerializer serializing FileDescriptors.\n> \n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> ---\n>  include/libcamera/file_descriptor.h           |  1 +\n>  src/libcamera/file_descriptor.cpp             |  9 ++++\n>  .../ipa_data_serializer_test.cpp              | 43 +++++++++++++++++++\n>  3 files changed, 53 insertions(+)\n> \n> diff --git a/include/libcamera/file_descriptor.h b/include/libcamera/file_descriptor.h\n> index d514aac7..8f1d6f21 100644\n> --- a/include/libcamera/file_descriptor.h\n> +++ b/include/libcamera/file_descriptor.h\n> @@ -22,6 +22,7 @@ public:\n>  \n>  \tFileDescriptor &operator=(const FileDescriptor &other);\n>  \tFileDescriptor &operator=(FileDescriptor &&other);\n> +\tbool operator==(const FileDescriptor &other) const;\n>  \n>  \tbool isValid() const { return fd_ != nullptr; }\n>  \tint fd() const { return fd_ ? fd_->fd() : -1; }\n> diff --git a/src/libcamera/file_descriptor.cpp b/src/libcamera/file_descriptor.cpp\n> index 638b3bbe..f1394153 100644\n> --- a/src/libcamera/file_descriptor.cpp\n> +++ b/src/libcamera/file_descriptor.cpp\n> @@ -191,6 +191,15 @@ FileDescriptor &FileDescriptor::operator=(FileDescriptor &&other)\n>  \treturn *this;\n>  }\n>  \n> +/**\n> + * \\brief Compare FileDescriptor instances for equality\n> + * \\return True if the underlying file descriptor is equal, false otherwise\n> + */\n> +bool FileDescriptor::operator==(const FileDescriptor &other) const\n> +{\n> +\treturn this->fd() == other.fd();\n> +}\n> +\n\nThis could alternatively be defined in\ntest/serialization/ipa_data_serializer_test.cpp, like we do for\nControlInfoMap. It would allow us to defer the decision on what equality\nof file descriptors means in general.\n\n>  /**\n>   * \\fn FileDescriptor::isValid()\n>   * \\brief Check if the FileDescriptor instance is valid\n> diff --git a/test/serialization/ipa_data_serializer_test.cpp b/test/serialization/ipa_data_serializer_test.cpp\n> index 1e8f7e21..9c8ff69c 100644\n> --- a/test/serialization/ipa_data_serializer_test.cpp\n> +++ b/test/serialization/ipa_data_serializer_test.cpp\n> @@ -11,6 +11,7 @@\n>  #include <iostream>\n>  #include <limits>\n>  #include <stdlib.h>\n> +#include <sys/mman.h>\n>  #include <sys/stat.h>\n>  #include <sys/types.h>\n>  #include <tuple>\n> @@ -144,6 +145,10 @@ protected:\n>  \t\tif (ret != TestPass)\n>  \t\t\treturn ret;\n>  \n> +\t\tret = testFd();\n> +\t\tif (ret != TestPass)\n> +\t\t\treturn ret;\n> +\n>  \t\treturn TestPass;\n>  \t}\n>  \n> @@ -435,6 +440,44 @@ private:\n>  \n>  \t\treturn TestPass;\n>  \t}\n> +\n> +\tint testFd()\n\nThe test currently fail, so it's a good one :-)\n\n> +\t{\n> +\t\t/* Test serdes of single fd */\n> +\t\tint memfd = memfd_create(\"test\", 0);\n> +\t\tif (memfd < 0) {\n> +\t\t\tcerr << \"Failed to create memfd\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\tFileDescriptor fd = FileDescriptor(std::move(memfd));\n> +\t\tif (memfd != -1) {\n> +\t\t\tcerr << \"FileDescriptor move constructor failed\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\tif (testPodSerdes(fd) != TestPass)\n> +\t\t\treturn TestFail;\n\nI highly recommend setting the meson option b_sanitize to\n\"address,undefined\":\n\n26/63 libcamera:serialization / ipa_data_serializer_test                 FAIL            0.11s   (exit status 255 or signal 127 SIGinvalid)\n>>> MALLOC_PERTURB_=209 build/x86-gcc-11.1.0/test/serialization/ipa_data_serializer_test\n――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ✀  ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――\nListing only the last 100 lines from a long log.\n0x612000001192: note: pointer points here\n 01 00  00 00 04 00 00 00 03 00  00 00 68 00 00 00 50 00  00 00 fe 7f 00 00 8c c1  9e bc 93 55 00 00\n              ^\n/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/bits/stl_function.h:386:20: runtime error: load of misaligned address 0x612000001192 for type 'const unsigned int', which requires 4 byte alignment\n0x612000001192: note: pointer points here\n 01 00  00 00 04 00 00 00 03 00  00 00 68 00 00 00 50 00  00 00 fe 7f 00 00 8c c1  9e bc 93 55 00 00\n              ^\n../../src/libcamera/control_serializer.cpp:363:11: runtime error: member access within misaligned address 0x61200000118e for type 'const struct ipa_controls_header', which requires 4 byte alignment\n0x61200000118e: note: pointer points here\n 68 00 00 00 01 00  00 00 04 00 00 00 03 00  00 00 68 00 00 00 50 00  00 00 fe 7f 00 00 8c c1  9e bc\n             ^\n../../src/libcamera/control_serializer.cpp:370:50: runtime error: member access within misaligned address 0x61200000118e for type 'const struct ipa_controls_header', which requires 4 byte alignment\n0x61200000118e: note: pointer points here\n 68 00 00 00 01 00  00 00 04 00 00 00 03 00  00 00 68 00 00 00 50 00  00 00 fe 7f 00 00 8c c1  9e bc\n             ^\n../../src/libcamera/control_serializer.cpp:371:49: runtime error: member access within misaligned address 0x61200000118e for type 'const struct ipa_controls_header', which requires 4 byte alignment\n0x61200000118e: note: pointer points here\n 68 00 00 00 01 00  00 00 04 00 00 00 03 00  00 00 68 00 00 00 50 00  00 00 fe 7f 00 00 8c c1  9e bc\n             ^\n../../src/libcamera/control_serializer.cpp:371:61: runtime error: member access within misaligned address 0x61200000118e for type 'const struct ipa_controls_header', which requires 4 byte alignment\n0x61200000118e: note: pointer points here\n 68 00 00 00 01 00  00 00 04 00 00 00 03 00  00 00 68 00 00 00 50 00  00 00 fe 7f 00 00 8c c1  9e bc\n             ^\n../../src/libcamera/control_serializer.cpp:380:36: runtime error: member access within misaligned address 0x61200000118e for type 'const struct ipa_controls_header', which requires 4 byte alignment\n0x61200000118e: note: pointer points here\n 68 00 00 00 01 00  00 00 04 00 00 00 03 00  00 00 68 00 00 00 50 00  00 00 fe 7f 00 00 8c c1  9e bc\n             ^\n../../src/libcamera/control_serializer.cpp:389:54: runtime error: member access within misaligned address 0x6120000011ae for type 'const struct ipa_control_info_entry', which requires 4 byte alignment\n0x6120000011ae: note: pointer points here\n 93 55 00 00 09 00  00 00 05 00 00 00 00 00  00 00 00 00 00 00 0a 00  00 00 05 00 00 00 08 00  00 00\n             ^\n../../src/libcamera/control_serializer.cpp:394:63: runtime error: member access within misaligned address 0x6120000011ae for type 'const struct ipa_control_info_entry', which requires 4 byte alignment\n0x6120000011ae: note: pointer points here\n 93 55 00 00 09 00  00 00 05 00 00 00 00 00  00 00 00 00 00 00 0a 00  00 00 05 00 00 00 08 00  00 00\n             ^\n../../src/libcamera/control_serializer.cpp:394:63: runtime error: reference binding to misaligned address 0x6120000011ae for type 'const unsigned int', which requires 4 byte alignment\n0x6120000011ae: note: pointer points here\n 93 55 00 00 09 00  00 00 05 00 00 00 00 00  00 00 00 00 00 00 0a 00  00 00 05 00 00 00 08 00  00 00\n             ^\n../../src/libcamera/control_serializer.cpp:394:63: runtime error: member access within misaligned address 0x6120000011ae for type 'const struct ipa_control_info_entry', which requires 4 byte alignment\n0x6120000011ae: note: pointer points here\n 93 55 00 00 09 00  00 00 05 00 00 00 00 00  00 00 00 00 00 00 0a 00  00 00 05 00 00 00 08 00  00 00\n             ^\n/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/bits/unique_ptr.h:962:57: runtime error: reference binding to misaligned address 0x6120000011ae for type 'const type', which requires 4 byte alignment\n0x6120000011ae: note: pointer points here\n 93 55 00 00 09 00  00 00 05 00 00 00 00 00  00 00 00 00 00 00 0a 00  00 00 05 00 00 00 08 00  00 00\n             ^\n/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/bits/move.h:78:36: runtime error: reference binding to misaligned address 0x6120000011ae for type 'const unsigned int', which requires 4 byte alignment\n0x6120000011ae: note: pointer points here\n 93 55 00 00 09 00  00 00 05 00 00 00 00 00  00 00 00 00 00 00 0a 00  00 00 05 00 00 00 08 00  00 00\n             ^\n/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/bits/unique_ptr.h:962:69: runtime error: load of misaligned address 0x6120000011ae for type 'const unsigned int', which requires 4 byte alignment\n0x6120000011ae: note: pointer points here\n 93 55 00 00 09 00  00 00 05 00 00 00 00 00  00 00 00 00 00 00 0a 00  00 00 05 00 00 00 08 00  00 00\n             ^\n../../src/libcamera/control_serializer.cpp:396:14: runtime error: member access within misaligned address 0x6120000011ae for type 'const struct ipa_control_info_entry', which requires 4 byte alignment\n0x6120000011ae: note: pointer points here\n 93 55 00 00 09 00  00 00 05 00 00 00 00 00  00 00 00 00 00 00 0a 00  00 00 05 00 00 00 08 00  00 00\n             ^\n../../src/libcamera/control_serializer.cpp:412:39: runtime error: member access within misaligned address 0x61200000118e for type 'const struct ipa_controls_header', which requires 4 byte alignment\n0x61200000118e: note: pointer points here\n 68 00 00 00 01 00  00 00 04 00 00 00 03 00  00 00 68 00 00 00 50 00  00 00 fe 7f 00 00 8c c1  9e bc\n             ^\n../../src/libcamera/control_serializer.cpp:412:39: runtime error: reference binding to misaligned address 0x612000001192 for type 'const key_type', which requires 4 byte alignment\n0x612000001192: note: pointer points here\n 01 00  00 00 04 00 00 00 03 00  00 00 68 00 00 00 50 00  00 00 fe 7f 00 00 8c c1  9e bc 93 55 00 00\n              ^\n../../src/libcamera/control_serializer.cpp:412:39: runtime error: member access within misaligned address 0x61200000118e for type 'const struct ipa_controls_header', which requires 4 byte alignment\n0x61200000118e: note: pointer points here\n 68 00 00 00 01 00  00 00 04 00 00 00 03 00  00 00 68 00 00 00 50 00  00 00 fe 7f 00 00 8c c1  9e bc\n             ^\n/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/bits/stl_map.h:1259:32: runtime error: reference binding to misaligned address 0x612000001192 for type 'const key_type', which requires 4 byte alignment\n0x612000001192: note: pointer points here\n 01 00  00 00 04 00 00 00 03 00  00 00 68 00 00 00 50 00  00 00 fe 7f 00 00 8c c1  9e bc 93 55 00 00\n              ^\n/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/bits/stl_tree.h:1270:30: runtime error: reference binding to misaligned address 0x612000001192 for type 'const unsigned int', which requires 4 byte alignment\n0x612000001192: note: pointer points here\n 01 00  00 00 04 00 00 00 03 00  00 00 68 00 00 00 50 00  00 00 fe 7f 00 00 8c c1  9e bc 93 55 00 00\n              ^\n/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/bits/stl_map.h:502:15: runtime error: reference binding to misaligned address 0x612000001192 for type 'const unsigned int', which requires 4 byte alignment\n0x612000001192: note: pointer points here\n 01 00  00 00 04 00 00 00 03 00  00 00 68 00 00 00 50 00  00 00 fe 7f 00 00 8c c1  9e bc 93 55 00 00\n              ^\n/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/tuple:444:49: runtime error: reference binding to misaligned address 0x612000001192 for type 'const type', which requires 4 byte alignment\n0x612000001192: note: pointer points here\n 01 00  00 00 04 00 00 00 03 00  00 00 68 00 00 00 50 00  00 00 fe 7f 00 00 8c c1  9e bc 93 55 00 00\n              ^\n/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/tuple:1771:35: runtime error: reference binding to misaligned address 0x612000001192 for type 'const type', which requires 4 byte alignment\n0x612000001192: note: pointer points here\n 01 00  00 00 04 00 00 00 03 00  00 00 68 00 00 00 50 00  00 00 fe 7f 00 00 8c c1  9e bc 93 55 00 00\n              ^\n/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/tuple:1771:9: runtime error: load of misaligned address 0x612000001192 for type 'const unsigned int', which requires 4 byte alignment\n0x612000001192: note: pointer points here\n 01 00  00 00 04 00 00 00 03 00  00 00 68 00 00 00 50 00  00 00 fe 7f 00 00 8c c1  9e bc 93 55 00 00\n              ^\n../../src/libcamera/control_serializer.cpp:413:31: runtime error: member access within misaligned address 0x61200000118e for type 'const struct ipa_controls_header', which requires 4 byte alignment\n0x61200000118e: note: pointer points here\n 68 00 00 00 01 00  00 00 04 00 00 00 03 00  00 00 68 00 00 00 50 00  00 00 fe 7f 00 00 8c c1  9e bc\n             ^\nDeserialized libcamera::FileDescriptor doesn't match original\n\n> +\n> +\t\t/* Test serdes of vector of fds */\n> +\t\tstd::vector<FileDescriptor> vecFds;\n> +\n> +\t\tfor (unsigned int i = 0; i < 10; i++) {\n> +\t\t\tstd::string name = \"test\" + std::to_string(i);\n> +\t\t\tint mfd = memfd_create(name.c_str(), 0);\n> +\t\t\tif (mfd < 0)\n> +\t\t\t\treturn TestFail;\n> +\n> +\t\t\tvecFds.push_back(FileDescriptor(std::move(mfd)));\n> +\t\t\tif (mfd != -1)\n> +\t\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\tif (testVectorSerdes(vecFds) != TestPass)\n> +\t\t\treturn TestFail;\n\nThe test looks good, but I'd like to have a fix before merging it.\n\n> +\n> +\t\treturn TestPass;\n> +\t}\n>  };\n>  \n>  TEST_REGISTER(IPADataSerializerTest)","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 9CCAEC3235\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  4 Aug 2021 12:32:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 05FB468811;\n\tWed,  4 Aug 2021 14:32:52 +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 3645B6026E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  4 Aug 2021 14:32:50 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9302C24F;\n\tWed,  4 Aug 2021 14:32:49 +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=\"m8I+LD7V\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1628080369;\n\tbh=IfaGRffU4ip3gczGsKXt4TPzCV5i44tk5rO8ojDkLY4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=m8I+LD7VyqxljYw02IIriBenAAOQZDoXpaeMcO1ADJHltkSNf1xVrDMF+TqfWEQjW\n\tfzaJz2mLwjC8GVoFCYZSVcOwSkOJfYL7lmaMZi5nIn/i9c4FA6ER4qf432B/uY0KcY\n\tFyqaOHgLw9R95WRpDkwc9Kzrn+vTmlbjr78+F1VA=","Date":"Wed, 4 Aug 2021 15:32:37 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Message-ID":"<YQqI5Vcqcy4AvTsZ@pendragon.ideasonboard.com>","References":"<20210804113529.418162-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20210804113529.418162-1-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [RFC PATCH] tests: ipa_data_serializer_test:\n\tTest serializing fds","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]