[{"id":30063,"web_url":"https://patchwork.libcamera.org/comment/30063/","msgid":"<171926546544.625657.1607128370252378806@ping.linuxembedded.co.uk>","date":"2024-06-24T21:44:25","subject":"Re: [PATCH 09/10] test: gstreamer: Include missing\n\tsanitizer/asan_interface.h header","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart (2024-06-24 20:29:40)\n> The GStreamet tests define a __asan_default_options() function to\n\nGStreamer\n\n> influence the behaviour of ASan. The function is declared in\n> sanitizer/asan_interface.h, but we don't include the header. This will\n> cause missing declaration warnings when we enable the\n> -Wmissing-declarations option.\n> \n> Include the header to fix the issue. It can't be done unconditionally as\n> not all toolchains provide ASan, so check for its availability at\n> configuration time.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  test/gstreamer/gstreamer_test.cpp | 6 ++++++\n>  test/gstreamer/meson.build        | 7 +++++++\n>  2 files changed, 13 insertions(+)\n> \n> diff --git a/test/gstreamer/gstreamer_test.cpp b/test/gstreamer/gstreamer_test.cpp\n> index e8119b853e7e..a15fef0e0c07 100644\n> --- a/test/gstreamer/gstreamer_test.cpp\n> +++ b/test/gstreamer/gstreamer_test.cpp\n> @@ -9,12 +9,17 @@\n>  \n>  #include <libcamera/base/utils.h>\n>  \n> +#if HAVE_ASAN\n> +#include <sanitizer/asan_interface.h>\n> +#endif\n> +\n>  #include \"gstreamer_test.h\"\n>  \n>  #include \"test.h\"\n>  \n>  using namespace std;\n>  \n> +#if HAVE_ASAN\n>  extern \"C\" {\n>  const char *__asan_default_options()\n>  {\n> @@ -26,6 +31,7 @@ const char *__asan_default_options()\n>         return \"detect_leaks=false\";\n>  }\n>  }\n> +#endif\n>  \n>  GstreamerTest::GstreamerTest(unsigned int numStreams)\n>         : pipeline_(nullptr), libcameraSrc_(nullptr)\n> diff --git a/test/gstreamer/meson.build b/test/gstreamer/meson.build\n> index f3ba5a23dfba..37ad125ef3fd 100644\n> --- a/test/gstreamer/meson.build\n> +++ b/test/gstreamer/meson.build\n> @@ -11,8 +11,15 @@ gstreamer_tests = [\n>  ]\n>  gstreamer_dep = dependency('gstreamer-1.0', required : true)\n>  \n> +gstreamer_test_args = []\n> +\n> +if asan_enabled\n\nHa, I just went looking to figure out where in meson this was defined,\nbut we create it!\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> +    gstreamer_test_args += ['-D', 'HAVE_ASAN=1']\n> +endif\n> +\n>  foreach test : gstreamer_tests\n>      exe = executable(test['name'], test['sources'], 'gstreamer_test.cpp',\n> +                     cpp_args : gstreamer_test_args,\n>                       dependencies : [libcamera_private, gstreamer_dep],\n>                       link_with : test_libraries,\n>                       include_directories : test_includes_internal)\n> -- \n> Regards,\n> \n> Laurent Pinchart\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 A3FE2BDB1D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Jun 2024 21:44:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9449B654AE;\n\tMon, 24 Jun 2024 23:44:30 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 73BA2654A9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Jun 2024 23:44:28 +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 42AB51650;\n\tMon, 24 Jun 2024 23:44:06 +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=\"DeeLl+ap\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1719265446;\n\tbh=UdbJhahIkl52yU/i9f+9zOfNoe6bwSFm9kazT3zLUtg=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=DeeLl+apPWIEb/Lgql9wcVYj8h9d/iWthsNbndOPKtpj8oB8juoOAUzCRXcOcU7eX\n\tsTU8wQckREi7aOfCWkOXoEaL4Fzi+aONjZBVgV1CraPMiiWuC5ewHYHCQZBGFeuLte\n\tkPFMdseJ1bKzqAoC2NGHAIHGYAQTcj2z9ZKqGiKI=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20240624192941.22943-10-laurent.pinchart@ideasonboard.com>","References":"<20240624192941.22943-1-laurent.pinchart@ideasonboard.com>\n\t<20240624192941.22943-10-laurent.pinchart@ideasonboard.com>","Subject":"Re: [PATCH 09/10] test: gstreamer: Include missing\n\tsanitizer/asan_interface.h header","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 24 Jun 2024 22:44:25 +0100","Message-ID":"<171926546544.625657.1607128370252378806@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>"}}]