[evolution-ews] Use tests/ as `make check` tests, if enabled with ENABLE_TESTS
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] Use tests/ as `make check` tests, if enabled with ENABLE_TESTS
- Date: Thu, 13 Oct 2016 18:03:20 +0000 (UTC)
commit 1db978ceb4c4049041c5bb886f1c04a2b6f70f24
Author: Milan Crha <mcrha redhat com>
Date: Thu Oct 13 20:01:42 2016 +0200
Use tests/ as `make check` tests, if enabled with ENABLE_TESTS
Also did some changes to be able to run them from within the build tree.
tests/CMakeLists.txt | 7 ++++++-
tests/ews-test-common.c | 2 +-
tests/ews-test-timezones.c | 22 ++++++++++++++++------
3 files changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 119a0a3..378b8d2 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -17,10 +17,14 @@ macro(add_ews_test _name)
${DEPENDENCIES}
)
+ set_target_properties (${_name} PROPERTIES
+ BUILD_WITH_INSTALL_RPATH ON
+ )
+
target_compile_definitions(${_name} PRIVATE
-DG_LOG_DOMAIN=\"${_name}\"
-DTEST_FILE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"
- -DCALENDAR_MODULE_DIR=\"${CMAKE_SOURCE_DIR}/src/calendar/\"
+ -DCALENDAR_MODULE_DIR=\"${CMAKE_BINARY_DIR}/src/calendar/\"
)
target_compile_options(${_name} PUBLIC
@@ -46,6 +50,7 @@ macro(add_ews_test _name)
${UHTTPMOCK_LDFLAGS}
)
+ add_check_test(${_name})
endmacro(add_ews_test)
add_ews_test(ews-test-camel ews-test-camel.c)
diff --git a/tests/ews-test-common.c b/tests/ews-test-common.c
index eefd704..448f142 100644
--- a/tests/ews-test-common.c
+++ b/tests/ews-test-common.c
@@ -349,7 +349,7 @@ ews_test_server_set_trace_directory (UhmServer *server,
gchar *path;
GFile *trace_directory;
- path = g_strdup_printf (TEST_FILE_DIR "traces/%s/%s", version, tests);
+ path = g_strdup_printf (TEST_FILE_DIR "/traces/%s/%s", version, tests);
trace_directory = g_file_new_for_path (path);
g_free (path);
uhm_server_set_trace_directory (server, trace_directory);
diff --git a/tests/ews-test-timezones.c b/tests/ews-test-timezones.c
index 68df6ae..36f680f 100644
--- a/tests/ews-test-timezones.c
+++ b/tests/ews-test-timezones.c
@@ -307,28 +307,37 @@ int main (int argc,
gint retval;
GList *etds, *l;
UhmServer *server;
- gchar *module_path = NULL;
+ const gchar *module_path;
GModule *module = NULL;
retval = ews_test_init (argc, argv);
- if (retval < 0)
+ if (retval < 0) {
+ g_printerr ("Failed to initialize test\n");
goto exit;
+ }
- if (!g_module_supported ())
+ if (!g_module_supported ()) {
+ g_printerr ("GModule not supported\n");
+ retval = 1;
goto exit;
+ }
- module_path = g_module_build_path (CALENDAR_MODULE_DIR, "libecalbackendews");
+ module_path = CALENDAR_MODULE_DIR "libecalbackendews.so";
module = g_module_open (module_path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
- if (module == NULL)
+ if (module == NULL) {
+ g_printerr ("Failed to load module '%s': %s\n", module_path, g_module_error ());
+ retval = 2;
goto exit;
+ }
if (!g_module_symbol (
module,
"e_cal_backend_ews_populate_windows_zones",
(gpointer *) &populate_windows_zones)) {
g_printerr ("\n%s\n", g_module_error ());
+ retval = 3;
goto exit;
}
@@ -337,6 +346,7 @@ int main (int argc,
"e_cal_backend_ews_tz_util_get_msdn_equivalent",
(gpointer *) &ical_to_msdn_equivalent)) {
g_printerr ("\n%s\n", g_module_error ());
+ retval = 4;
goto exit;
}
@@ -345,6 +355,7 @@ int main (int argc,
"e_cal_backend_ews_convert_calcomp_to_xml",
(gpointer *) &convert_calcomp_to_xml)) {
g_printerr ("\n%s\n", g_module_error ());
+ retval = 5;
goto exit;
}
@@ -382,7 +393,6 @@ int main (int argc,
g_signal_handlers_disconnect_by_func (server, server_notify_resolver_cb, l->data);
exit:
- g_free (module_path);
if (module != NULL)
g_module_close (module);
if (builtin_timezones != NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]