[{"id":32793,"web_url":"https://patchwork.libcamera.org/comment/32793/","msgid":"<20241217001720.GD19635@pendragon.ideasonboard.com>","date":"2024-12-17T00:17:20","subject":"Re: [libcamera-ci] [RFC PATCH v2 4/4] Add job to run lc-compliance\n\ton the virtual pipeline handler","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Barnabás,\n\nThank you for the patch.\n\nOn Mon, Dec 16, 2024 at 06:28:27PM +0100, Barnabás Pőcze wrote:\n> Add a new job named `lc-compliance:virtual` that uses the\n> build artifacts created by the `build-package:debug` job\n> on amd64 to run `lc-compliance` on the \"Virtual0\" camera\n> in a virtual machine.\n> \n> The `force_fallback_for=gtest` option is needed because `cpp_debustl`\n\ns/debustl/debugstl/\n\n> makes ABI incompatible changes in the STL containers, so googletest\n> also needs to be compiled with these changes.\n\nDownloading sources at build time in CI isn't great, I'd like to avoid\nit when possible. If it can't be avoided, so be it. There are\nprecedents, we download and install the packages that are not multi-arch\ncompatible at build time, and we also force a fallback for gtest when\ncompiling with clang and libc++.\n\nOn a side note, I'm wondering if we shouldn't just disable lc-compliance\nwhen building with clang and libc++, and download and cache the .deb\npackages at container build time. If anyone wants to give it a try...\n:-)\n\nBack to the topic, does cpp_debugstl give use significant benefits\ncompared to ASan and UBSan ?\n\n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> ---\n> \n> Changes in v2:\n>   * publish lc-compliance results to gitlab\n>   * add and use script to install libcamera binary package\n> \n> ---\n>  .gitlab-ci/test-lc-compliance.sh  | 37 +++++++++++++++++++++++++++++++\n>  .gitlab-ci/unpackage-libcamera.sh | 17 ++++++++++++++\n>  gitlab-ci.yml                     | 24 +++++++++++++++++++-\n>  3 files changed, 77 insertions(+), 1 deletion(-)\n>  create mode 100755 .gitlab-ci/test-lc-compliance.sh\n>  create mode 100755 .gitlab-ci/unpackage-libcamera.sh\n> \n> diff --git a/.gitlab-ci/test-lc-compliance.sh b/.gitlab-ci/test-lc-compliance.sh\n> new file mode 100755\n> index 0000000..a927f1d\n> --- /dev/null\n> +++ b/.gitlab-ci/test-lc-compliance.sh\n> @@ -0,0 +1,37 @@\n> +#!/bin/bash\n> +\n> +# SPDX-License-Identifier: GPL-2.0-or-later\n> +# SPDX-FileCopyrightText: © 2024 Google Inc.\n> +\n> +set -e\n> +\n> +source \"$(dirname \"$0\")/lib.sh\"\n> +\n> +libcamera_compliance() {\n> +\techo \"Running libcamera compliance tests in a qemu VM\"\n> +\n> +\tvirtme-ng \\\n> +\t\t--verbose \\\n> +\t\t--skip-modules \\\n> +\t\t--force-9p \\\n> +\t\t--rwdir \"$PWD/build\" \\\n> +\t\t--run /opt/linux/bzImage \\\n> +\t\t--exec \"\\\n\ns/\"/\" /\n\n> +\t\t\tLIBCAMERA_LOG_LEVELS=*:DEBUG \\\n> +\t\t\tASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 \\\n> +\t\t\tUBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 \\\n> +\t\t\tGTEST_OUTPUT=xml:./build/lc-compliance-report.xml \\\n> +\t\t\tlc-compliance -c Virtual0; \\\n> +\t\t\techo \\\\\\$? > ./build/.test-status \\\n> +\t\t\"\n> +\n> +\tlocal status=$(cat build/.test-status)\n> +\techo \"Test result exit state: $status\"\n> +\trm build/.test-status\n> +\n> +\tif [[ $status != 0 ]] ; then\n> +\t\texit $status\n> +\tfi\n> +}\n> +\n> +run libcamera_compliance\n> diff --git a/.gitlab-ci/unpackage-libcamera.sh b/.gitlab-ci/unpackage-libcamera.sh\n> new file mode 100755\n> index 0000000..9eb3192\n> --- /dev/null\n> +++ b/.gitlab-ci/unpackage-libcamera.sh\n> @@ -0,0 +1,17 @@\n> +#!/bin/bash\n> +\n> +# SPDX-License-Identifier: GPL-2.0-or-later\n> +# SPDX-FileCopyrightText: © 2024 Google Inc.\n> +\n> +set -e\n> +\n> +source \"$(dirname \"$0\")/lib.sh\"\n> +\n> +libcamera_unpackage() {\n> +\techo \"Unpackage libcamera binaries\"\n> +\n> +\ttar -xvf libcamera-${CI_COMMIT_SHA}.tar.xz -C /\n> +\tldconfig -v\n> +}\n> +\n> +run libcamera_unpackage\n> diff --git a/gitlab-ci.yml b/gitlab-ci.yml\n> index 0a3eab3..8ea1d12 100644\n> --- a/gitlab-ci.yml\n> +++ b/gitlab-ci.yml\n> @@ -328,11 +328,13 @@ build-package:debug:\n>      BUILD_TYPE: debug\n>      MESON_OPTIONS: >-\n>        -D auto_features=disabled\n> +      -D lc-compliance=enabled\n>        -D test=false\n>        -D v4l2=false\n>        -D b_sanitize=address,undefined\n>        -D cpp_debugstl=true\n> -      -D pipelines=[]\n> +      -D pipelines=['virtual']\n> +      -D force_fallback_for=['gtest']\n>    parallel:\n>      matrix:\n>        - ARCH: amd64\n> @@ -440,3 +442,23 @@ test-unit:\n>    # artifacts:\n>    #   reports:\n>    #     junit: build/meson-logs/testlog.junit.xml\n> +\n> +lc-compliance:virtual:\n\nNitpicking on the naming, we could name this test-lc-compliance:virtual\nor test-compliance:virtual to have the same \"test-\" prefix as\n\"test-unit\". Maybe \"test:unit\" and \"test:compliance:virtual\" could also\nbe an option ?\n\n> +  extends:\n> +    - .fdo.distribution-image@debian\n> +    - .libcamera-ci.debian:12\n> +    - .libcamera-ci.scripts\n> +  stage: test\n> +  needs:\n> +    - job: build-package:debug\n> +      parallel:\n> +        matrix:\n> +          - ARCH: amd64\n> +  tags:\n> +    - kvm\n> +  script:\n> +    - $CI_PROJECT_DIR/.gitlab-ci/unpackage-libcamera.sh\n> +    - $CI_PROJECT_DIR/.gitlab-ci/test-lc-compliance.sh\n> +  artifacts:\n> +    reports:\n> +      junit: build/lc-compliance-report.xml","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 DCE9EC32AF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 17 Dec 2024 00:17:38 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 10CF767FB1;\n\tTue, 17 Dec 2024 01:17:38 +0100 (CET)","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 EA97D61899\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Dec 2024 01:17:36 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D87BF514;\n\tTue, 17 Dec 2024 01:16:59 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"akUEG2HO\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1734394620;\n\tbh=VI35X3nvOg96ar/G84GqA2Uan7NnToRxxLxhpSljJq8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=akUEG2HO9ROqq+LAk0+qbBeMxe8D5F0mYmqhRH3Bhrrl2vTByb2gcerty12UvcFJf\n\tJo6h4kWTv6vSRGs+PPldIJo2W1UigB0cP1lpGJzzB1Psu+ply5BOLO7dEXAJcGiQUB\n\t+Ctn266vbK4poOEmRkP0oCdu1F8uQD6qXEvkUOVc=","Date":"Tue, 17 Dec 2024 02:17:20 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [libcamera-ci] [RFC PATCH v2 4/4] Add job to run lc-compliance\n\ton the virtual pipeline handler","Message-ID":"<20241217001720.GD19635@pendragon.ideasonboard.com>","References":"<20241216172827.1055088-1-barnabas.pocze@ideasonboard.com>\n\t<20241216172827.1055088-4-barnabas.pocze@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20241216172827.1055088-4-barnabas.pocze@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":32807,"web_url":"https://patchwork.libcamera.org/comment/32807/","msgid":"<c1ce65b5-cb38-424f-9aee-6cbcd304fe73@ideasonboard.com>","date":"2024-12-17T10:41:57","subject":"Re: [libcamera-ci] [RFC PATCH v2 4/4] Add job to run lc-compliance\n\ton the virtual pipeline handler","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"2024. 12. 17. 1:17 keltezéssel, Laurent Pinchart írta:\n> Hi Barnabás,\n> \n> Thank you for the patch.\n> \n> On Mon, Dec 16, 2024 at 06:28:27PM +0100, Barnabás Pőcze wrote:\n>> Add a new job named `lc-compliance:virtual` that uses the\n>> build artifacts created by the `build-package:debug` job\n>> on amd64 to run `lc-compliance` on the \"Virtual0\" camera\n>> in a virtual machine.\n>>\n>> The `force_fallback_for=gtest` option is needed because `cpp_debustl`\n> \n> s/debustl/debugstl/\n> \n>> makes ABI incompatible changes in the STL containers, so googletest\n>> also needs to be compiled with these changes.\n> \n> Downloading sources at build time in CI isn't great, I'd like to avoid\n> it when possible. If it can't be avoided, so be it. There are\n> precedents, we download and install the packages that are not multi-arch\n> compatible at build time, and we also force a fallback for gtest when\n> compiling with clang and libc++.\n\nI believe libyuv is also downloaded.\n\n> \n> On a side note, I'm wondering if we shouldn't just disable lc-compliance\n> when building with clang and libc++, and download and cache the .deb\n> packages at container build time. If anyone wants to give it a try...\n> :-)\n> \n> Back to the topic, does cpp_debugstl give use significant benefits\n> compared to ASan and UBSan ?\n\nWell, there are certainly things that it recognizes that ASAN/UBSAN\ndo not, for example:\n\n   std::vector<int> v; ...\n   auto it = /* into `v` */;\n   v.erase(/* before `it` */);\n   *it; // error\n\n\n> \n>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n>> ---\n>>\n>> Changes in v2:\n>>    * publish lc-compliance results to gitlab\n>>    * add and use script to install libcamera binary package\n>>\n>> ---\n>>   .gitlab-ci/test-lc-compliance.sh  | 37 +++++++++++++++++++++++++++++++\n>>   .gitlab-ci/unpackage-libcamera.sh | 17 ++++++++++++++\n>>   gitlab-ci.yml                     | 24 +++++++++++++++++++-\n>>   3 files changed, 77 insertions(+), 1 deletion(-)\n>>   create mode 100755 .gitlab-ci/test-lc-compliance.sh\n>>   create mode 100755 .gitlab-ci/unpackage-libcamera.sh\n>>\n>> diff --git a/.gitlab-ci/test-lc-compliance.sh b/.gitlab-ci/test-lc-compliance.sh\n>> new file mode 100755\n>> index 0000000..a927f1d\n>> --- /dev/null\n>> +++ b/.gitlab-ci/test-lc-compliance.sh\n>> @@ -0,0 +1,37 @@\n>> +#!/bin/bash\n>> +\n>> +# SPDX-License-Identifier: GPL-2.0-or-later\n>> +# SPDX-FileCopyrightText: © 2024 Google Inc.\n>> +\n>> +set -e\n>> +\n>> +source \"$(dirname \"$0\")/lib.sh\"\n>> +\n>> +libcamera_compliance() {\n>> +\techo \"Running libcamera compliance tests in a qemu VM\"\n>> +\n>> +\tvirtme-ng \\\n>> +\t\t--verbose \\\n>> +\t\t--skip-modules \\\n>> +\t\t--force-9p \\\n>> +\t\t--rwdir \"$PWD/build\" \\\n>> +\t\t--run /opt/linux/bzImage \\\n>> +\t\t--exec \"\\\n> \n> s/\"/\" /\n> \n>> +\t\t\tLIBCAMERA_LOG_LEVELS=*:DEBUG \\\n>> +\t\t\tASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 \\\n>> +\t\t\tUBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 \\\n>> +\t\t\tGTEST_OUTPUT=xml:./build/lc-compliance-report.xml \\\n>> +\t\t\tlc-compliance -c Virtual0; \\\n>> +\t\t\techo \\\\\\$? > ./build/.test-status \\\n>> +\t\t\"\n>> +\n>> +\tlocal status=$(cat build/.test-status)\n>> +\techo \"Test result exit state: $status\"\n>> +\trm build/.test-status\n>> +\n>> +\tif [[ $status != 0 ]] ; then\n>> +\t\texit $status\n>> +\tfi\n>> +}\n>> +\n>> +run libcamera_compliance\n>> diff --git a/.gitlab-ci/unpackage-libcamera.sh b/.gitlab-ci/unpackage-libcamera.sh\n>> new file mode 100755\n>> index 0000000..9eb3192\n>> --- /dev/null\n>> +++ b/.gitlab-ci/unpackage-libcamera.sh\n>> @@ -0,0 +1,17 @@\n>> +#!/bin/bash\n>> +\n>> +# SPDX-License-Identifier: GPL-2.0-or-later\n>> +# SPDX-FileCopyrightText: © 2024 Google Inc.\n>> +\n>> +set -e\n>> +\n>> +source \"$(dirname \"$0\")/lib.sh\"\n>> +\n>> +libcamera_unpackage() {\n>> +\techo \"Unpackage libcamera binaries\"\n>> +\n>> +\ttar -xvf libcamera-${CI_COMMIT_SHA}.tar.xz -C /\n>> +\tldconfig -v\n>> +}\n>> +\n>> +run libcamera_unpackage\n>> diff --git a/gitlab-ci.yml b/gitlab-ci.yml\n>> index 0a3eab3..8ea1d12 100644\n>> --- a/gitlab-ci.yml\n>> +++ b/gitlab-ci.yml\n>> @@ -328,11 +328,13 @@ build-package:debug:\n>>       BUILD_TYPE: debug\n>>       MESON_OPTIONS: >-\n>>         -D auto_features=disabled\n>> +      -D lc-compliance=enabled\n>>         -D test=false\n>>         -D v4l2=false\n>>         -D b_sanitize=address,undefined\n>>         -D cpp_debugstl=true\n>> -      -D pipelines=[]\n>> +      -D pipelines=['virtual']\n>> +      -D force_fallback_for=['gtest']\n>>     parallel:\n>>       matrix:\n>>         - ARCH: amd64\n>> @@ -440,3 +442,23 @@ test-unit:\n>>     # artifacts:\n>>     #   reports:\n>>     #     junit: build/meson-logs/testlog.junit.xml\n>> +\n>> +lc-compliance:virtual:\n> \n> Nitpicking on the naming, we could name this test-lc-compliance:virtual\n> or test-compliance:virtual to have the same \"test-\" prefix as\n> \"test-unit\". Maybe \"test:unit\" and \"test:compliance:virtual\" could also\n> be an option ?\n> \n>> +  extends:\n>> +    - .fdo.distribution-image@debian\n>> +    - .libcamera-ci.debian:12\n>> +    - .libcamera-ci.scripts\n>> +  stage: test\n>> +  needs:\n>> +    - job: build-package:debug\n>> +      parallel:\n>> +        matrix:\n>> +          - ARCH: amd64\n>> +  tags:\n>> +    - kvm\n>> +  script:\n>> +    - $CI_PROJECT_DIR/.gitlab-ci/unpackage-libcamera.sh\n>> +    - $CI_PROJECT_DIR/.gitlab-ci/test-lc-compliance.sh\n>> +  artifacts:\n>> +    reports:\n>> +      junit: build/lc-compliance-report.xml\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 BAD99BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 17 Dec 2024 10:42:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4FCB367FC4;\n\tTue, 17 Dec 2024 11:42:01 +0100 (CET)","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 2987E61899\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Dec 2024 11:42:00 +0100 (CET)","from [192.168.33.28] (185.221.140.157.nat.pool.zt.hu\n\t[185.221.140.157])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id F320E3E;\n\tTue, 17 Dec 2024 11:41:22 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"nh4bA9dP\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1734432083;\n\tbh=Y36LEiMfDVYQCBwpnkYQjWqR1/R/qZd1Fy+qIAwptAk=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=nh4bA9dPorsddJNV3khAVtuXTNO3Ft+fBDzDz5m71lm20h/uV6n/In0NbhsmuMgxk\n\tA8IeYth6+tS/OmK+aJPHH1bHpYFlbp1loPpECWdVgkbjWXZf9Zep5imDAGzZTX2084\n\t78GJCYBhlbuNl8uAWeKaAaQvpQBtR6YaqbgbjI1Q=","Message-ID":"<c1ce65b5-cb38-424f-9aee-6cbcd304fe73@ideasonboard.com>","Date":"Tue, 17 Dec 2024 11:41:57 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [libcamera-ci] [RFC PATCH v2 4/4] Add job to run lc-compliance\n\ton the virtual pipeline handler","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","References":"<20241216172827.1055088-1-barnabas.pocze@ideasonboard.com>\n\t<20241216172827.1055088-4-barnabas.pocze@ideasonboard.com>\n\t<20241217001720.GD19635@pendragon.ideasonboard.com>","Content-Language":"en-US, hu-HU","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","In-Reply-To":"<20241217001720.GD19635@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","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":32811,"web_url":"https://patchwork.libcamera.org/comment/32811/","msgid":"<20241217120013.GC2025@pendragon.ideasonboard.com>","date":"2024-12-17T12:00:13","subject":"Re: [libcamera-ci] [RFC PATCH v2 4/4] Add job to run lc-compliance\n\ton the virtual pipeline handler","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Tue, Dec 17, 2024 at 11:41:57AM +0100, Barnabás Pőcze wrote:\n> 2024. 12. 17. 1:17 keltezéssel, Laurent Pinchart írta:\n> > Hi Barnabás,\n> > \n> > Thank you for the patch.\n> > \n> > On Mon, Dec 16, 2024 at 06:28:27PM +0100, Barnabás Pőcze wrote:\n> >> Add a new job named `lc-compliance:virtual` that uses the\n> >> build artifacts created by the `build-package:debug` job\n> >> on amd64 to run `lc-compliance` on the \"Virtual0\" camera\n> >> in a virtual machine.\n> >>\n> >> The `force_fallback_for=gtest` option is needed because `cpp_debustl`\n> > \n> > s/debustl/debugstl/\n> > \n> >> makes ABI incompatible changes in the STL containers, so googletest\n> >> also needs to be compiled with these changes.\n> > \n> > Downloading sources at build time in CI isn't great, I'd like to avoid\n> > it when possible. If it can't be avoided, so be it. There are\n> > precedents, we download and install the packages that are not multi-arch\n> > compatible at build time, and we also force a fallback for gtest when\n> > compiling with clang and libc++.\n> \n> I believe libyuv is also downloaded.\n\nAarrrghhhhh. Why can't google get their projects packaged by\ndistributions ? :-(\n\n> > On a side note, I'm wondering if we shouldn't just disable lc-compliance\n> > when building with clang and libc++, and download and cache the .deb\n> > packages at container build time. If anyone wants to give it a try...\n> > :-)\n> > \n> > Back to the topic, does cpp_debugstl give use significant benefits\n> > compared to ASan and UBSan ?\n> \n> Well, there are certainly things that it recognizes that ASAN/UBSAN\n> do not, for example:\n> \n>    std::vector<int> v; ...\n>    auto it = /* into `v` */;\n>    v.erase(/* before `it` */);\n>    *it; // error\n\nThat's good to catch indeed. Is the error caught at runtime or compile\ntime ?\n\n> >> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> >> ---\n> >>\n> >> Changes in v2:\n> >>    * publish lc-compliance results to gitlab\n> >>    * add and use script to install libcamera binary package\n> >>\n> >> ---\n> >>   .gitlab-ci/test-lc-compliance.sh  | 37 +++++++++++++++++++++++++++++++\n> >>   .gitlab-ci/unpackage-libcamera.sh | 17 ++++++++++++++\n> >>   gitlab-ci.yml                     | 24 +++++++++++++++++++-\n> >>   3 files changed, 77 insertions(+), 1 deletion(-)\n> >>   create mode 100755 .gitlab-ci/test-lc-compliance.sh\n> >>   create mode 100755 .gitlab-ci/unpackage-libcamera.sh\n> >>\n> >> diff --git a/.gitlab-ci/test-lc-compliance.sh b/.gitlab-ci/test-lc-compliance.sh\n> >> new file mode 100755\n> >> index 0000000..a927f1d\n> >> --- /dev/null\n> >> +++ b/.gitlab-ci/test-lc-compliance.sh\n> >> @@ -0,0 +1,37 @@\n> >> +#!/bin/bash\n> >> +\n> >> +# SPDX-License-Identifier: GPL-2.0-or-later\n> >> +# SPDX-FileCopyrightText: © 2024 Google Inc.\n> >> +\n> >> +set -e\n> >> +\n> >> +source \"$(dirname \"$0\")/lib.sh\"\n> >> +\n> >> +libcamera_compliance() {\n> >> +\techo \"Running libcamera compliance tests in a qemu VM\"\n> >> +\n> >> +\tvirtme-ng \\\n> >> +\t\t--verbose \\\n> >> +\t\t--skip-modules \\\n> >> +\t\t--force-9p \\\n> >> +\t\t--rwdir \"$PWD/build\" \\\n> >> +\t\t--run /opt/linux/bzImage \\\n> >> +\t\t--exec \"\\\n> > \n> > s/\"/\" /\n> > \n> >> +\t\t\tLIBCAMERA_LOG_LEVELS=*:DEBUG \\\n> >> +\t\t\tASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 \\\n> >> +\t\t\tUBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 \\\n> >> +\t\t\tGTEST_OUTPUT=xml:./build/lc-compliance-report.xml \\\n> >> +\t\t\tlc-compliance -c Virtual0; \\\n> >> +\t\t\techo \\\\\\$? > ./build/.test-status \\\n> >> +\t\t\"\n> >> +\n> >> +\tlocal status=$(cat build/.test-status)\n> >> +\techo \"Test result exit state: $status\"\n> >> +\trm build/.test-status\n> >> +\n> >> +\tif [[ $status != 0 ]] ; then\n> >> +\t\texit $status\n> >> +\tfi\n> >> +}\n> >> +\n> >> +run libcamera_compliance\n> >> diff --git a/.gitlab-ci/unpackage-libcamera.sh b/.gitlab-ci/unpackage-libcamera.sh\n> >> new file mode 100755\n> >> index 0000000..9eb3192\n> >> --- /dev/null\n> >> +++ b/.gitlab-ci/unpackage-libcamera.sh\n> >> @@ -0,0 +1,17 @@\n> >> +#!/bin/bash\n> >> +\n> >> +# SPDX-License-Identifier: GPL-2.0-or-later\n> >> +# SPDX-FileCopyrightText: © 2024 Google Inc.\n> >> +\n> >> +set -e\n> >> +\n> >> +source \"$(dirname \"$0\")/lib.sh\"\n> >> +\n> >> +libcamera_unpackage() {\n> >> +\techo \"Unpackage libcamera binaries\"\n> >> +\n> >> +\ttar -xvf libcamera-${CI_COMMIT_SHA}.tar.xz -C /\n> >> +\tldconfig -v\n> >> +}\n> >> +\n> >> +run libcamera_unpackage\n> >> diff --git a/gitlab-ci.yml b/gitlab-ci.yml\n> >> index 0a3eab3..8ea1d12 100644\n> >> --- a/gitlab-ci.yml\n> >> +++ b/gitlab-ci.yml\n> >> @@ -328,11 +328,13 @@ build-package:debug:\n> >>       BUILD_TYPE: debug\n> >>       MESON_OPTIONS: >-\n> >>         -D auto_features=disabled\n> >> +      -D lc-compliance=enabled\n> >>         -D test=false\n> >>         -D v4l2=false\n> >>         -D b_sanitize=address,undefined\n> >>         -D cpp_debugstl=true\n> >> -      -D pipelines=[]\n> >> +      -D pipelines=['virtual']\n> >> +      -D force_fallback_for=['gtest']\n> >>     parallel:\n> >>       matrix:\n> >>         - ARCH: amd64\n> >> @@ -440,3 +442,23 @@ test-unit:\n> >>     # artifacts:\n> >>     #   reports:\n> >>     #     junit: build/meson-logs/testlog.junit.xml\n> >> +\n> >> +lc-compliance:virtual:\n> > \n> > Nitpicking on the naming, we could name this test-lc-compliance:virtual\n> > or test-compliance:virtual to have the same \"test-\" prefix as\n> > \"test-unit\". Maybe \"test:unit\" and \"test:compliance:virtual\" could also\n> > be an option ?\n> > \n> >> +  extends:\n> >> +    - .fdo.distribution-image@debian\n> >> +    - .libcamera-ci.debian:12\n> >> +    - .libcamera-ci.scripts\n> >> +  stage: test\n> >> +  needs:\n> >> +    - job: build-package:debug\n> >> +      parallel:\n> >> +        matrix:\n> >> +          - ARCH: amd64\n> >> +  tags:\n> >> +    - kvm\n> >> +  script:\n> >> +    - $CI_PROJECT_DIR/.gitlab-ci/unpackage-libcamera.sh\n> >> +    - $CI_PROJECT_DIR/.gitlab-ci/test-lc-compliance.sh\n> >> +  artifacts:\n> >> +    reports:\n> >> +      junit: build/lc-compliance-report.xml","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 8CC89BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 17 Dec 2024 12:00:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2A7F567FC7;\n\tTue, 17 Dec 2024 13:00:18 +0100 (CET)","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 C1F0467F0D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Dec 2024 13:00:15 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5E9704C7;\n\tTue, 17 Dec 2024 12:59:38 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"k6gpInP7\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1734436778;\n\tbh=Ble8A+63X9dNIs/uReLiMI5gqnqCnfjS2Pql/UYKOYc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=k6gpInP79OF4/GS4JLjV2wL9HmGgvKVPfFXXMCURr0x8ztiDSFdDwDKQEkHpFG6ey\n\tQELPdIk3GT9Rk4m1eKkIqcAj82wxN0QyrJ4akuHG9akhINjDEgUXQhXj81DHJNEMoU\n\tMK4owBBJReRYVeG1c+5uu56y1xOUCUvmTA880rSQ=","Date":"Tue, 17 Dec 2024 14:00:13 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [libcamera-ci] [RFC PATCH v2 4/4] Add job to run lc-compliance\n\ton the virtual pipeline handler","Message-ID":"<20241217120013.GC2025@pendragon.ideasonboard.com>","References":"<20241216172827.1055088-1-barnabas.pocze@ideasonboard.com>\n\t<20241216172827.1055088-4-barnabas.pocze@ideasonboard.com>\n\t<20241217001720.GD19635@pendragon.ideasonboard.com>\n\t<c1ce65b5-cb38-424f-9aee-6cbcd304fe73@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<c1ce65b5-cb38-424f-9aee-6cbcd304fe73@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":32813,"web_url":"https://patchwork.libcamera.org/comment/32813/","msgid":"<e471e815-2497-41ac-bf9f-33f75f0cb081@ideasonboard.com>","date":"2024-12-17T12:34:17","subject":"Re: [libcamera-ci] [RFC PATCH v2 4/4] Add job to run lc-compliance\n\ton the virtual pipeline handler","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"2024. 12. 17. 13:00 keltezéssel, Laurent Pinchart írta:\n> On Tue, Dec 17, 2024 at 11:41:57AM +0100, Barnabás Pőcze wrote:\n>> 2024. 12. 17. 1:17 keltezéssel, Laurent Pinchart írta:\n>>> Hi Barnabás,\n>>>\n>>> Thank you for the patch.\n>>>\n>>> On Mon, Dec 16, 2024 at 06:28:27PM +0100, Barnabás Pőcze wrote:\n>>>> Add a new job named `lc-compliance:virtual` that uses the\n>>>> build artifacts created by the `build-package:debug` job\n>>>> on amd64 to run `lc-compliance` on the \"Virtual0\" camera\n>>>> in a virtual machine.\n>>>>\n>>>> The `force_fallback_for=gtest` option is needed because `cpp_debustl`\n>>>\n>>> s/debustl/debugstl/\n>>>\n>>>> makes ABI incompatible changes in the STL containers, so googletest\n>>>> also needs to be compiled with these changes.\n>>>\n>>> Downloading sources at build time in CI isn't great, I'd like to avoid\n>>> it when possible. If it can't be avoided, so be it. There are\n>>> precedents, we download and install the packages that are not multi-arch\n>>> compatible at build time, and we also force a fallback for gtest when\n>>> compiling with clang and libc++.\n>>\n>> I believe libyuv is also downloaded.\n> \n> Aarrrghhhhh. Why can't google get their projects packaged by\n> distributions ? :-(\n\nIt seems to be packaged. The main issue is that no pkg-config or\ncmake files are supplied, so meson cannot really discover it.\nI suppose one could do something like this:\n\ndiff --git a/src/meson.build b/src/meson.build\nindex 76198e953..a62dc2c30 100644\n--- a/src/meson.build\n+++ b/src/meson.build\n@@ -32,6 +32,14 @@ endif\n  # by distributions.\n  libyuv_dep = dependency('libyuv', required : false)\n\n+if not libyuv_dep.found()\n+    libyuv_dep = cxx.find_library(\n+        'yuv',\n+        required : false,\n+        has_headers : 'libyuv.h',\n+    )\n+endif\n+\n  if (pipelines.contains('virtual') or get_option('android').allowed()) \nand \\\n     not libyuv_dep.found()\n      cmake = import('cmake')\n\n\n\n> \n>>> On a side note, I'm wondering if we shouldn't just disable lc-compliance\n>>> when building with clang and libc++, and download and cache the .deb\n>>> packages at container build time. If anyone wants to give it a try...\n>>> :-)\n>>>\n>>> Back to the topic, does cpp_debugstl give use significant benefits\n>>> compared to ASan and UBSan ?\n>>\n>> Well, there are certainly things that it recognizes that ASAN/UBSAN\n>> do not, for example:\n>>\n>>     std::vector<int> v; ...\n>>     auto it = /* into `v` */;\n>>     v.erase(/* before `it` */);\n>>     *it; // error\n> \n> That's good to catch indeed. Is the error caught at runtime or compile\n> time ?\n\nRuntime.\n\n\n> \n>>>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n>>>> ---\n>>>>\n>>>> Changes in v2:\n>>>>     * publish lc-compliance results to gitlab\n>>>>     * add and use script to install libcamera binary package\n>>>>\n>>>> ---\n>>>>    .gitlab-ci/test-lc-compliance.sh  | 37 +++++++++++++++++++++++++++++++\n>>>>    .gitlab-ci/unpackage-libcamera.sh | 17 ++++++++++++++\n>>>>    gitlab-ci.yml                     | 24 +++++++++++++++++++-\n>>>>    3 files changed, 77 insertions(+), 1 deletion(-)\n>>>>    create mode 100755 .gitlab-ci/test-lc-compliance.sh\n>>>>    create mode 100755 .gitlab-ci/unpackage-libcamera.sh\n>>>>\n>>>> diff --git a/.gitlab-ci/test-lc-compliance.sh b/.gitlab-ci/test-lc-compliance.sh\n>>>> new file mode 100755\n>>>> index 0000000..a927f1d\n>>>> --- /dev/null\n>>>> +++ b/.gitlab-ci/test-lc-compliance.sh\n>>>> @@ -0,0 +1,37 @@\n>>>> +#!/bin/bash\n>>>> +\n>>>> +# SPDX-License-Identifier: GPL-2.0-or-later\n>>>> +# SPDX-FileCopyrightText: © 2024 Google Inc.\n>>>> +\n>>>> +set -e\n>>>> +\n>>>> +source \"$(dirname \"$0\")/lib.sh\"\n>>>> +\n>>>> +libcamera_compliance() {\n>>>> +\techo \"Running libcamera compliance tests in a qemu VM\"\n>>>> +\n>>>> +\tvirtme-ng \\\n>>>> +\t\t--verbose \\\n>>>> +\t\t--skip-modules \\\n>>>> +\t\t--force-9p \\\n>>>> +\t\t--rwdir \"$PWD/build\" \\\n>>>> +\t\t--run /opt/linux/bzImage \\\n>>>> +\t\t--exec \"\\\n>>>\n>>> s/\"/\" /\n>>>\n>>>> +\t\t\tLIBCAMERA_LOG_LEVELS=*:DEBUG \\\n>>>> +\t\t\tASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 \\\n>>>> +\t\t\tUBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 \\\n>>>> +\t\t\tGTEST_OUTPUT=xml:./build/lc-compliance-report.xml \\\n>>>> +\t\t\tlc-compliance -c Virtual0; \\\n>>>> +\t\t\techo \\\\\\$? > ./build/.test-status \\\n>>>> +\t\t\"\n>>>> +\n>>>> +\tlocal status=$(cat build/.test-status)\n>>>> +\techo \"Test result exit state: $status\"\n>>>> +\trm build/.test-status\n>>>> +\n>>>> +\tif [[ $status != 0 ]] ; then\n>>>> +\t\texit $status\n>>>> +\tfi\n>>>> +}\n>>>> +\n>>>> +run libcamera_compliance\n>>>> diff --git a/.gitlab-ci/unpackage-libcamera.sh b/.gitlab-ci/unpackage-libcamera.sh\n>>>> new file mode 100755\n>>>> index 0000000..9eb3192\n>>>> --- /dev/null\n>>>> +++ b/.gitlab-ci/unpackage-libcamera.sh\n>>>> @@ -0,0 +1,17 @@\n>>>> +#!/bin/bash\n>>>> +\n>>>> +# SPDX-License-Identifier: GPL-2.0-or-later\n>>>> +# SPDX-FileCopyrightText: © 2024 Google Inc.\n>>>> +\n>>>> +set -e\n>>>> +\n>>>> +source \"$(dirname \"$0\")/lib.sh\"\n>>>> +\n>>>> +libcamera_unpackage() {\n>>>> +\techo \"Unpackage libcamera binaries\"\n>>>> +\n>>>> +\ttar -xvf libcamera-${CI_COMMIT_SHA}.tar.xz -C /\n>>>> +\tldconfig -v\n>>>> +}\n>>>> +\n>>>> +run libcamera_unpackage\n>>>> diff --git a/gitlab-ci.yml b/gitlab-ci.yml\n>>>> index 0a3eab3..8ea1d12 100644\n>>>> --- a/gitlab-ci.yml\n>>>> +++ b/gitlab-ci.yml\n>>>> @@ -328,11 +328,13 @@ build-package:debug:\n>>>>        BUILD_TYPE: debug\n>>>>        MESON_OPTIONS: >-\n>>>>          -D auto_features=disabled\n>>>> +      -D lc-compliance=enabled\n>>>>          -D test=false\n>>>>          -D v4l2=false\n>>>>          -D b_sanitize=address,undefined\n>>>>          -D cpp_debugstl=true\n>>>> -      -D pipelines=[]\n>>>> +      -D pipelines=['virtual']\n>>>> +      -D force_fallback_for=['gtest']\n>>>>      parallel:\n>>>>        matrix:\n>>>>          - ARCH: amd64\n>>>> @@ -440,3 +442,23 @@ test-unit:\n>>>>      # artifacts:\n>>>>      #   reports:\n>>>>      #     junit: build/meson-logs/testlog.junit.xml\n>>>> +\n>>>> +lc-compliance:virtual:\n>>>\n>>> Nitpicking on the naming, we could name this test-lc-compliance:virtual\n>>> or test-compliance:virtual to have the same \"test-\" prefix as\n>>> \"test-unit\". Maybe \"test:unit\" and \"test:compliance:virtual\" could also\n>>> be an option ?\n>>>\n>>>> +  extends:\n>>>> +    - .fdo.distribution-image@debian\n>>>> +    - .libcamera-ci.debian:12\n>>>> +    - .libcamera-ci.scripts\n>>>> +  stage: test\n>>>> +  needs:\n>>>> +    - job: build-package:debug\n>>>> +      parallel:\n>>>> +        matrix:\n>>>> +          - ARCH: amd64\n>>>> +  tags:\n>>>> +    - kvm\n>>>> +  script:\n>>>> +    - $CI_PROJECT_DIR/.gitlab-ci/unpackage-libcamera.sh\n>>>> +    - $CI_PROJECT_DIR/.gitlab-ci/test-lc-compliance.sh\n>>>> +  artifacts:\n>>>> +    reports:\n>>>> +      junit: build/lc-compliance-report.xml\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 1BA14C32F6\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 17 Dec 2024 12:34:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 15F0867FCB;\n\tTue, 17 Dec 2024 13:34:23 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3103867F0D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Dec 2024 13:34:21 +0100 (CET)","from [192.168.33.28] (185.221.140.157.nat.pool.zt.hu\n\t[185.221.140.157])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E405E4C7;\n\tTue, 17 Dec 2024 13:33:43 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"gpOQecCa\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1734438824;\n\tbh=zw37WfTIhMlX9qWqOcntqZNZqKBHwlwjrbaXxMRmQYg=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=gpOQecCaEPAC1BDx/nHoq+UGGzJ6HrfO6+6sVj4UkY4Ms4MV+wzMvJqWM1acHIE+u\n\tUzyQXdGvZ5XmQKYkRFm0s2kdZ8AoUhFJcW2vrKTwf2s2+1VspVNXTxGEA48YB/epvy\n\thccz3ozLkC6QrCYaGPmzGIWnNRWsR7AZfGVhLIe8=","Message-ID":"<e471e815-2497-41ac-bf9f-33f75f0cb081@ideasonboard.com>","Date":"Tue, 17 Dec 2024 13:34:17 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [libcamera-ci] [RFC PATCH v2 4/4] Add job to run lc-compliance\n\ton the virtual pipeline handler","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","References":"<20241216172827.1055088-1-barnabas.pocze@ideasonboard.com>\n\t<20241216172827.1055088-4-barnabas.pocze@ideasonboard.com>\n\t<20241217001720.GD19635@pendragon.ideasonboard.com>\n\t<c1ce65b5-cb38-424f-9aee-6cbcd304fe73@ideasonboard.com>\n\t<20241217120013.GC2025@pendragon.ideasonboard.com>","Content-Language":"en-US, hu-HU","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","In-Reply-To":"<20241217120013.GC2025@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","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":32817,"web_url":"https://patchwork.libcamera.org/comment/32817/","msgid":"<20241217142323.GF2025@pendragon.ideasonboard.com>","date":"2024-12-17T14:23:23","subject":"Re: [libcamera-ci] [RFC PATCH v2 4/4] Add job to run lc-compliance\n\ton the virtual pipeline handler","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Tue, Dec 17, 2024 at 01:34:17PM +0100, Barnabás Pőcze wrote:\n> 2024. 12. 17. 13:00 keltezéssel, Laurent Pinchart írta:\n> > On Tue, Dec 17, 2024 at 11:41:57AM +0100, Barnabás Pőcze wrote:\n> >> 2024. 12. 17. 1:17 keltezéssel, Laurent Pinchart írta:\n> >>> On Mon, Dec 16, 2024 at 06:28:27PM +0100, Barnabás Pőcze wrote:\n> >>>> Add a new job named `lc-compliance:virtual` that uses the\n> >>>> build artifacts created by the `build-package:debug` job\n> >>>> on amd64 to run `lc-compliance` on the \"Virtual0\" camera\n> >>>> in a virtual machine.\n> >>>>\n> >>>> The `force_fallback_for=gtest` option is needed because `cpp_debustl`\n> >>>\n> >>> s/debustl/debugstl/\n> >>>\n> >>>> makes ABI incompatible changes in the STL containers, so googletest\n> >>>> also needs to be compiled with these changes.\n> >>>\n> >>> Downloading sources at build time in CI isn't great, I'd like to avoid\n> >>> it when possible. If it can't be avoided, so be it. There are\n> >>> precedents, we download and install the packages that are not multi-arch\n> >>> compatible at build time, and we also force a fallback for gtest when\n> >>> compiling with clang and libc++.\n> >>\n> >> I believe libyuv is also downloaded.\n> > \n> > Aarrrghhhhh. Why can't google get their projects packaged by\n> > distributions ? :-(\n> \n> It seems to be packaged. The main issue is that no pkg-config or\n> cmake files are supplied, so meson cannot really discover it.\n\nAh, I didn't know it was packaged in Debian. Thanks for the information.\n\n> I suppose one could do something like this:\n> \n> diff --git a/src/meson.build b/src/meson.build\n> index 76198e953..a62dc2c30 100644\n> --- a/src/meson.build\n> +++ b/src/meson.build\n> @@ -32,6 +32,14 @@ endif\n>   # by distributions.\n>   libyuv_dep = dependency('libyuv', required : false)\n> \n> +if not libyuv_dep.found()\n> +    libyuv_dep = cxx.find_library(\n> +        'yuv',\n> +        required : false,\n> +        has_headers : 'libyuv.h',\n> +    )\n> +endif\n> +\n\nOr we could create a pkgconfig file manually, as we do for pybind11 in\nsetup-container.sh. Handling it in meson.build makes it usable\neverywhere, so maybe that's a better approach.\n\nAnyway, that's unrelated to this patch series. We can force the fallback\nfor now. I'd like to see if we could download and cache the subproject\nin the container instead of doing it during every build, but that's not\nurgent.\n\nhttps://mesonbuild.com/Wrap-dependency-system-manual.html#specific-to-wrapfile\nstates\n\n  Since 0.49.0 if source_filename or patch_filename is found in the\n  project's subprojects/packagecache directory, it will be used instead\n  of downloading the file, even if --wrap-mode option is set to\n  nodownload.  The file's hash will be checked.\n\n  Since 1.3.0 if the MESON_PACKAGE_CACHE_DIR environment variable is\n  set, it is used instead of the project's subprojects/packagecache.\n  This allows sharing the cache across multiple projects. In addition it\n  can contain an already extracted source tree as long as it has the\n  same directory name as the directory field in the wrap file. In that\n  case, the directory will be copied into subprojects/ before applying\n  patches.\n\nwhich seems useful. We install meson from pip when needed, so we can use\nfeatures from version 1.3.0.\n\n>   if (pipelines.contains('virtual') or get_option('android').allowed()) \n> and \\\n>      not libyuv_dep.found()\n>       cmake = import('cmake')\n> \n> >>> On a side note, I'm wondering if we shouldn't just disable lc-compliance\n> >>> when building with clang and libc++, and download and cache the .deb\n> >>> packages at container build time. If anyone wants to give it a try...\n> >>> :-)\n> >>>\n> >>> Back to the topic, does cpp_debugstl give use significant benefits\n> >>> compared to ASan and UBSan ?\n> >>\n> >> Well, there are certainly things that it recognizes that ASAN/UBSAN\n> >> do not, for example:\n> >>\n> >>     std::vector<int> v; ...\n> >>     auto it = /* into `v` */;\n> >>     v.erase(/* before `it` */);\n> >>     *it; // error\n> > \n> > That's good to catch indeed. Is the error caught at runtime or compile\n> > time ?\n> \n> Runtime.\n> \n> >>>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> >>>> ---\n> >>>>\n> >>>> Changes in v2:\n> >>>>     * publish lc-compliance results to gitlab\n> >>>>     * add and use script to install libcamera binary package\n> >>>>\n> >>>> ---\n> >>>>    .gitlab-ci/test-lc-compliance.sh  | 37 +++++++++++++++++++++++++++++++\n> >>>>    .gitlab-ci/unpackage-libcamera.sh | 17 ++++++++++++++\n> >>>>    gitlab-ci.yml                     | 24 +++++++++++++++++++-\n> >>>>    3 files changed, 77 insertions(+), 1 deletion(-)\n> >>>>    create mode 100755 .gitlab-ci/test-lc-compliance.sh\n> >>>>    create mode 100755 .gitlab-ci/unpackage-libcamera.sh\n> >>>>\n> >>>> diff --git a/.gitlab-ci/test-lc-compliance.sh b/.gitlab-ci/test-lc-compliance.sh\n> >>>> new file mode 100755\n> >>>> index 0000000..a927f1d\n> >>>> --- /dev/null\n> >>>> +++ b/.gitlab-ci/test-lc-compliance.sh\n> >>>> @@ -0,0 +1,37 @@\n> >>>> +#!/bin/bash\n> >>>> +\n> >>>> +# SPDX-License-Identifier: GPL-2.0-or-later\n> >>>> +# SPDX-FileCopyrightText: © 2024 Google Inc.\n> >>>> +\n> >>>> +set -e\n> >>>> +\n> >>>> +source \"$(dirname \"$0\")/lib.sh\"\n> >>>> +\n> >>>> +libcamera_compliance() {\n> >>>> +\techo \"Running libcamera compliance tests in a qemu VM\"\n> >>>> +\n> >>>> +\tvirtme-ng \\\n> >>>> +\t\t--verbose \\\n> >>>> +\t\t--skip-modules \\\n> >>>> +\t\t--force-9p \\\n> >>>> +\t\t--rwdir \"$PWD/build\" \\\n> >>>> +\t\t--run /opt/linux/bzImage \\\n> >>>> +\t\t--exec \"\\\n> >>>\n> >>> s/\"/\" /\n> >>>\n> >>>> +\t\t\tLIBCAMERA_LOG_LEVELS=*:DEBUG \\\n> >>>> +\t\t\tASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 \\\n> >>>> +\t\t\tUBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 \\\n> >>>> +\t\t\tGTEST_OUTPUT=xml:./build/lc-compliance-report.xml \\\n> >>>> +\t\t\tlc-compliance -c Virtual0; \\\n> >>>> +\t\t\techo \\\\\\$? > ./build/.test-status \\\n> >>>> +\t\t\"\n> >>>> +\n> >>>> +\tlocal status=$(cat build/.test-status)\n> >>>> +\techo \"Test result exit state: $status\"\n> >>>> +\trm build/.test-status\n> >>>> +\n> >>>> +\tif [[ $status != 0 ]] ; then\n> >>>> +\t\texit $status\n> >>>> +\tfi\n> >>>> +}\n> >>>> +\n> >>>> +run libcamera_compliance\n> >>>> diff --git a/.gitlab-ci/unpackage-libcamera.sh b/.gitlab-ci/unpackage-libcamera.sh\n> >>>> new file mode 100755\n> >>>> index 0000000..9eb3192\n> >>>> --- /dev/null\n> >>>> +++ b/.gitlab-ci/unpackage-libcamera.sh\n> >>>> @@ -0,0 +1,17 @@\n> >>>> +#!/bin/bash\n> >>>> +\n> >>>> +# SPDX-License-Identifier: GPL-2.0-or-later\n> >>>> +# SPDX-FileCopyrightText: © 2024 Google Inc.\n> >>>> +\n> >>>> +set -e\n> >>>> +\n> >>>> +source \"$(dirname \"$0\")/lib.sh\"\n> >>>> +\n> >>>> +libcamera_unpackage() {\n> >>>> +\techo \"Unpackage libcamera binaries\"\n> >>>> +\n> >>>> +\ttar -xvf libcamera-${CI_COMMIT_SHA}.tar.xz -C /\n> >>>> +\tldconfig -v\n> >>>> +}\n> >>>> +\n> >>>> +run libcamera_unpackage\n> >>>> diff --git a/gitlab-ci.yml b/gitlab-ci.yml\n> >>>> index 0a3eab3..8ea1d12 100644\n> >>>> --- a/gitlab-ci.yml\n> >>>> +++ b/gitlab-ci.yml\n> >>>> @@ -328,11 +328,13 @@ build-package:debug:\n> >>>>        BUILD_TYPE: debug\n> >>>>        MESON_OPTIONS: >-\n> >>>>          -D auto_features=disabled\n> >>>> +      -D lc-compliance=enabled\n> >>>>          -D test=false\n> >>>>          -D v4l2=false\n> >>>>          -D b_sanitize=address,undefined\n> >>>>          -D cpp_debugstl=true\n> >>>> -      -D pipelines=[]\n> >>>> +      -D pipelines=['virtual']\n> >>>> +      -D force_fallback_for=['gtest']\n> >>>>      parallel:\n> >>>>        matrix:\n> >>>>          - ARCH: amd64\n> >>>> @@ -440,3 +442,23 @@ test-unit:\n> >>>>      # artifacts:\n> >>>>      #   reports:\n> >>>>      #     junit: build/meson-logs/testlog.junit.xml\n> >>>> +\n> >>>> +lc-compliance:virtual:\n> >>>\n> >>> Nitpicking on the naming, we could name this test-lc-compliance:virtual\n> >>> or test-compliance:virtual to have the same \"test-\" prefix as\n> >>> \"test-unit\". Maybe \"test:unit\" and \"test:compliance:virtual\" could also\n> >>> be an option ?\n> >>>\n> >>>> +  extends:\n> >>>> +    - .fdo.distribution-image@debian\n> >>>> +    - .libcamera-ci.debian:12\n> >>>> +    - .libcamera-ci.scripts\n> >>>> +  stage: test\n> >>>> +  needs:\n> >>>> +    - job: build-package:debug\n> >>>> +      parallel:\n> >>>> +        matrix:\n> >>>> +          - ARCH: amd64\n> >>>> +  tags:\n> >>>> +    - kvm\n> >>>> +  script:\n> >>>> +    - $CI_PROJECT_DIR/.gitlab-ci/unpackage-libcamera.sh\n> >>>> +    - $CI_PROJECT_DIR/.gitlab-ci/test-lc-compliance.sh\n> >>>> +  artifacts:\n> >>>> +    reports:\n> >>>> +      junit: build/lc-compliance-report.xml","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 0141CBD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 17 Dec 2024 14:23:28 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 182BB67FD3;\n\tTue, 17 Dec 2024 15:23:28 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DDC9367F0D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Dec 2024 15:23:25 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4F2E13E;\n\tTue, 17 Dec 2024 15:22:48 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"td7gTye8\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1734445368;\n\tbh=JKOmW5AmammfRFwvP24tJqcjiDGjVflJZfFtImmybbM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=td7gTye8JCal3sBCHsudSmZxxqwZrjHf3pqd0gHayuuHnIkLRrguocDTrJses55x2\n\t+9fGJPMc7WOHeqzV81dNXslwOX8mb5CFJw5leaGwXYqTinGPozKO2gvHi8EiIFk0Cs\n\t6TEgM4e1ZTZY+NhqkwOK7fHv7vhixaHVorazn+9o=","Date":"Tue, 17 Dec 2024 16:23:23 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [libcamera-ci] [RFC PATCH v2 4/4] Add job to run lc-compliance\n\ton the virtual pipeline handler","Message-ID":"<20241217142323.GF2025@pendragon.ideasonboard.com>","References":"<20241216172827.1055088-1-barnabas.pocze@ideasonboard.com>\n\t<20241216172827.1055088-4-barnabas.pocze@ideasonboard.com>\n\t<20241217001720.GD19635@pendragon.ideasonboard.com>\n\t<c1ce65b5-cb38-424f-9aee-6cbcd304fe73@ideasonboard.com>\n\t<20241217120013.GC2025@pendragon.ideasonboard.com>\n\t<e471e815-2497-41ac-bf9f-33f75f0cb081@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<e471e815-2497-41ac-bf9f-33f75f0cb081@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>"}}]