[libcamera-devel] [PATCH 1/5] test: Move test objects to libtest

jacopo mondi jacopo at jmondi.org
Fri Dec 21 16:09:24 CET 2018


Hi Kieran,

On Fri, Dec 21, 2018 at 08:13:07AM +0000, Kieran Bingham wrote:
> 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 at ideasonboard.com>
> ---
>  test/libtest/meson.build    |  7 +++++++
>  test/{ => libtest}/test.cpp |  0
>  test/{ => libtest}/test.h   |  0
>  test/meson.build            | 20 ++++++++++++++------
>  4 files changed, 21 insertions(+), 6 deletions(-)
>  create mode 100644 test/libtest/meson.build
>  rename test/{ => libtest}/test.cpp (100%)
>  rename test/{ => libtest}/test.h (100%)
>
> diff --git a/test/libtest/meson.build b/test/libtest/meson.build
> new file mode 100644
> index 000000000000..b998154dd8d3
> --- /dev/null
> +++ b/test/libtest/meson.build
> @@ -0,0 +1,7 @@
> +libtest_sources = files([
> +    'test.cpp',
> +])
> +
> +libtest = static_library('libtest', libtest_sources)
> +
> +libtest_includes = include_directories('.')
> diff --git a/test/test.cpp b/test/libtest/test.cpp
> similarity index 100%
> rename from test/test.cpp
> rename to test/libtest/test.cpp
> diff --git a/test/test.h b/test/libtest/test.h
> similarity index 100%
> rename from test/test.h
> rename to test/libtest/test.h
> diff --git a/test/meson.build b/test/meson.build
> index da0aea9678d1..50ec11853203 100644
> --- a/test/meson.build
> +++ b/test/meson.build
> @@ -1,11 +1,19 @@
> -libtest_sources = files([
> -    'test.cpp',
> -])
> +subdir('libtest')
>
> -libtest = static_library('libtest', libtest_sources)
> +test_libraries = [libcamera, libtest]
> +
> +test_includes_public = [
> +  libtest_includes,
> +  libcamera_includes,
> +]
> +
> +test_includes_internal = [

That's not really 'internal' if it includes the public includes :)

> +  test_includes_public,
> +  libcamera_internal_includes,
> +]
>
>  test_init = executable('test_init', 'init.cpp',
> -                       link_with : libcamera,
> -                       include_directories : libcamera_includes)
> +                       link_with : test_libraries,
> +                       include_directories : test_includes_public)

What about a test/tests/ directory? Or do we expect to add all tests
under test/ itself? Eg. test/libcamera/media_device_test.cpp ?

Thanks
  j
>
>  test('Initialisation test', test_init)
> --
> 2.17.1
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20181221/262393d2/attachment.sig>


More information about the libcamera-devel mailing list