[devhelp] meson: build unit tests
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp] meson: build unit tests
- Date: Sun, 11 Mar 2018 17:49:31 +0000 (UTC)
commit cb07ce201fcd08448895e51f66fd56e114941075
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sun Mar 11 11:31:00 2018 +0100
meson: build unit tests
devhelp/meson.build | 23 ++++++++++++++++-------
meson.build | 1 +
unit-tests/meson.build | 15 +++++++++++++++
3 files changed, 32 insertions(+), 7 deletions(-)
---
diff --git a/devhelp/meson.build b/devhelp/meson.build
index 5c3839d..6b8c1d9 100644
--- a/devhelp/meson.build
+++ b/devhelp/meson.build
@@ -48,15 +48,24 @@ libdevhelp_enums = GNOME.mkenums_simple('dh-enum-types',
sources : libdevhelp_public_headers,
install_header : true,
install_dir : install_headers_fulldir)
+libdevhelp_enum_header = libdevhelp_enums[1]
+
+libdevhelp_static = static_library('devhelp-static',
+ [libdevhelp_public_c_files,
+ libdevhelp_private_c_files,
+ libdevhelp_enums],
+ include_directories : [CONFIG_H_INCLUDE_DIR,
+ ROOT_INCLUDE_DIR],
+ dependencies : DEVHELP_DEPS)
+
+# For unit tests, to be able to test private functions.
+LIBDEVHELP_STATIC_DEP = declare_dependency(sources : libdevhelp_enum_header,
+ link_with : libdevhelp_static,
+ include_directories : [ROOT_INCLUDE_DIR],
+ dependencies : DEVHELP_DEPS)
library('devhelp-@0@'.format(DEVHELP_API_VERSION),
- [libdevhelp_public_headers,
- libdevhelp_public_c_files,
- libdevhelp_private_headers,
- libdevhelp_private_c_files,
- libdevhelp_enums],
- dependencies : DEVHELP_DEPS,
- include_directories : [CONFIG_H_INCLUDE_DIR, ROOT_INCLUDE_DIR],
+ link_with : libdevhelp_static,
install : true)
install_headers(libdevhelp_public_headers,
diff --git a/meson.build b/meson.build
index b9b420c..4c0ff0c 100644
--- a/meson.build
+++ b/meson.build
@@ -99,3 +99,4 @@ add_global_arguments(supported_warning_cflags, language : 'c')
##### end CFLAGS
subdir('devhelp')
+subdir('unit-tests')
diff --git a/unit-tests/meson.build b/unit-tests/meson.build
new file mode 100644
index 0000000..debf7d2
--- /dev/null
+++ b/unit-tests/meson.build
@@ -0,0 +1,15 @@
+unit_tests = [
+ 'test-completion',
+ 'test-link',
+ 'test-search-context',
+ 'test-util'
+]
+
+foreach unit_test : unit_tests
+ exe = executable(unit_test,
+ unit_test + '.c',
+ include_directories : ROOT_INCLUDE_DIR,
+ dependencies : [DEVHELP_DEPS, LIBDEVHELP_STATIC_DEP])
+
+ test(unit_test, exe)
+endforeach
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]