Commit graph

83 commits

Author SHA1 Message Date
Paul Elder
a25c937f8a test: add logging API test
Test that setting the log file and log levels works from an application
point of view. The test uses the internal logging mechanism as well,
just to write to the log file.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-07-12 13:46:48 +09:00
Laurent Pinchart
a1b1551446 test: Add test case for signal delivery across threads
The test case creates a receiver inheriting from Object, connects a
signal to one of its slot, moves the receiver to a different thread,
emits the signal and verifies that it gets delivered in the correct
thread with the expected value.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-07-11 11:57:37 +03:00
Laurent Pinchart
851eaeb9cd test: Add Message test case
The Message class test creates a receiver inheriting from Object, moves
it to a different thread, sends a message to the receiver and verifies
that the message is delivered in the correct thread.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-07-11 11:57:37 +03:00
Laurent Pinchart
a7fb1db1fa test: Add Thread test cases
The Thread test case verifies that

- a Thread instance is created for the main thread
- a new Thread can be created, started, and stopped

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-07-11 11:57:37 +03:00
Kieran Bingham
4cbf83da40 libcamera: test: Add ControlValue test
Add initial basic testing for the new ControlValue class.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-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>
2019-07-02 16:59:46 +03:00
Niklas Söderlund
a00fdabacd test: ipc: unix: Add test for IPCUnixSocket
Test that the IPC supports sending data and file descriptors over the
IPC medium. To be able to execute the test two parts are needed, one
to drive the test and act as the libcamera (master) and a one to act as
the IPA (slave).

The master drives the testing posting requests to the slave to process
and sometimes respond to. A few different tests are performed.

- Master sends an array to the slave which responds with a reversed copy
  of the array. The master verifies that a reversed array is returned.

- Master tries to send an empty message making sure that the send call
  fails.

- Master sends a list of file descriptors and ask the slave to calculate
  and respond with the sum of the size of the files. The master verifies
  that the calculated size is correct.

- Master sends a pre-computed size and a list of file descriptors and
  asks the slave to verify that the pre-computed size matches the sum of
  the size of the file descriptors.

- Master sends two file descriptors and asks the slave to join the file
  contents in a new file and respond with its file descriptor. The
  master then verifies that the content of the returned file descriptor
  matches the order of the original two files.

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>
2019-07-02 02:25:59 +03:00
Jacopo Mondi
3a6c4bd146 libcamera: Rename V4L2Device to V4L2VideoDevice
In preparation of creating a new V4L2Device base class, rename
V4L2Device to V4L2VideoDevice.

This is a project wide rename without any intended functional change.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-19 15:46:44 +02:00
Niklas Söderlund
5ed3a89480 test: stream: Add test for StreamFormat
Test that both discrete and range based stream format descriptions
result in good discrete frame sizes. The range based stream formats
needs to be fitted with a table of resolutions inside libcamera so if
that table is updated this test might need to be updated.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-19 12:25:12 +02:00
Laurent Pinchart
b2b3599b5b tests: Add CameraSensor class test
Add a test to verify media bus codes, sizes and resolution retrieval
through the CameraSensor API based on the Sensor A in the vimc pipeline.
Also check that the getFormat() method returns the expected media bus
code and size.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-06-12 15:10:38 +03:00
Laurent Pinchart
3fac104158 meson: Create and use a dependency for libcamera and its headers
Instead of manually adding the libcamera library and include path to
every target that requires it, declare a dependency that groups the
headers as source, the library and the include path, and use it through
the project. This simplifies handling of the dependency.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-05-23 13:56:33 +03:00
Paul Elder
d8de003a04 test: ipa: add IPAModule tests
Add tests to test the the IPAModule class, for loading the IPA module
info from IPA module .so shared objects, with modules written in both C
and C++.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-05-21 18:35:11 -04:00
Laurent Pinchart
2059b857e1 test: geometry: Add tests for Size class comparison operators
Add a test that exercises all the comparison operators for the Size
class.

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-04-18 18:13:10 +03:00
Niklas Söderlund
86a1900657 test: camera: Add read default configuration test
Add a test to verify reading the default configuration from a camera
works.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-03-14 15:59:00 +01:00
Jacopo Mondi
7f4ce94ad9 test: v4l2_subdevice: Add format handling test
Add test for video format get and set operations on V4L2Subdevice class.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-03-01 12:33:17 +01:00
Laurent Pinchart
83c73c39c5 tests: Test event dispatcher interruption by signal
Add a test to verify that the event dispatcher correctly restarts event
processing when interrupted by a signal. The test currently fails as
this feature isn't implemented.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-23 18:51:56 +02:00
Jacopo Mondi
e410062003 test: pipeline: IPU3: Add IPU3 pipeline test
Add test for the Intel IPU3 pipeline that lists all the cameras
registered in the system and verifies the result matches the expected.

This test is meant to be run on IPU3 platforms, it gets skipped
otherwise.

Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-22 11:16:28 +01:00
Kieran Bingham
479264dfca test: v4l2_device: Add test suite and initial test
Provide a base class to construct a v4l2_device object for further tests
and an initial test which validates the FD handle can not be leaked.

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>
2019-01-17 21:55:27 +00: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
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
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
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
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
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
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