Commit graph

528 commits

Author SHA1 Message Date
Kieran Bingham
74fb6ec3dc test: timer: Add a 32 bit wraparound test
Add a test which catches a timer running longer than the nanosecond
resolution of 32 bits.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-17 21:31:33 +00:00
Kieran Bingham
b523982920 test: timer: Initialise all variables
The ManagedTimer does not initialise the integer 'interval_' variable.

This is set before used, and should not break - but for completeness
(and to cover static analysers) initialise the variable in the
initialiser list.

Fixes: 034ea86802 ("test: Add timer test")

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-17 21:31:28 +00:00
Jacopo Mondi
d833c1d39e test: media_device: Add link handling test
Add a test unit that exercise link handling on the VIMC media graph.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-14 17:54:56 +01:00
Jacopo Mondi
d85767a8c8 test: media_device: Make MediaDeviceTest a MediaDevicePrintTest
As a new class for test link handling will be added as a separate test,
it makes no sense to have a generic "MediaDeviceTest" class. Rename it
in "MediaDevicePrintTest", and make it run only printing test.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-14 17:54:56 +01:00
Kieran Bingham
4bf28fa225 test: media_device: Convert to foreach
Prevent duplication of boilerplate code as the suite grows by
establishing the foreach pattern in the media_device test suite.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-14 17:54:56 +01:00
Laurent Pinchart
aed8c7823e test: Add event notifier test
The test covers read notification and notifier enable/disable.

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
Laurent Pinchart
034ea86802 test: Add timer test
The test covers timer start, timeout, restart after completion, restart
before completion and multiple timers.

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
Laurent Pinchart
f151895c3f test: Add signal/slot test
The test covers signal connection, disconnection through all the
provided methods, emission, parameters, and connection of a signal to
multiple slots.

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
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
Laurent Pinchart
8b0de29c41 libcamera: camera_manager: Make the class a singleton
There can only be a single camera manager instance in the application.
Creating it as a singleton helps avoiding mistakes. It also allows the
camera manager to be used as a storage of global data, such as the
future event dispatcher.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-08 16:23:16 +02:00
Kieran Bingham
b403cb4550 test: Move include definitions to libtest
With the libtest functionality moved to its own library folder, the
definitions for test includes should reasonably live there too.

The libtest subdir should always remain the first entry in the
test/meson.build file.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-02 11:08:20 +02:00
Kieran Bingham
5802259b3c test: Use foreach iterators to simplify definitions
Create two arrays, to contain public and internal test targets, and use
the foreach iterators to automatically generate test output targets for
each entry in each array.

The public tests array is linked only against public libcamera headers,
while tests declared in the internal_tests will have access to
non-public API headers from within the libcamera sources.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-02 11:07:27 +02:00
Kieran Bingham
a9fe3adc4f test: media_device: Move test definition
The test definition for the media_device_test executable should be
located with the exectuable definition.

Move it to the meson.build of that test suite subdir.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-02 11:05:26 +02:00
Laurent Pinchart
7e9e508093 libcamera: Remove libcamera class
The class was just a placeholder, now that we have other objects
defined, remove it along with the associated test.

The libcamera/libcamera.h header is kept as a shortcut to include the
whole libcamera public API.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-02 03:28:19 +02:00
Kieran Bingham
e3694a3ae8 test: libtest: Return all non-zero init values
A skipped test is currently defined as returning 77. If this is returned
by the init stage, currently the execute call will continue on to the
run stage.

Correct this such that any non-zero return code from the init phase will
abort the test.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-01 18:24:22 +02:00
Kieran Bingham
e3bb826e66 test: libtest: Add test return codes
The meson test infrastructure uses return codes to determine test
results. Define these values for use in tests.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[Use an enum instead of macros for test return codes.]
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-01 18:24:22 +02:00
Kieran Bingham
3900b0771e test: Move test objects to libtest
Create a subdirectory to contain the libtest helper library.

Define two variables to clarify when tests are aimed at public or
internal components.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-01 18:24:22 +02:00
Jacopo Mondi
b43f56c46d test: Add media device test
Add media device test infrastructure and an intial test that
print out the media devices available in the system.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2018-12-31 19:01:35 +01:00
Niklas Söderlund
20d15d9dc4 tests: add test to list all cameras in the system
Add simple test which lists all cameras detected in the system. The test
fails if no camera can be found.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2018-12-31 00:58:32 +01:00
Niklas Söderlund
53b549b631 tests: call the derived Test class cleanup() function
Calling the cleanup() function in the base class Test destructor only
calls the base class empty cleanup() function, not the overloaded one.
This results in tests not cleaning up after themself. Solve this by
explicitly calling the cleanup() function from execute().

This was discovered while running valgrind on tests where objects where
allocated in init() and freed in cleanup().

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-21 06:47:27 +02:00
Laurent Pinchart
4114a93dff tests: Add a base Test class
The base Test class is meant to provide infrastructure common to all
tests. It is very limited for now, and should be extended with at least
logging and assertion handling.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2018-12-21 06:44:55 +02:00
Laurent Pinchart
cc7d204b2c libcamera: Use the logger instead of cout
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2018-12-06 16:43:45 +02:00
Laurent Pinchart
913b3ee817 Overhaul the directory structure
In order to match the directory structure of traditional projects,
rename the top-level lib/ directory to src/libcamera/. Other libraries
developed as part of the project will later find a home in src/.

Split the libcamera header files in three categories: public headers
describing the public API in include/libcamera/, internal headers
describing the internal API in src/libcamera/include/, and private
headers local to one or a small number of compilation units along the
corresponding .cpp files. As no internal header exists yet the
src/libcamera/include/ directory is created empty as the build system
would fail otherwise.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2018-12-06 16:34:01 +02:00
Laurent Pinchart
0713202dc0 Add boilerplate headers comments and include guards
The initial main.cpp and libcamera.h files are missing boilerplate
header comments. libcamera.h is further missing include guards. Add
them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2018-12-06 16:33:36 +02:00
Kieran Bingham
df77f99386 meson: Replace tabs for spaces
Tabs are disliked within the meson build system.
Replace indentation by spaces, in all existing locations.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2018-11-28 11:08:35 +00:00
Kieran Bingham
66051636c5 include: Install include files
The include directory was defined but not installed.

Add it to the meson build structure to incorporate it as part of the
library install.

To facilitate the same include paths in our internal includes, update
the structure for headers to match the install structure.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2018-11-27 12:10:57 +00:00
Kieran Bingham
cc4de52524 test: Register the initialisation test with meson
Register the test so that it can integrate with the meson test
framework.

To execute the test suite, use 'ninja test'.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2018-11-22 15:24:56 +00:00
Kieran Bingham
708d3c9fc0 build: Provide initial meson infrastructure
Define the starting points for the libcamera build using
meson and ninja build components.

An initial 'dummy' library class is created, and a test binary links
against the shared library calling it's init_lib() function.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2018-10-24 12:22:19 +01:00