[libcamera-devel] [PATCH 3/5] test: v4l2_device: Allow each test to specify which device and entity to test
Niklas Söderlund
niklas.soderlund at ragnatech.se
Sat May 11 11:53:37 CEST 2019
Hi Laurent,
Thanks for your feedback.
On 2019-05-11 05:40:33 +0300, Laurent Pinchart wrote:
> Hi Niklas,
>
> Thank you for the patch.
>
> On Wed, May 08, 2019 at 06:58:12PM +0200, Niklas Söderlund wrote:
> > Prepare for different tests which implements V4L2DeviceTest to specify
> > which media device and entity they wish to test. There is no functional
> > changes, all tests still use vivid to perform there tests.
> >
> > Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
>
> I wonder if it would be a good idea to offer a choice of preselected
> devices instead of offering full flexibility, but we can implement that
> later if it becomes necessary.
I wonder something similar when working on this. My line of thought was
to split the v4l2_device in a vimc and a vivid group and provide two
base classes.
Then I realised we only have one test which requires vivid and thought
such a split was overkill. I agree as we gain more tests we should
probably create a bit stricter base class which could provide helpers to
interact which each of the two pipelines.
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
>
> > ---
> > test/v4l2_device/buffer_sharing.cpp | 5 ++---
> > test/v4l2_device/capture_async.cpp | 2 +-
> > test/v4l2_device/double_open.cpp | 3 +++
> > test/v4l2_device/formats.cpp | 3 +++
> > test/v4l2_device/request_buffers.cpp | 4 ++++
> > test/v4l2_device/stream_on_off.cpp | 3 +++
> > test/v4l2_device/v4l2_device_test.cpp | 6 +++---
> > test/v4l2_device/v4l2_device_test.h | 6 ++++--
> > 8 files changed, 23 insertions(+), 9 deletions(-)
> >
> > diff --git a/test/v4l2_device/buffer_sharing.cpp b/test/v4l2_device/buffer_sharing.cpp
> > index 09695239ee4b9e80..e63ddff856894130 100644
> > --- a/test/v4l2_device/buffer_sharing.cpp
> > +++ b/test/v4l2_device/buffer_sharing.cpp
> > @@ -23,9 +23,8 @@ class BufferSharingTest : public V4L2DeviceTest
> > {
> > public:
> > BufferSharingTest()
> > - : output_(nullptr), framesCaptured_(0), framesOutput_(0)
> > - {
> > - }
> > + : V4L2DeviceTest("vivid", "vivid-000-vid-cap"),
> > + output_(nullptr), framesCaptured_(0), framesOutput_(0) {}
> >
> > protected:
> > int init()
> > diff --git a/test/v4l2_device/capture_async.cpp b/test/v4l2_device/capture_async.cpp
> > index 2a41b11e95e77dac..fd428ff909f32999 100644
> > --- a/test/v4l2_device/capture_async.cpp
> > +++ b/test/v4l2_device/capture_async.cpp
> > @@ -18,7 +18,7 @@ class CaptureAsyncTest : public V4L2DeviceTest
> > {
> > public:
> > CaptureAsyncTest()
> > - : frames(0){};
> > + : V4L2DeviceTest("vivid", "vivid-000-vid-cap"), frames(0) {}
> >
> > void receiveBuffer(Buffer *buffer)
> > {
> > diff --git a/test/v4l2_device/double_open.cpp b/test/v4l2_device/double_open.cpp
> > index 7ec80a60f57ee036..b402de04fca5ddbb 100644
> > --- a/test/v4l2_device/double_open.cpp
> > +++ b/test/v4l2_device/double_open.cpp
> > @@ -13,6 +13,9 @@ namespace {
> >
> > class DoubleOpen : public V4L2DeviceTest
> > {
> > +public:
> > + DoubleOpen()
> > + : V4L2DeviceTest("vivid", "vivid-000-vid-cap") {}
> > protected:
> > int run()
> > {
> > diff --git a/test/v4l2_device/formats.cpp b/test/v4l2_device/formats.cpp
> > index 72676c9d334a69b0..3ac47f5cc665b62b 100644
> > --- a/test/v4l2_device/formats.cpp
> > +++ b/test/v4l2_device/formats.cpp
> > @@ -17,6 +17,9 @@ using namespace libcamera;
> >
> > class Format : public V4L2DeviceTest
> > {
> > +public:
> > + Format()
> > + : V4L2DeviceTest("vivid", "vivid-000-vid-cap") {}
> > protected:
> > int run()
> > {
> > diff --git a/test/v4l2_device/request_buffers.cpp b/test/v4l2_device/request_buffers.cpp
> > index 938d4f85d5a1e711..794b083eb84d8d2e 100644
> > --- a/test/v4l2_device/request_buffers.cpp
> > +++ b/test/v4l2_device/request_buffers.cpp
> > @@ -9,6 +9,10 @@
> >
> > class RequestBuffersTest : public V4L2DeviceTest
> > {
> > +public:
> > + RequestBuffersTest()
> > + : V4L2DeviceTest("vivid", "vivid-000-vid-cap") {}
> > +
> > protected:
> > int run()
> > {
> > diff --git a/test/v4l2_device/stream_on_off.cpp b/test/v4l2_device/stream_on_off.cpp
> > index ea1b3f5bd5a4cbea..4902d5fd6d58a73d 100644
> > --- a/test/v4l2_device/stream_on_off.cpp
> > +++ b/test/v4l2_device/stream_on_off.cpp
> > @@ -9,6 +9,9 @@
> >
> > class StreamOnStreamOffTest : public V4L2DeviceTest
> > {
> > +public:
> > + StreamOnStreamOffTest()
> > + : V4L2DeviceTest("vivid", "vivid-000-vid-cap") {}
> > protected:
> > int run()
> > {
> > diff --git a/test/v4l2_device/v4l2_device_test.cpp b/test/v4l2_device/v4l2_device_test.cpp
> > index 833038d56ea4631d..ee5a8e009bef2a5e 100644
> > --- a/test/v4l2_device/v4l2_device_test.cpp
> > +++ b/test/v4l2_device/v4l2_device_test.cpp
> > @@ -39,14 +39,14 @@ int V4L2DeviceTest::init()
> > return TestFail;
> > }
> >
> > - DeviceMatch dm("vivid");
> > - dm.add("vivid-000-vid-cap");
> > + DeviceMatch dm(driver_);
> > + dm.add(entity_);
> >
> > media_ = enumerator_->search(dm);
> > if (!media_)
> > return TestSkip;
> >
> > - MediaEntity *entity = media_->getEntityByName("vivid-000-vid-cap");
> > + MediaEntity *entity = media_->getEntityByName(entity_);
> > if (!entity)
> > return TestSkip;
> >
> > diff --git a/test/v4l2_device/v4l2_device_test.h b/test/v4l2_device/v4l2_device_test.h
> > index c476d3c05e79747a..651c005f4e5485e6 100644
> > --- a/test/v4l2_device/v4l2_device_test.h
> > +++ b/test/v4l2_device/v4l2_device_test.h
> > @@ -22,8 +22,8 @@ using namespace libcamera;
> > class V4L2DeviceTest : public Test
> > {
> > public:
> > - V4L2DeviceTest()
> > - : capture_(nullptr)
> > + V4L2DeviceTest(const char *driver, const char *entity)
> > + : driver_(driver), entity_(entity), capture_(nullptr)
> > {
> > }
> >
> > @@ -31,6 +31,8 @@ protected:
> > int init();
> > void cleanup();
> >
> > + std::string driver_;
> > + std::string entity_;
> > std::unique_ptr<DeviceEnumerator> enumerator_;
> > std::shared_ptr<MediaDevice> media_;
> > V4L2Device *capture_;
> > --
> > 2.21.0
> >
> > _______________________________________________
> > libcamera-devel mailing list
> > libcamera-devel at lists.libcamera.org
> > https://lists.libcamera.org/listinfo/libcamera-devel
>
> --
> Regards,
>
> Laurent Pinchart
--
Regards,
Niklas Söderlund
More information about the libcamera-devel
mailing list