[{"id":972,"web_url":"https://patchwork.libcamera.org/comment/972/","msgid":"<20190228220920.GO7811@pendragon.ideasonboard.com>","date":"2019-02-28T22:09:20","subject":"Re: [libcamera-devel] [PATCH v5 7/9] test: v4l2_subdevice: Add\n\tformat handling test","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Thu, Feb 28, 2019 at 09:01:49PM +0100, Jacopo Mondi wrote:\n> Add test for video format get and set operations on V4L2Subdevice class.\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  test/meson.build                            |  1 +\n>  test/v4l2_subdevice/meson.build             | 10 +++\n>  test/v4l2_subdevice/test_formats.cpp        | 78 ++++++++++++++++++\n>  test/v4l2_subdevice/v4l2_subdevice_test.cpp | 89 +++++++++++++++++++++\n>  test/v4l2_subdevice/v4l2_subdevice_test.h   | 36 +++++++++\n>  5 files changed, 214 insertions(+)\n>  create mode 100644 test/v4l2_subdevice/meson.build\n>  create mode 100644 test/v4l2_subdevice/test_formats.cpp\n>  create mode 100644 test/v4l2_subdevice/v4l2_subdevice_test.cpp\n>  create mode 100644 test/v4l2_subdevice/v4l2_subdevice_test.h\n> \n> diff --git a/test/meson.build b/test/meson.build\n> index d515a716207e..5fb16fa6afb6 100644\n> --- a/test/meson.build\n> +++ b/test/meson.build\n> @@ -3,6 +3,7 @@ subdir('libtest')\n>  subdir('media_device')\n>  subdir('pipeline')\n>  subdir('v4l2_device')\n> +subdir('v4l2_subdevice')\n>  \n>  public_tests = [\n>      ['event',                           'event.cpp'],\n> diff --git a/test/v4l2_subdevice/meson.build b/test/v4l2_subdevice/meson.build\n> new file mode 100644\n> index 000000000000..f45dca0d23d7\n> --- /dev/null\n> +++ b/test/v4l2_subdevice/meson.build\n> @@ -0,0 +1,10 @@\n> +v4l2_subdevice_tests = [\n> +  [ 'test_formats',             'test_formats.cpp'],\n> +]\n> +\n> +foreach t : v4l2_subdevice_tests\n> +    exe = executable(t[0], [t[1], 'v4l2_subdevice_test.cpp'],\n> +        link_with : test_libraries,\n> +        include_directories : test_includes_internal)\n> +    test(t[0], exe, suite: 'v4l2_subdevice', is_parallel: false)\n> +endforeach\n> diff --git a/test/v4l2_subdevice/test_formats.cpp b/test/v4l2_subdevice/test_formats.cpp\n> new file mode 100644\n> index 000000000000..af954459a3d8\n> --- /dev/null\n> +++ b/test/v4l2_subdevice/test_formats.cpp\n> @@ -0,0 +1,78 @@\n> +/* SPDX-License-Identifier: GPL-2.0-or-later */\n> +/*\n> + * Copyright (C) 2019, Google Inc.\n> + *\n> + * libcamera V4L2 Subdevice format handling test\n> + */\n> +\n> +#include <climits>\n> +#include <iostream>\n> +\n> +#include \"v4l2_subdevice.h\"\n> +#include \"v4l2_subdevice_test.h\"\n> +\n> +using namespace std;\n> +using namespace libcamera;\n> +\n> +/* Test format handling on the \"Scaler\" subdevice of vimc media device.  */\n> +\n> +class FormatHandlingTest : public V4L2SubdeviceTest\n> +{\n> +protected:\n> +\tint run() override;\n> +};\n> +\n> +int FormatHandlingTest::run()\n> +{\n> +\tV4L2SubdeviceFormat format = {};\n> +\n> +\t/*\n> +\t * Get format on a non-existing Scaler pad: expect failure.\n> +\t */\n> +\tint ret = scaler_->getFormat(2, &format);\n> +\tif (!ret) {\n> +\t\tcerr << \"Getting format on a non existing pad should fail\" << endl;\n> +\t\treturn TestFail;\n> +\t}\n> +\n> +\tret = scaler_->getFormat(0, &format);\n> +\tif (ret) {\n> +\t\tcerr << \"Failed to get format\" << endl;\n> +\t\treturn TestFail;\n> +\t}\n> +\n> +\t/*\n> +\t * Set unrealistic image resolutions and make sure it gets updated.\n> +\t */\n> +\tformat.width = UINT_MAX;\n> +\tformat.height = UINT_MAX;\n> +\tret = scaler_->setFormat(0, &format);\n> +\tif (ret) {\n> +\t\tcerr << \"Failed to set format: image resolution is wrong, but \"\n> +\t\t     << \"setFormat() should not fail.\" << endl;\n> +\t\treturn TestFail;\n> +\t}\n> +\n> +\tif (format.width == UINT_MAX || format.height == UINT_MAX) {\n> +\t\tcerr << \"Failed to update image format\" << endl;\n> +\t\treturn TestFail;\n> +\t}\n> +\n> +\tformat.width = 0;\n> +\tformat.height = 0;\n> +\tret = scaler_->setFormat(0, &format);\n> +\tif (ret) {\n> +\t\tcerr << \"Failed to set format: image resolution is wrong, but \"\n> +\t\t     << \"setFormat() should not fail.\" << endl;\n> +\t\treturn TestFail;\n> +\t}\n> +\n> +\tif (format.width == 0 || format.height == 0) {\n> +\t\tcerr << \"Failed to update image format\" << endl;\n> +\t\treturn TestFail;\n> +\t}\n> +\n> +\treturn TestPass;\n> +}\n> +\n> +TEST_REGISTER(FormatHandlingTest);\n> diff --git a/test/v4l2_subdevice/v4l2_subdevice_test.cpp b/test/v4l2_subdevice/v4l2_subdevice_test.cpp\n> new file mode 100644\n> index 000000000000..a110f05339a1\n> --- /dev/null\n> +++ b/test/v4l2_subdevice/v4l2_subdevice_test.cpp\n> @@ -0,0 +1,89 @@\n> +/* SPDX-License-Identifier: GPL-2.0-or-later */\n> +/*\n> + * Copyright (C) 2019, Google Inc.\n> + *\n> + * v4l2_subdevice_test.cpp - VIMC-based V4L2 subdevice test\n> + */\n> +\n> +#include <iostream>\n> +#include <string.h>\n> +#include <sys/stat.h>\n> +\n> +#include \"device_enumerator.h\"\n> +#include \"media_device.h\"\n> +#include \"v4l2_subdevice.h\"\n> +#include \"v4l2_subdevice_test.h\"\n> +\n> +using namespace std;\n> +using namespace libcamera;\n> +\n> +/*\n> + * This test runs on vimc media device. For a description of vimc, in the\n> + * context of libcamera testing, please refer to\n> + * 'test/media_device/media_device_link_test.cpp' file.\n> + *\n> + * If the vimc module is not loaded, the test gets skipped.\n> + */\n> +\n> +int V4L2SubdeviceTest::init()\n> +{\n> +\tenumerator_ = DeviceEnumerator::create();\n> +\tif (!enumerator_) {\n> +\t\tcerr << \"Failed to create device enumerator\" << endl;\n> +\t\treturn TestFail;\n> +\t}\n> +\n> +\tif (enumerator_->enumerate()) {\n> +\t\tcerr << \"Failed to enumerate media devices\" << endl;\n> +\t\treturn TestFail;\n> +\t}\n> +\n> +\tDeviceMatch dm(\"vimc\");\n> +\tmedia_ = std::move(enumerator_->search(dm));\n> +\tif (!media_) {\n> +\t\tcerr << \"Unable to find \\'vimc\\' media device node\" << endl;\n> +\t\treturn TestSkip;\n> +\t}\n> +\n> +\tmedia_->acquire();\n> +\n> +\tint ret = media_->open();\n> +\tif (ret) {\n> +\t\tcerr << \"Unable to open media device: \" << media_->deviceNode()\n> +\t\t     << \": \" << strerror(ret) << endl;\n> +\t\tmedia_->release();\n> +\t\treturn TestSkip;\n> +\t}\n> +\n> +\tMediaEntity *videoEntity = media_->getEntityByName(\"Scaler\");\n> +\tif (!videoEntity) {\n> +\t\tcerr << \"Unable to find media entity 'Scaler'\" << endl;\n> +\t\tmedia_->release();\n> +\t\treturn TestFail;\n> +\t}\n> +\n> +\tscaler_ = new V4L2Subdevice(videoEntity);\n> +\tif (!scaler_) {\n\nThis can't happen, can it ?\n\n> +\t\tcerr << \"Unable to create media device from media entity: \"\n> +\t\t     << videoEntity->deviceNode();\n> +\t\tmedia_->release();\n> +\t\treturn TestFail;\n> +\t}\n> +\n> +\tret = scaler_->open();\n> +\tif (ret) {\n> +\t\tcerr << \"Unable to open video subdevice \"\n> +\t\t     << scaler_->deviceNode() << endl;\n> +\t\tmedia_->release();\n> +\t\treturn TestSkip;\n> +\t}\n> +\n> +\treturn 0;\n> +}\n> +\n> +void V4L2SubdeviceTest::cleanup()\n> +{\n> +\tmedia_->release();\n> +\n> +\tdelete scaler_;\n> +}\n> diff --git a/test/v4l2_subdevice/v4l2_subdevice_test.h b/test/v4l2_subdevice/v4l2_subdevice_test.h\n> new file mode 100644\n> index 000000000000..1d8e08a9c2b9\n> --- /dev/null\n> +++ b/test/v4l2_subdevice/v4l2_subdevice_test.h\n> @@ -0,0 +1,36 @@\n> +/* SPDX-License-Identifier: GPL-2.0-or-later */\n> +/*\n> + * Copyright (C) 2019, Google Inc.\n> + *\n> + * v4l2_subdevice_test.h - VIMC-based V4L2 subdevice test\n> + */\n> +\n> +#ifndef __LIBCAMERA_V4L2_SUBDEVICE_TEST_H__\n> +#define __LIBCAMERA_V4L2_SUBDEVICE_TEST_H__\n> +\n> +#include <libcamera/buffer.h>\n> +\n> +#include \"device_enumerator.h\"\n> +#include \"media_device.h\"\n> +#include \"test.h\"\n> +#include \"v4l2_subdevice.h\"\n> +\n> +using namespace libcamera;\n> +\n> +class V4L2SubdeviceTest : public Test\n> +{\n> +public:\n> +\tV4L2SubdeviceTest()\n> +\t\t: scaler_(nullptr){};\n> +\n> +protected:\n> +\tint init() override;\n> +\tvirtual int run() = 0;\n\nNo need for this.\n\nWith these small issues fixed,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\tvoid cleanup() override;\n> +\n> +\tstd::unique_ptr<DeviceEnumerator> enumerator_;\n> +\tstd::shared_ptr<MediaDevice> media_;\n> +\tV4L2Subdevice *scaler_;\n> +};\n> +\n> +#endif /* __LIBCAMERA_V4L2_SUBDEVICE_TEST_H__ */","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 C4EB1610B6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Feb 2019 23:09:25 +0100 (CET)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3EF3649;\n\tThu, 28 Feb 2019 23:09:25 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1551391765;\n\tbh=t5kSpdIoai5/fLdIkxdyBUaWePgSdMVZeReK2RyIISY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=dJfv7scP3FqI1XPR4WDYoMv0aXO8g/TTIpQ8opUS1Q1V/qRT1ukLLVipKMhWzG+zw\n\tjkE8ZHisoxv7Xm5g52Z/M5ZIm4ImKSpd/483lv8v46eRE422NJld5W4IFtGWWlAP95\n\t3vI3zvVHKAvYlYkLLDgOjznBq0Ca1jZq2GdjdYIk=","Date":"Fri, 1 Mar 2019 00:09:20 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<20190228220920.GO7811@pendragon.ideasonboard.com>","References":"<20190228200151.2948-1-jacopo@jmondi.org>\n\t<20190228200151.2948-8-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190228200151.2948-8-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v5 7/9] test: v4l2_subdevice: Add\n\tformat handling test","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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, 28 Feb 2019 22:09:25 -0000"}},{"id":981,"web_url":"https://patchwork.libcamera.org/comment/981/","msgid":"<20190301092541.f5ulvyekymntbr7a@uno.localdomain>","date":"2019-03-01T09:25:41","subject":"Re: [libcamera-devel] [PATCH v5 7/9] test: v4l2_subdevice: Add\n\tformat handling 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, Mar 01, 2019 at 12:09:20AM +0200, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> Thank you for the patch.\n>\n> On Thu, Feb 28, 2019 at 09:01:49PM +0100, Jacopo Mondi wrote:\n> > Add test for video format get and set operations on V4L2Subdevice class.\n> >\n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  test/meson.build                            |  1 +\n> >  test/v4l2_subdevice/meson.build             | 10 +++\n> >  test/v4l2_subdevice/test_formats.cpp        | 78 ++++++++++++++++++\n> >  test/v4l2_subdevice/v4l2_subdevice_test.cpp | 89 +++++++++++++++++++++\n> >  test/v4l2_subdevice/v4l2_subdevice_test.h   | 36 +++++++++\n> >  5 files changed, 214 insertions(+)\n> >  create mode 100644 test/v4l2_subdevice/meson.build\n> >  create mode 100644 test/v4l2_subdevice/test_formats.cpp\n> >  create mode 100644 test/v4l2_subdevice/v4l2_subdevice_test.cpp\n> >  create mode 100644 test/v4l2_subdevice/v4l2_subdevice_test.h\n> >\n> > diff --git a/test/meson.build b/test/meson.build\n> > index d515a716207e..5fb16fa6afb6 100644\n> > --- a/test/meson.build\n> > +++ b/test/meson.build\n> > @@ -3,6 +3,7 @@ subdir('libtest')\n> >  subdir('media_device')\n> >  subdir('pipeline')\n> >  subdir('v4l2_device')\n> > +subdir('v4l2_subdevice')\n> >\n> >  public_tests = [\n> >      ['event',                           'event.cpp'],\n> > diff --git a/test/v4l2_subdevice/meson.build b/test/v4l2_subdevice/meson.build\n> > new file mode 100644\n> > index 000000000000..f45dca0d23d7\n> > --- /dev/null\n> > +++ b/test/v4l2_subdevice/meson.build\n> > @@ -0,0 +1,10 @@\n> > +v4l2_subdevice_tests = [\n> > +  [ 'test_formats',             'test_formats.cpp'],\n> > +]\n> > +\n> > +foreach t : v4l2_subdevice_tests\n> > +    exe = executable(t[0], [t[1], 'v4l2_subdevice_test.cpp'],\n> > +        link_with : test_libraries,\n> > +        include_directories : test_includes_internal)\n> > +    test(t[0], exe, suite: 'v4l2_subdevice', is_parallel: false)\n> > +endforeach\n> > diff --git a/test/v4l2_subdevice/test_formats.cpp b/test/v4l2_subdevice/test_formats.cpp\n> > new file mode 100644\n> > index 000000000000..af954459a3d8\n> > --- /dev/null\n> > +++ b/test/v4l2_subdevice/test_formats.cpp\n> > @@ -0,0 +1,78 @@\n> > +/* SPDX-License-Identifier: GPL-2.0-or-later */\n> > +/*\n> > + * Copyright (C) 2019, Google Inc.\n> > + *\n> > + * libcamera V4L2 Subdevice format handling test\n> > + */\n> > +\n> > +#include <climits>\n> > +#include <iostream>\n> > +\n> > +#include \"v4l2_subdevice.h\"\n> > +#include \"v4l2_subdevice_test.h\"\n> > +\n> > +using namespace std;\n> > +using namespace libcamera;\n> > +\n> > +/* Test format handling on the \"Scaler\" subdevice of vimc media device.  */\n> > +\n> > +class FormatHandlingTest : public V4L2SubdeviceTest\n> > +{\n> > +protected:\n> > +\tint run() override;\n> > +};\n> > +\n> > +int FormatHandlingTest::run()\n> > +{\n> > +\tV4L2SubdeviceFormat format = {};\n> > +\n> > +\t/*\n> > +\t * Get format on a non-existing Scaler pad: expect failure.\n> > +\t */\n> > +\tint ret = scaler_->getFormat(2, &format);\n> > +\tif (!ret) {\n> > +\t\tcerr << \"Getting format on a non existing pad should fail\" << endl;\n> > +\t\treturn TestFail;\n> > +\t}\n> > +\n> > +\tret = scaler_->getFormat(0, &format);\n> > +\tif (ret) {\n> > +\t\tcerr << \"Failed to get format\" << endl;\n> > +\t\treturn TestFail;\n> > +\t}\n> > +\n> > +\t/*\n> > +\t * Set unrealistic image resolutions and make sure it gets updated.\n> > +\t */\n> > +\tformat.width = UINT_MAX;\n> > +\tformat.height = UINT_MAX;\n> > +\tret = scaler_->setFormat(0, &format);\n> > +\tif (ret) {\n> > +\t\tcerr << \"Failed to set format: image resolution is wrong, but \"\n> > +\t\t     << \"setFormat() should not fail.\" << endl;\n> > +\t\treturn TestFail;\n> > +\t}\n> > +\n> > +\tif (format.width == UINT_MAX || format.height == UINT_MAX) {\n> > +\t\tcerr << \"Failed to update image format\" << endl;\n> > +\t\treturn TestFail;\n> > +\t}\n> > +\n> > +\tformat.width = 0;\n> > +\tformat.height = 0;\n> > +\tret = scaler_->setFormat(0, &format);\n> > +\tif (ret) {\n> > +\t\tcerr << \"Failed to set format: image resolution is wrong, but \"\n> > +\t\t     << \"setFormat() should not fail.\" << endl;\n> > +\t\treturn TestFail;\n> > +\t}\n> > +\n> > +\tif (format.width == 0 || format.height == 0) {\n> > +\t\tcerr << \"Failed to update image format\" << endl;\n> > +\t\treturn TestFail;\n> > +\t}\n> > +\n> > +\treturn TestPass;\n> > +}\n> > +\n> > +TEST_REGISTER(FormatHandlingTest);\n> > diff --git a/test/v4l2_subdevice/v4l2_subdevice_test.cpp b/test/v4l2_subdevice/v4l2_subdevice_test.cpp\n> > new file mode 100644\n> > index 000000000000..a110f05339a1\n> > --- /dev/null\n> > +++ b/test/v4l2_subdevice/v4l2_subdevice_test.cpp\n> > @@ -0,0 +1,89 @@\n> > +/* SPDX-License-Identifier: GPL-2.0-or-later */\n> > +/*\n> > + * Copyright (C) 2019, Google Inc.\n> > + *\n> > + * v4l2_subdevice_test.cpp - VIMC-based V4L2 subdevice test\n> > + */\n> > +\n> > +#include <iostream>\n> > +#include <string.h>\n> > +#include <sys/stat.h>\n> > +\n> > +#include \"device_enumerator.h\"\n> > +#include \"media_device.h\"\n> > +#include \"v4l2_subdevice.h\"\n> > +#include \"v4l2_subdevice_test.h\"\n> > +\n> > +using namespace std;\n> > +using namespace libcamera;\n> > +\n> > +/*\n> > + * This test runs on vimc media device. For a description of vimc, in the\n> > + * context of libcamera testing, please refer to\n> > + * 'test/media_device/media_device_link_test.cpp' file.\n> > + *\n> > + * If the vimc module is not loaded, the test gets skipped.\n> > + */\n> > +\n> > +int V4L2SubdeviceTest::init()\n> > +{\n> > +\tenumerator_ = DeviceEnumerator::create();\n> > +\tif (!enumerator_) {\n> > +\t\tcerr << \"Failed to create device enumerator\" << endl;\n> > +\t\treturn TestFail;\n> > +\t}\n> > +\n> > +\tif (enumerator_->enumerate()) {\n> > +\t\tcerr << \"Failed to enumerate media devices\" << endl;\n> > +\t\treturn TestFail;\n> > +\t}\n> > +\n> > +\tDeviceMatch dm(\"vimc\");\n> > +\tmedia_ = std::move(enumerator_->search(dm));\n> > +\tif (!media_) {\n> > +\t\tcerr << \"Unable to find \\'vimc\\' media device node\" << endl;\n> > +\t\treturn TestSkip;\n> > +\t}\n> > +\n> > +\tmedia_->acquire();\n> > +\n> > +\tint ret = media_->open();\n> > +\tif (ret) {\n> > +\t\tcerr << \"Unable to open media device: \" << media_->deviceNode()\n> > +\t\t     << \": \" << strerror(ret) << endl;\n> > +\t\tmedia_->release();\n> > +\t\treturn TestSkip;\n> > +\t}\n> > +\n> > +\tMediaEntity *videoEntity = media_->getEntityByName(\"Scaler\");\n> > +\tif (!videoEntity) {\n> > +\t\tcerr << \"Unable to find media entity 'Scaler'\" << endl;\n> > +\t\tmedia_->release();\n> > +\t\treturn TestFail;\n> > +\t}\n> > +\n> > +\tscaler_ = new V4L2Subdevice(videoEntity);\n> > +\tif (!scaler_) {\n>\n> This can't happen, can it ?\n>\n\nIndeed. Well, in case the system runs out of memory blah blah... but\nwe'll have other issues bigger than this in that case.\n\n> > +\t\tcerr << \"Unable to create media device from media entity: \"\n> > +\t\t     << videoEntity->deviceNode();\n> > +\t\tmedia_->release();\n> > +\t\treturn TestFail;\n> > +\t}\n> > +\n> > +\tret = scaler_->open();\n> > +\tif (ret) {\n> > +\t\tcerr << \"Unable to open video subdevice \"\n> > +\t\t     << scaler_->deviceNode() << endl;\n> > +\t\tmedia_->release();\n> > +\t\treturn TestSkip;\n> > +\t}\n> > +\n> > +\treturn 0;\n> > +}\n> > +\n> > +void V4L2SubdeviceTest::cleanup()\n> > +{\n> > +\tmedia_->release();\n> > +\n> > +\tdelete scaler_;\n> > +}\n> > diff --git a/test/v4l2_subdevice/v4l2_subdevice_test.h b/test/v4l2_subdevice/v4l2_subdevice_test.h\n> > new file mode 100644\n> > index 000000000000..1d8e08a9c2b9\n> > --- /dev/null\n> > +++ b/test/v4l2_subdevice/v4l2_subdevice_test.h\n> > @@ -0,0 +1,36 @@\n> > +/* SPDX-License-Identifier: GPL-2.0-or-later */\n> > +/*\n> > + * Copyright (C) 2019, Google Inc.\n> > + *\n> > + * v4l2_subdevice_test.h - VIMC-based V4L2 subdevice test\n> > + */\n> > +\n> > +#ifndef __LIBCAMERA_V4L2_SUBDEVICE_TEST_H__\n> > +#define __LIBCAMERA_V4L2_SUBDEVICE_TEST_H__\n> > +\n> > +#include <libcamera/buffer.h>\n> > +\n> > +#include \"device_enumerator.h\"\n> > +#include \"media_device.h\"\n> > +#include \"test.h\"\n> > +#include \"v4l2_subdevice.h\"\n> > +\n> > +using namespace libcamera;\n> > +\n> > +class V4L2SubdeviceTest : public Test\n> > +{\n> > +public:\n> > +\tV4L2SubdeviceTest()\n> > +\t\t: scaler_(nullptr){};\n> > +\n> > +protected:\n> > +\tint init() override;\n> > +\tvirtual int run() = 0;\n>\n> No need for this.\n\nOh, I had a linker error when I removed this which is now gone, so I\nsuppose it was something different. I'll remove it.\n>\n> With these small issues fixed,\n>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nThanks\n  j\n\n>\n> > +\tvoid cleanup() override;\n> > +\n> > +\tstd::unique_ptr<DeviceEnumerator> enumerator_;\n> > +\tstd::shared_ptr<MediaDevice> media_;\n> > +\tV4L2Subdevice *scaler_;\n> > +};\n> > +\n> > +#endif /* __LIBCAMERA_V4L2_SUBDEVICE_TEST_H__ */\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net\n\t[217.70.183.198])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 17533610B2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  1 Mar 2019 10:25:13 +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 relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 5F5E3C0005;\n\tFri,  1 Mar 2019 09:25:11 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Fri, 1 Mar 2019 10:25:41 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<20190301092541.f5ulvyekymntbr7a@uno.localdomain>","References":"<20190228200151.2948-1-jacopo@jmondi.org>\n\t<20190228200151.2948-8-jacopo@jmondi.org>\n\t<20190228220920.GO7811@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"nfrlgbmztpvtvglb\"","Content-Disposition":"inline","In-Reply-To":"<20190228220920.GO7811@pendragon.ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH v5 7/9] test: v4l2_subdevice: Add\n\tformat handling test","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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, 01 Mar 2019 09:25:13 -0000"}}]