libcamera/test/list-cameras.cpp
Laurent Pinchart 03815afdc8 test: Rename list test to list-cameras
The list test generates a list binary in the test directory, which
conflicts with the C++ std::list header of the same name. The binary
gets included instead of the header file, breaking compilation.

Rename the test to avoid this.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-08 16:23:16 +02:00

49 lines
629 B
C++

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) 2018, Google Inc.
*
* list.cpp - camera list tests
*/
#include <iostream>
#include <libcamera/camera_manager.h>
#include "test.h"
using namespace std;
using namespace libcamera;
class ListTest : public Test
{
protected:
int init()
{
cm = CameraManager::instance();
cm->start();
return 0;
}
int run()
{
unsigned int count = 0;
for (auto name : cm->list()) {
cout << "- " << name << endl;
count++;
}
return count ? 0 : -ENODEV;
}
void cleanup()
{
cm->stop();
}
private:
CameraManager *cm;
};
TEST_REGISTER(ListTest)