From 9c8b7b001ea5a6639babe59d96701fd5e0509c2b Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 12 Aug 2016 08:05:46 +0200 Subject: [PATCH] systemd/tests: don't link test-systemd against libNetworkManagerBase One point of test-systemd is to see whether our internal systemd code can fully link without external systemd library. In fact, we want all symbols from the internal systemd code to resolve, because when we link against an external libsystemd library, we may mix differing APIs, resulting in subtle bugs. Currently, it may well be that libNetworkManagerBase.la already links against libsystemd, which would result in test-systemd to wrongly succeed resolving all names. Fix that, by don't link libNetworkManagerBase.la into test-systemd. --- src/tests/Makefile.am | 1 - src/tests/test-systemd.c | 45 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index d742231af7..8851c24279 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -130,7 +130,6 @@ test_systemd_SOURCES = \ test-systemd.c test_systemd_LDADD = \ - $(top_builddir)/src/libNetworkManagerBase.la \ $(top_builddir)/src/libsystemd-nm.la ####### utils test ####### diff --git a/src/tests/test-systemd.c b/src/tests/test-systemd.c index acdce5afac..a6c0bf3f1f 100644 --- a/src/tests/test-systemd.c +++ b/src/tests/test-systemd.c @@ -27,6 +27,51 @@ #include "nm-test-utils-core.h" +/***************************************************************************** + * Stub implementations of libNetworkManagerBase symbols + *****************************************************************************/ + +gboolean +nm_utils_get_testing_initialized (void) +{ + return TRUE; +} + +void +_nm_utils_set_testing (NMUtilsTestFlags flags) +{ + g_assert_not_reached (); +} + +gint32 +nm_utils_get_monotonic_timestamp_s (void) +{ + return 1; +} + +NMLogDomain _nm_logging_enabled_state[_LOGL_N_REAL]; + +void +_nm_log_impl (const char *file, + guint line, + const char *func, + NMLogLevel level, + NMLogDomain domain, + int error, + const char *fmt, + ...) +{ +} + +gboolean +nm_logging_setup (const char *level, + const char *domains, + char **bad_domains, + GError **error) +{ + return TRUE; +} + /*****************************************************************************/ static void