From 29b11bb1586f8f3722e27ec5e1cfbf8c43134d3a Mon Sep 17 00:00:00 2001 From: Victor Toso Date: Wed, 29 Aug 2018 11:52:25 +0200 Subject: meson: build and run unit tests Test builds were missing in meson. Building and running with a 10s timeout (instead of 30s as default). Also created a include_directory for GrlNet library to be included in tests. Signed-off-by: Victor Toso --- libs/net/meson.build | 11 ++++++++++- meson.build | 1 + tests/meson.build | 21 +++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 tests/meson.build diff --git a/libs/net/meson.build b/libs/net/meson.build index de9b6a6..6d340e9 100644 --- a/libs/net/meson.build +++ b/libs/net/meson.build @@ -25,6 +25,11 @@ configure_file(output: 'config.h', install_headers(grlnet_headers, subdir: '@0@/net'.format(grl_name)) +libgrlnet_inc = include_directories([ + '..', +]) + + libgrlnet = shared_library('grlnet-@0@'.format(grl_majorminor), sources: grlnet_sources + grlnet_priv_headers, soversion: soversion, @@ -32,7 +37,11 @@ libgrlnet = shared_library('grlnet-@0@'.format(grl_majorminor), install: true, c_args: '-DHAVE_CONFIG_H', dependencies: [libsoup_dep, libgrl_dep], - include_directories: libgrl_inc) + include_directories: [libgrl_inc, libgrlnet_inc]) + +libgrlnet_dep = declare_dependency(link_with: libgrlnet, + include_directories: [libgrl_inc, libgrlnet_inc], + dependencies: [libsoup_dep, libgrl_dep]) if enable_gir grlnet_gir = gnome.generate_gir(libgrlnet, diff --git a/meson.build b/meson.build index c170ee6..1858fbe 100644 --- a/meson.build +++ b/meson.build @@ -124,5 +124,6 @@ subdir('libs') subdir('bindings') subdir('po') subdir('tools') +subdir('tests') subdir('examples') subdir('doc') diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 0000000..605ad56 --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,21 @@ +# meson.build +# +# Author: Victor Toso +# +# Copyright (C) 2018 Grilo Project + +tests = [ + 'autoptr', + 'lib-net', + 'registry', +] + +foreach t: tests + source = t + '.c' + exe = executable(t, + source, + install: false, + link_with: [libgrl, libgrlnet], + dependencies: [libgrl_dep, libgrlnet_dep]) + test(t, exe, timeout:10) +endforeach -- cgit v1.2.1