test: v4l2_device: Allow each test to specify which device and entity to test
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@ragnatech.se> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
e1e440aad6
commit
4f8ba02bbc
8 changed files with 23 additions and 9 deletions
|
@ -23,9 +23,8 @@ class BufferSharingTest : public V4L2DeviceTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BufferSharingTest()
|
BufferSharingTest()
|
||||||
: output_(nullptr), framesCaptured_(0), framesOutput_(0)
|
: V4L2DeviceTest("vivid", "vivid-000-vid-cap"),
|
||||||
{
|
output_(nullptr), framesCaptured_(0), framesOutput_(0) {}
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int init()
|
int init()
|
||||||
|
|
|
@ -18,7 +18,7 @@ class CaptureAsyncTest : public V4L2DeviceTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CaptureAsyncTest()
|
CaptureAsyncTest()
|
||||||
: frames(0){};
|
: V4L2DeviceTest("vivid", "vivid-000-vid-cap"), frames(0) {}
|
||||||
|
|
||||||
void receiveBuffer(Buffer *buffer)
|
void receiveBuffer(Buffer *buffer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,9 @@ namespace {
|
||||||
|
|
||||||
class DoubleOpen : public V4L2DeviceTest
|
class DoubleOpen : public V4L2DeviceTest
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
DoubleOpen()
|
||||||
|
: V4L2DeviceTest("vivid", "vivid-000-vid-cap") {}
|
||||||
protected:
|
protected:
|
||||||
int run()
|
int run()
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,6 +17,9 @@ using namespace libcamera;
|
||||||
|
|
||||||
class Format : public V4L2DeviceTest
|
class Format : public V4L2DeviceTest
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
Format()
|
||||||
|
: V4L2DeviceTest("vivid", "vivid-000-vid-cap") {}
|
||||||
protected:
|
protected:
|
||||||
int run()
|
int run()
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,10 @@
|
||||||
|
|
||||||
class RequestBuffersTest : public V4L2DeviceTest
|
class RequestBuffersTest : public V4L2DeviceTest
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
RequestBuffersTest()
|
||||||
|
: V4L2DeviceTest("vivid", "vivid-000-vid-cap") {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int run()
|
int run()
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
|
|
||||||
class StreamOnStreamOffTest : public V4L2DeviceTest
|
class StreamOnStreamOffTest : public V4L2DeviceTest
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
StreamOnStreamOffTest()
|
||||||
|
: V4L2DeviceTest("vivid", "vivid-000-vid-cap") {}
|
||||||
protected:
|
protected:
|
||||||
int run()
|
int run()
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,14 +39,14 @@ int V4L2DeviceTest::init()
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceMatch dm("vivid");
|
DeviceMatch dm(driver_);
|
||||||
dm.add("vivid-000-vid-cap");
|
dm.add(entity_);
|
||||||
|
|
||||||
media_ = enumerator_->search(dm);
|
media_ = enumerator_->search(dm);
|
||||||
if (!media_)
|
if (!media_)
|
||||||
return TestSkip;
|
return TestSkip;
|
||||||
|
|
||||||
MediaEntity *entity = media_->getEntityByName("vivid-000-vid-cap");
|
MediaEntity *entity = media_->getEntityByName(entity_);
|
||||||
if (!entity)
|
if (!entity)
|
||||||
return TestSkip;
|
return TestSkip;
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,8 @@ using namespace libcamera;
|
||||||
class V4L2DeviceTest : public Test
|
class V4L2DeviceTest : public Test
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
V4L2DeviceTest()
|
V4L2DeviceTest(const char *driver, const char *entity)
|
||||||
: capture_(nullptr)
|
: driver_(driver), entity_(entity), capture_(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@ protected:
|
||||||
int init();
|
int init();
|
||||||
void cleanup();
|
void cleanup();
|
||||||
|
|
||||||
|
std::string driver_;
|
||||||
|
std::string entity_;
|
||||||
std::unique_ptr<DeviceEnumerator> enumerator_;
|
std::unique_ptr<DeviceEnumerator> enumerator_;
|
||||||
std::shared_ptr<MediaDevice> media_;
|
std::shared_ptr<MediaDevice> media_;
|
||||||
V4L2Device *capture_;
|
V4L2Device *capture_;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue