[{"id":3015,"web_url":"https://patchwork.libcamera.org/comment/3015/","msgid":"<20191114081146.GG7353@bigcity.dyn.berto.se>","date":"2019-11-14T08:11:46","subject":"Re: [libcamera-devel] [PATCH v2 02/24] test: controls: Add\n\tControlInfoMap test","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your work.\n\nOn 2019-11-08 22:53:47 +0200, Laurent Pinchart wrote:\n> Add a test to exercise the ControlInfoMap API. This currently tests\n> at(), count(), find() and end().\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  test/controls/control_info.cpp | 77 ++++++++++++++++++++++++++++++++++\n>  test/controls/meson.build      |  1 +\n>  2 files changed, 78 insertions(+)\n>  create mode 100644 test/controls/control_info.cpp\n> \n> diff --git a/test/controls/control_info.cpp b/test/controls/control_info.cpp\n> new file mode 100644\n> index 000000000000..c2678ea3e593\n> --- /dev/null\n> +++ b/test/controls/control_info.cpp\n> @@ -0,0 +1,77 @@\n> +/* SPDX-License-Identifier: GPL-2.0-or-later */\n> +/*\n> + * Copyright (C) 2019, Google Inc.\n> + *\n> + * control_info.cpp - ControlInfoMap tests\n> + */\n> +\n> +#include <iostream>\n> +\n> +#include <libcamera/camera.h>\n> +#include <libcamera/camera_manager.h>\n> +#include <libcamera/control_ids.h>\n> +#include <libcamera/controls.h>\n> +\n> +#include \"camera_controls.h\"\n> +\n> +#include \"camera_test.h\"\n> +#include \"test.h\"\n> +\n> +using namespace std;\n> +using namespace libcamera;\n> +\n> +class ControlInfoMapTest : public CameraTest, public Test\n> +{\n> +public:\n> +\tControlInfoMapTest()\n> +\t\t: CameraTest(\"VIMC Sensor B\")\n> +\t{\n> +\t}\n> +\n> +protected:\n\nDo you not need:\n\n    int init() override\n    {\n        return status_;\n    }\n\nTo make sure the camera is found?\n\n> +\tint run()\n> +\t{\n> +\t\tconst ControlInfoMap &info = camera_->controls();\n> +\n> +\t\t/* Test looking up a valid control by ControlId. */\n> +\t\tif (info.count(&controls::Brightness) != 1) {\n> +\t\t\tcout << \"count() on valid control failed\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\tif (info.find(&controls::Brightness) == info.end()) {\n> +\t\t\tcout << \"find() on valid control failed\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\tinfo.at(&controls::Brightness);\n> +\n> +\t\t/* Test looking up a valid control by numerical ID. */\n> +\t\tif (info.count(controls::Brightness.id()) != 1) {\n> +\t\t\tcout << \"count() on valid ID failed\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\tif (info.find(controls::Brightness.id()) == info.end()) {\n> +\t\t\tcout << \"find() on valid ID failed\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\tinfo.at(controls::Brightness.id());\n> +\n> +\t\t/* Test looking up an invalid control by numerical ID. */\n> +\t\tif (info.count(12345) != 0) {\n> +\t\t\tcout << \"count() on invalid ID failed\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\tif (info.find(12345) != info.end()) {\n> +\t\t\tcout << \"find() on invalid ID failed\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\treturn TestPass;\n> +\t}\n> +};\n> +\n> +TEST_REGISTER(ControlInfoMapTest)\n> diff --git a/test/controls/meson.build b/test/controls/meson.build\n> index 9f0f005a2759..f0850df28c8a 100644\n> --- a/test/controls/meson.build\n> +++ b/test/controls/meson.build\n> @@ -1,4 +1,5 @@\n>  control_tests = [\n> +    [ 'control_info',   'control_info.cpp' ],\n>      [ 'control_list',   'control_list.cpp' ],\n>      [ 'control_range',  'control_range.cpp' ],\n>      [ 'control_value',  'control_value.cpp' ],\n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com\n\t[IPv6:2a00:1450:4864:20::22e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A8B5A6136F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 14 Nov 2019 09:11:47 +0100 (CET)","by mail-lj1-x22e.google.com with SMTP id e9so5603824ljp.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 14 Nov 2019 00:11:47 -0800 (PST)","from localhost (h-93-159.A463.priv.bahnhof.se. [46.59.93.159])\n\tby smtp.gmail.com with ESMTPSA id\n\tr9sm1983949ljm.7.2019.11.14.00.11.46\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 14 Nov 2019 00:11:46 -0800 (PST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=ayQgeDPlyn/Ug4MI8PbI1V9fs5OuvpMCfyMt+uT83dg=;\n\tb=PFQcfIBrYkLktdNFZkeitFhoLrIi+QPIgpHrcgFL5+yF9EFgf+Q0Jx/cydiper8Zto\n\tsKl7I3vrD7xfgS0g5RxnyMFN/T5Gjabz6CBBA1O+QlBU8fQDlFpFT/m+Gs3V1eu+bmxQ\n\tCGx0MQTv0E7mycBrg9ske96NzQRW8H8B1X1gd4dPeU+4g02WbxDyoqvCY4bABujmXHrx\n\tvsApgj+o2Rd6K0SqQEGkUzzJdM5wq9hJvfZbL8e6VpVlyB2l7j3uxOs6Mnmz3r6LXzSJ\n\tLN4g31i3txJyQqujx5YXRynfQQ7v6lrP7Zi1nJLg9+8KkCJRvlebVEtLZ73jLbVVSNxC\n\tY/kw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=ayQgeDPlyn/Ug4MI8PbI1V9fs5OuvpMCfyMt+uT83dg=;\n\tb=ElRbubcyPTBmVplsiyK1AI/SxzAJZpuGeZ8VmXj+L1JIx0s7iuAkoLQFREk/9MzQcB\n\tKPZiYGlQnTizSbne24codi2WscCbglIW5H9pjxmkpbZ/AP3RHU4Zl/UexW5/L0lL3I3P\n\tOG3cqP0UP1rSgfi6SIyxcMR0FeEChu9Qo+taXAEP2d0LwDTWOYy2OSahKtX3sQdSMHvk\n\tVX7SDDzOT/lhNpd5+YGPr89RcEcJuVhACk3Tdn6DTm326b51B/1rCfv5Se4spZJhpekj\n\ti5v5hYK2jddAo1X31hhewmeno8W6NFkFMqTcbd2Y/iFS1obadQ5n6d6SddWqR7J+/h3K\n\tn1Cw==","X-Gm-Message-State":"APjAAAUDu5rQQ/dxcMTpLFP2plDeWqERCkcDZwTQhaSQpWjLpbIvwgDs\n\tQSNgOpEyByst1OO4VgwGXLSRg3uQn8Q=","X-Google-Smtp-Source":"APXvYqwLFs3FrAw87TZD7gpM8DmIW0UJEjDBSSc/xznoYg/IiFSD3LjmemmaOCxh3QDdINiWBS24PA==","X-Received":"by 2002:a2e:905a:: with SMTP id\n\tn26mr5296040ljg.165.1573719107018; \n\tThu, 14 Nov 2019 00:11:47 -0800 (PST)","Date":"Thu, 14 Nov 2019 09:11:46 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20191114081146.GG7353@bigcity.dyn.berto.se>","References":"<20191108205409.18845-1-laurent.pinchart@ideasonboard.com>\n\t<20191108205409.18845-3-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20191108205409.18845-3-laurent.pinchart@ideasonboard.com>","User-Agent":"Mutt/1.12.1 (2019-06-15)","Subject":"Re: [libcamera-devel] [PATCH v2 02/24] test: controls: Add\n\tControlInfoMap test","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>","X-List-Received-Date":"Thu, 14 Nov 2019 08:11:47 -0000"}},{"id":3022,"web_url":"https://patchwork.libcamera.org/comment/3022/","msgid":"<20191115155410.xgulnfs4375roc2p@uno.localdomain>","date":"2019-11-15T15:54:10","subject":"Re: [libcamera-devel] [PATCH v2 02/24] test: controls: Add\n\tControlInfoMap test","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Fri, Nov 08, 2019 at 10:53:47PM +0200, Laurent Pinchart wrote:\n> Add a test to exercise the ControlInfoMap API. This currently tests\n> at(), count(), find() and end().\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  test/controls/control_info.cpp | 77 ++++++++++++++++++++++++++++++++++\n>  test/controls/meson.build      |  1 +\n>  2 files changed, 78 insertions(+)\n>  create mode 100644 test/controls/control_info.cpp\n>\n> diff --git a/test/controls/control_info.cpp b/test/controls/control_info.cpp\n> new file mode 100644\n> index 000000000000..c2678ea3e593\n> --- /dev/null\n> +++ b/test/controls/control_info.cpp\n> @@ -0,0 +1,77 @@\n> +/* SPDX-License-Identifier: GPL-2.0-or-later */\n> +/*\n> + * Copyright (C) 2019, Google Inc.\n> + *\n> + * control_info.cpp - ControlInfoMap tests\n> + */\n> +\n> +#include <iostream>\n> +\n> +#include <libcamera/camera.h>\n> +#include <libcamera/camera_manager.h>\n> +#include <libcamera/control_ids.h>\n> +#include <libcamera/controls.h>\n> +\n> +#include \"camera_controls.h\"\n> +\n> +#include \"camera_test.h\"\n> +#include \"test.h\"\n> +\n> +using namespace std;\n> +using namespace libcamera;\n> +\n> +class ControlInfoMapTest : public CameraTest, public Test\n> +{\n> +public:\n> +\tControlInfoMapTest()\n> +\t\t: CameraTest(\"VIMC Sensor B\")\n> +\t{\n> +\t}\n> +\n> +protected:\n> +\tint run()\n> +\t{\n> +\t\tconst ControlInfoMap &info = camera_->controls();\n> +\n> +\t\t/* Test looking up a valid control by ControlId. */\n> +\t\tif (info.count(&controls::Brightness) != 1) {\n> +\t\t\tcout << \"count() on valid control failed\" << endl;\n\nShould we stabilise on using cerr for messages preceding a TestFail,\nlike it seems you did in the previous patch ?\n\nMinor aparts\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n   j\n\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\tif (info.find(&controls::Brightness) == info.end()) {\n> +\t\t\tcout << \"find() on valid control failed\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\tinfo.at(&controls::Brightness);\n> +\n> +\t\t/* Test looking up a valid control by numerical ID. */\n> +\t\tif (info.count(controls::Brightness.id()) != 1) {\n> +\t\t\tcout << \"count() on valid ID failed\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\tif (info.find(controls::Brightness.id()) == info.end()) {\n> +\t\t\tcout << \"find() on valid ID failed\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\tinfo.at(controls::Brightness.id());\n> +\n> +\t\t/* Test looking up an invalid control by numerical ID. */\n> +\t\tif (info.count(12345) != 0) {\n> +\t\t\tcout << \"count() on invalid ID failed\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\tif (info.find(12345) != info.end()) {\n> +\t\t\tcout << \"find() on invalid ID failed\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\treturn TestPass;\n> +\t}\n> +};\n> +\n> +TEST_REGISTER(ControlInfoMapTest)\n> diff --git a/test/controls/meson.build b/test/controls/meson.build\n> index 9f0f005a2759..f0850df28c8a 100644\n> --- a/test/controls/meson.build\n> +++ b/test/controls/meson.build\n> @@ -1,4 +1,5 @@\n>  control_tests = [\n> +    [ 'control_info',   'control_info.cpp' ],\n>      [ 'control_list',   'control_list.cpp' ],\n>      [ 'control_range',  'control_range.cpp' ],\n>      [ 'control_value',  'control_value.cpp' ],\n> --\n> Regards,\n>\n> Laurent Pinchart\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net\n\t[217.70.183.194])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2DC7B6136F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Nov 2019 16:52:09 +0100 (CET)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay2-d.mail.gandi.net (Postfix) with ESMTPSA id AA17A40005;\n\tFri, 15 Nov 2019 15:52:08 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Fri, 15 Nov 2019 16:54:10 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20191115155410.xgulnfs4375roc2p@uno.localdomain>","References":"<20191108205409.18845-1-laurent.pinchart@ideasonboard.com>\n\t<20191108205409.18845-3-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"llwccsxjvmurdryc\"","Content-Disposition":"inline","In-Reply-To":"<20191108205409.18845-3-laurent.pinchart@ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH v2 02/24] test: controls: Add\n\tControlInfoMap test","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>","X-List-Received-Date":"Fri, 15 Nov 2019 15:52:09 -0000"}},{"id":3037,"web_url":"https://patchwork.libcamera.org/comment/3037/","msgid":"<20191118003851.GI4853@pendragon.ideasonboard.com>","date":"2019-11-18T00:38:51","subject":"Re: [libcamera-devel] [PATCH v2 02/24] test: controls: Add\n\tControlInfoMap test","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nOn Thu, Nov 14, 2019 at 09:11:46AM +0100, Niklas Söderlund wrote:\n> On 2019-11-08 22:53:47 +0200, Laurent Pinchart wrote:\n> > Add a test to exercise the ControlInfoMap API. This currently tests\n> > at(), count(), find() and end().\n> > \n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  test/controls/control_info.cpp | 77 ++++++++++++++++++++++++++++++++++\n> >  test/controls/meson.build      |  1 +\n> >  2 files changed, 78 insertions(+)\n> >  create mode 100644 test/controls/control_info.cpp\n> > \n> > diff --git a/test/controls/control_info.cpp b/test/controls/control_info.cpp\n> > new file mode 100644\n> > index 000000000000..c2678ea3e593\n> > --- /dev/null\n> > +++ b/test/controls/control_info.cpp\n> > @@ -0,0 +1,77 @@\n> > +/* SPDX-License-Identifier: GPL-2.0-or-later */\n> > +/*\n> > + * Copyright (C) 2019, Google Inc.\n> > + *\n> > + * control_info.cpp - ControlInfoMap tests\n> > + */\n> > +\n> > +#include <iostream>\n> > +\n> > +#include <libcamera/camera.h>\n> > +#include <libcamera/camera_manager.h>\n> > +#include <libcamera/control_ids.h>\n> > +#include <libcamera/controls.h>\n> > +\n> > +#include \"camera_controls.h\"\n> > +\n> > +#include \"camera_test.h\"\n> > +#include \"test.h\"\n> > +\n> > +using namespace std;\n> > +using namespace libcamera;\n> > +\n> > +class ControlInfoMapTest : public CameraTest, public Test\n> > +{\n> > +public:\n> > +\tControlInfoMapTest()\n> > +\t\t: CameraTest(\"VIMC Sensor B\")\n> > +\t{\n> > +\t}\n> > +\n> > +protected:\n> \n> Do you not need:\n> \n>     int init() override\n>     {\n>         return status_;\n>     }\n> \n> To make sure the camera is found?\n\nWe do, I'll add that.\n\n> > +\tint run()\n> > +\t{\n> > +\t\tconst ControlInfoMap &info = camera_->controls();\n> > +\n> > +\t\t/* Test looking up a valid control by ControlId. */\n> > +\t\tif (info.count(&controls::Brightness) != 1) {\n> > +\t\t\tcout << \"count() on valid control failed\" << endl;\n> > +\t\t\treturn TestFail;\n> > +\t\t}\n> > +\n> > +\t\tif (info.find(&controls::Brightness) == info.end()) {\n> > +\t\t\tcout << \"find() on valid control failed\" << endl;\n> > +\t\t\treturn TestFail;\n> > +\t\t}\n> > +\n> > +\t\tinfo.at(&controls::Brightness);\n> > +\n> > +\t\t/* Test looking up a valid control by numerical ID. */\n> > +\t\tif (info.count(controls::Brightness.id()) != 1) {\n> > +\t\t\tcout << \"count() on valid ID failed\" << endl;\n> > +\t\t\treturn TestFail;\n> > +\t\t}\n> > +\n> > +\t\tif (info.find(controls::Brightness.id()) == info.end()) {\n> > +\t\t\tcout << \"find() on valid ID failed\" << endl;\n> > +\t\t\treturn TestFail;\n> > +\t\t}\n> > +\n> > +\t\tinfo.at(controls::Brightness.id());\n> > +\n> > +\t\t/* Test looking up an invalid control by numerical ID. */\n> > +\t\tif (info.count(12345) != 0) {\n> > +\t\t\tcout << \"count() on invalid ID failed\" << endl;\n> > +\t\t\treturn TestFail;\n> > +\t\t}\n> > +\n> > +\t\tif (info.find(12345) != info.end()) {\n> > +\t\t\tcout << \"find() on invalid ID failed\" << endl;\n> > +\t\t\treturn TestFail;\n> > +\t\t}\n> > +\n> > +\t\treturn TestPass;\n> > +\t}\n> > +};\n> > +\n> > +TEST_REGISTER(ControlInfoMapTest)\n> > diff --git a/test/controls/meson.build b/test/controls/meson.build\n> > index 9f0f005a2759..f0850df28c8a 100644\n> > --- a/test/controls/meson.build\n> > +++ b/test/controls/meson.build\n> > @@ -1,4 +1,5 @@\n> >  control_tests = [\n> > +    [ 'control_info',   'control_info.cpp' ],\n> >      [ 'control_list',   'control_list.cpp' ],\n> >      [ 'control_range',  'control_range.cpp' ],\n> >      [ 'control_value',  'control_value.cpp' ],\n> > -- \n> > Regards,\n> > \n> > Laurent Pinchart\n> > \n> > _______________________________________________\n> > libcamera-devel mailing list\n> > libcamera-devel@lists.libcamera.org\n> > https://lists.libcamera.org/listinfo/libcamera-devel\n> \n> -- \n> Regards,\n> Niklas Söderlund","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EA48D60C33\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Nov 2019 01:38:56 +0100 (CET)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5BC5FA04;\n\tMon, 18 Nov 2019 01:38:56 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1574037536;\n\tbh=HIK8mjtxwCuz5D8UcjBxv4elKCzcNtjzLrFfRizELuI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=fQheSduzCG1Mm780gNd1QI9FTQ7oaS8P7EsCs3IfuT89UXUpfexICO0QC7dW5Tjez\n\te2QMzGZMGnTtSb7wC9OWhXTRVxVV1kQtw8w+ELDgvUqe9y2idRiigswP9+SJU/m9F/\n\tG9Vh8UALlKNvU+nDIFnku4OtL/pjsPW5H2/22TRs=","Date":"Mon, 18 Nov 2019 02:38:51 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20191118003851.GI4853@pendragon.ideasonboard.com>","References":"<20191108205409.18845-1-laurent.pinchart@ideasonboard.com>\n\t<20191108205409.18845-3-laurent.pinchart@ideasonboard.com>\n\t<20191114081146.GG7353@bigcity.dyn.berto.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20191114081146.GG7353@bigcity.dyn.berto.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 02/24] test: controls: Add\n\tControlInfoMap test","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>","X-List-Received-Date":"Mon, 18 Nov 2019 00:38:57 -0000"}},{"id":3038,"web_url":"https://patchwork.libcamera.org/comment/3038/","msgid":"<20191118004103.GJ4853@pendragon.ideasonboard.com>","date":"2019-11-18T00:41:03","subject":"Re: [libcamera-devel] [PATCH v2 02/24] test: controls: Add\n\tControlInfoMap test","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Fri, Nov 15, 2019 at 04:54:10PM +0100, Jacopo Mondi wrote:\n> On Fri, Nov 08, 2019 at 10:53:47PM +0200, Laurent Pinchart wrote:\n> > Add a test to exercise the ControlInfoMap API. This currently tests\n> > at(), count(), find() and end().\n> >\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  test/controls/control_info.cpp | 77 ++++++++++++++++++++++++++++++++++\n> >  test/controls/meson.build      |  1 +\n> >  2 files changed, 78 insertions(+)\n> >  create mode 100644 test/controls/control_info.cpp\n> >\n> > diff --git a/test/controls/control_info.cpp b/test/controls/control_info.cpp\n> > new file mode 100644\n> > index 000000000000..c2678ea3e593\n> > --- /dev/null\n> > +++ b/test/controls/control_info.cpp\n> > @@ -0,0 +1,77 @@\n> > +/* SPDX-License-Identifier: GPL-2.0-or-later */\n> > +/*\n> > + * Copyright (C) 2019, Google Inc.\n> > + *\n> > + * control_info.cpp - ControlInfoMap tests\n> > + */\n> > +\n> > +#include <iostream>\n> > +\n> > +#include <libcamera/camera.h>\n> > +#include <libcamera/camera_manager.h>\n> > +#include <libcamera/control_ids.h>\n> > +#include <libcamera/controls.h>\n> > +\n> > +#include \"camera_controls.h\"\n> > +\n> > +#include \"camera_test.h\"\n> > +#include \"test.h\"\n> > +\n> > +using namespace std;\n> > +using namespace libcamera;\n> > +\n> > +class ControlInfoMapTest : public CameraTest, public Test\n> > +{\n> > +public:\n> > +\tControlInfoMapTest()\n> > +\t\t: CameraTest(\"VIMC Sensor B\")\n> > +\t{\n> > +\t}\n> > +\n> > +protected:\n> > +\tint run()\n> > +\t{\n> > +\t\tconst ControlInfoMap &info = camera_->controls();\n> > +\n> > +\t\t/* Test looking up a valid control by ControlId. */\n> > +\t\tif (info.count(&controls::Brightness) != 1) {\n> > +\t\t\tcout << \"count() on valid control failed\" << endl;\n> \n> Should we stabilise on using cerr for messages preceding a TestFail,\n> like it seems you did in the previous patch ?\n\nI'll change it here, but I think we should really create a test status\nclass that bundles a message and a status code. Another item to add to\nthe test refactoring todo list.\n\n> Minor aparts\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n> \n> > +\t\t\treturn TestFail;\n> > +\t\t}\n> > +\n> > +\t\tif (info.find(&controls::Brightness) == info.end()) {\n> > +\t\t\tcout << \"find() on valid control failed\" << endl;\n> > +\t\t\treturn TestFail;\n> > +\t\t}\n> > +\n> > +\t\tinfo.at(&controls::Brightness);\n> > +\n> > +\t\t/* Test looking up a valid control by numerical ID. */\n> > +\t\tif (info.count(controls::Brightness.id()) != 1) {\n> > +\t\t\tcout << \"count() on valid ID failed\" << endl;\n> > +\t\t\treturn TestFail;\n> > +\t\t}\n> > +\n> > +\t\tif (info.find(controls::Brightness.id()) == info.end()) {\n> > +\t\t\tcout << \"find() on valid ID failed\" << endl;\n> > +\t\t\treturn TestFail;\n> > +\t\t}\n> > +\n> > +\t\tinfo.at(controls::Brightness.id());\n> > +\n> > +\t\t/* Test looking up an invalid control by numerical ID. */\n> > +\t\tif (info.count(12345) != 0) {\n> > +\t\t\tcout << \"count() on invalid ID failed\" << endl;\n> > +\t\t\treturn TestFail;\n> > +\t\t}\n> > +\n> > +\t\tif (info.find(12345) != info.end()) {\n> > +\t\t\tcout << \"find() on invalid ID failed\" << endl;\n> > +\t\t\treturn TestFail;\n> > +\t\t}\n> > +\n> > +\t\treturn TestPass;\n> > +\t}\n> > +};\n> > +\n> > +TEST_REGISTER(ControlInfoMapTest)\n> > diff --git a/test/controls/meson.build b/test/controls/meson.build\n> > index 9f0f005a2759..f0850df28c8a 100644\n> > --- a/test/controls/meson.build\n> > +++ b/test/controls/meson.build\n> > @@ -1,4 +1,5 @@\n> >  control_tests = [\n> > +    [ 'control_info',   'control_info.cpp' ],\n> >      [ 'control_list',   'control_list.cpp' ],\n> >      [ 'control_range',  'control_range.cpp' ],\n> >      [ 'control_value',  'control_value.cpp' ],","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A208860C33\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Nov 2019 01:41:08 +0100 (CET)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1C03EA04;\n\tMon, 18 Nov 2019 01:41:08 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1574037668;\n\tbh=gve2CRVLqsp7LYzggyFkH46/j/UjF2uzlPaw1jN5IRo=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=kQ+2y+vfAGelPI/uJ1Sreji0USOzxEuvoooXzZ8unG22dS5UpgsZ2K2rVqhevP3fp\n\tuF9/6FWl+5wYyNWhkt9hhfg7jqOWWINDSxjVG99QmSbJuq+0zve2a+gX6Jp/9u15Ch\n\tLkmIyJuvFXwAdDCDGXnh6bvIg1cLLJwTJNuaW0Js=","Date":"Mon, 18 Nov 2019 02:41:03 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20191118004103.GJ4853@pendragon.ideasonboard.com>","References":"<20191108205409.18845-1-laurent.pinchart@ideasonboard.com>\n\t<20191108205409.18845-3-laurent.pinchart@ideasonboard.com>\n\t<20191115155410.xgulnfs4375roc2p@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20191115155410.xgulnfs4375roc2p@uno.localdomain>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 02/24] test: controls: Add\n\tControlInfoMap test","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>","X-List-Received-Date":"Mon, 18 Nov 2019 00:41:08 -0000"}},{"id":3057,"web_url":"https://patchwork.libcamera.org/comment/3057/","msgid":"<20191118170717.GA8072@bigcity.dyn.berto.se>","date":"2019-11-18T17:07:17","subject":"Re: [libcamera-devel] [PATCH v2 02/24] test: controls: Add\n\tControlInfoMap test","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nOn 2019-11-18 02:38:51 +0200, Laurent Pinchart wrote:\n> Hi Niklas,\n> \n> On Thu, Nov 14, 2019 at 09:11:46AM +0100, Niklas Söderlund wrote:\n> > On 2019-11-08 22:53:47 +0200, Laurent Pinchart wrote:\n> > > Add a test to exercise the ControlInfoMap API. This currently tests\n> > > at(), count(), find() and end().\n> > > \n> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > > ---\n> > >  test/controls/control_info.cpp | 77 ++++++++++++++++++++++++++++++++++\n> > >  test/controls/meson.build      |  1 +\n> > >  2 files changed, 78 insertions(+)\n> > >  create mode 100644 test/controls/control_info.cpp\n> > > \n> > > diff --git a/test/controls/control_info.cpp b/test/controls/control_info.cpp\n> > > new file mode 100644\n> > > index 000000000000..c2678ea3e593\n> > > --- /dev/null\n> > > +++ b/test/controls/control_info.cpp\n> > > @@ -0,0 +1,77 @@\n> > > +/* SPDX-License-Identifier: GPL-2.0-or-later */\n> > > +/*\n> > > + * Copyright (C) 2019, Google Inc.\n> > > + *\n> > > + * control_info.cpp - ControlInfoMap tests\n> > > + */\n> > > +\n> > > +#include <iostream>\n> > > +\n> > > +#include <libcamera/camera.h>\n> > > +#include <libcamera/camera_manager.h>\n> > > +#include <libcamera/control_ids.h>\n> > > +#include <libcamera/controls.h>\n> > > +\n> > > +#include \"camera_controls.h\"\n> > > +\n> > > +#include \"camera_test.h\"\n> > > +#include \"test.h\"\n> > > +\n> > > +using namespace std;\n> > > +using namespace libcamera;\n> > > +\n> > > +class ControlInfoMapTest : public CameraTest, public Test\n> > > +{\n> > > +public:\n> > > +\tControlInfoMapTest()\n> > > +\t\t: CameraTest(\"VIMC Sensor B\")\n> > > +\t{\n> > > +\t}\n> > > +\n> > > +protected:\n> > \n> > Do you not need:\n> > \n> >     int init() override\n> >     {\n> >         return status_;\n> >     }\n> > \n> > To make sure the camera is found?\n> \n> We do, I'll add that.\n\nWith that fixed,\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> \n> > > +\tint run()\n> > > +\t{\n> > > +\t\tconst ControlInfoMap &info = camera_->controls();\n> > > +\n> > > +\t\t/* Test looking up a valid control by ControlId. */\n> > > +\t\tif (info.count(&controls::Brightness) != 1) {\n> > > +\t\t\tcout << \"count() on valid control failed\" << endl;\n> > > +\t\t\treturn TestFail;\n> > > +\t\t}\n> > > +\n> > > +\t\tif (info.find(&controls::Brightness) == info.end()) {\n> > > +\t\t\tcout << \"find() on valid control failed\" << endl;\n> > > +\t\t\treturn TestFail;\n> > > +\t\t}\n> > > +\n> > > +\t\tinfo.at(&controls::Brightness);\n> > > +\n> > > +\t\t/* Test looking up a valid control by numerical ID. */\n> > > +\t\tif (info.count(controls::Brightness.id()) != 1) {\n> > > +\t\t\tcout << \"count() on valid ID failed\" << endl;\n> > > +\t\t\treturn TestFail;\n> > > +\t\t}\n> > > +\n> > > +\t\tif (info.find(controls::Brightness.id()) == info.end()) {\n> > > +\t\t\tcout << \"find() on valid ID failed\" << endl;\n> > > +\t\t\treturn TestFail;\n> > > +\t\t}\n> > > +\n> > > +\t\tinfo.at(controls::Brightness.id());\n> > > +\n> > > +\t\t/* Test looking up an invalid control by numerical ID. */\n> > > +\t\tif (info.count(12345) != 0) {\n> > > +\t\t\tcout << \"count() on invalid ID failed\" << endl;\n> > > +\t\t\treturn TestFail;\n> > > +\t\t}\n> > > +\n> > > +\t\tif (info.find(12345) != info.end()) {\n> > > +\t\t\tcout << \"find() on invalid ID failed\" << endl;\n> > > +\t\t\treturn TestFail;\n> > > +\t\t}\n> > > +\n> > > +\t\treturn TestPass;\n> > > +\t}\n> > > +};\n> > > +\n> > > +TEST_REGISTER(ControlInfoMapTest)\n> > > diff --git a/test/controls/meson.build b/test/controls/meson.build\n> > > index 9f0f005a2759..f0850df28c8a 100644\n> > > --- a/test/controls/meson.build\n> > > +++ b/test/controls/meson.build\n> > > @@ -1,4 +1,5 @@\n> > >  control_tests = [\n> > > +    [ 'control_info',   'control_info.cpp' ],\n> > >      [ 'control_list',   'control_list.cpp' ],\n> > >      [ 'control_range',  'control_range.cpp' ],\n> > >      [ 'control_value',  'control_value.cpp' ],\n> > > -- \n> > > Regards,\n> > > \n> > > Laurent Pinchart\n> > > \n> > > _______________________________________________\n> > > libcamera-devel mailing list\n> > > libcamera-devel@lists.libcamera.org\n> > > https://lists.libcamera.org/listinfo/libcamera-devel\n> > \n> > -- \n> > Regards,\n> > Niklas Söderlund\n> \n> -- \n> Regards,\n> \n> Laurent Pinchart","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lf1-x141.google.com (mail-lf1-x141.google.com\n\t[IPv6:2a00:1450:4864:20::141])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 81C9560F1C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Nov 2019 18:07:19 +0100 (CET)","by mail-lf1-x141.google.com with SMTP id q28so512645lfp.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Nov 2019 09:07:19 -0800 (PST)","from localhost (h-93-159.A463.priv.bahnhof.se. [46.59.93.159])\n\tby smtp.gmail.com with ESMTPSA id\n\ty6sm8643842ljn.40.2019.11.18.09.07.17\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 18 Nov 2019 09:07:17 -0800 (PST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=lGr7am+OMONnKjfA6uYpWSQztgPbRiDJGSfz1LvlLaw=;\n\tb=TLXYzenaQKUq/grv5oIRC0vHL2hJAzidQPPrKK+a3Pi82DaS+xufmgRzyL6boeP6AB\n\tisr5lfbyR+gokvZEdTw1rZp05cJyKromkOpkrisr6u2eOx4iwaH91Upcu2er9MLPz+tv\n\tit1XqMc8bD4dQi1rsKjmDf2w0gSDJWNSzd9C2fhGJOlI1HuRAfudE6mzq85aoi+yieqr\n\tPieRW8Eo48qYhwGPTo3hoz6FoskbE1Hw2j4oiyQO+5iFNaKHVDO32lcW8+mA2aVKxg1F\n\tCSXZpEaGtvT1relIuP8pgOC4L4Qf5myh7aM1AskSoSyvmLnH61PD74vKEqrZnyxYqGYP\n\tZbag==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=lGr7am+OMONnKjfA6uYpWSQztgPbRiDJGSfz1LvlLaw=;\n\tb=a9c+BUixKW3hKEPdWkJ9+fl/q8HRpjXVMGWAhpAHooQ6gmE+O5SAD87dluJPp0ax7k\n\tuSC3muOaRidSrvPYtVIua7FQ/KZ9Jao8+cNbjXoaXjeXHcm9FcJBjZ3TRwmwIHybr6Iu\n\tcA0eckyxKKL4aPm0GGpkCVvePp7jLpij4ioFfgdRWRDW/uZfzJo7KfSiz/C2P/fIOd+S\n\tf6FFMeWseaV8Q1KrXM657a1TgwLwwl7DqFW++bdH1R+1XyPT4BbcZ5xZyaEIJdogLNB3\n\tm4uCCLJTb7qTYh6RO5VuFR08D0WEqEuOI4OvYi1tsR5GdYdT1xp2/lARdUGulMcMKnDe\n\tt1cg==","X-Gm-Message-State":"APjAAAWrlYOlPVNqlzG+/lvdIm1utJTTSgx8DxvwuStBO29HR5AootZl\n\t4Xgw6XiXrY+FoP+zbuor4NPmGQ==","X-Google-Smtp-Source":"APXvYqyYwvGkn1AJT7Nm0XXiueBIKfqvULownk0jBC6eK5zs8vJxdAW0bHUxJxGWx6besQY+KqEM9w==","X-Received":"by 2002:a19:8092:: with SMTP id b140mr334331lfd.13.1574096838636;\n\tMon, 18 Nov 2019 09:07:18 -0800 (PST)","Date":"Mon, 18 Nov 2019 18:07:17 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20191118170717.GA8072@bigcity.dyn.berto.se>","References":"<20191108205409.18845-1-laurent.pinchart@ideasonboard.com>\n\t<20191108205409.18845-3-laurent.pinchart@ideasonboard.com>\n\t<20191114081146.GG7353@bigcity.dyn.berto.se>\n\t<20191118003851.GI4853@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20191118003851.GI4853@pendragon.ideasonboard.com>","User-Agent":"Mutt/1.12.1 (2019-06-15)","Subject":"Re: [libcamera-devel] [PATCH v2 02/24] test: controls: Add\n\tControlInfoMap test","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>","X-List-Received-Date":"Mon, 18 Nov 2019 17:07:19 -0000"}}]