summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am74
-rw-r--r--configure.ac4
-rw-r--r--libnm-glib/tests/Makefile.am2
-rw-r--r--libnm/Makefile.am1
-rw-r--r--libnm/tests/Makefile.am61
-rwxr-xr-xtools/run-nm-test.sh40
6 files changed, 97 insertions, 85 deletions
diff --git a/Makefile.am b/Makefile.am
index 39910a0c1b..9e10524a9b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -37,7 +37,6 @@ pkgconfig_DATA =
SUBDIRS = \
. \
- libnm \
src \
dispatcher \
clients \
@@ -791,6 +790,79 @@ EXTRA_DIST += \
###############################################################################
+if ENABLE_TESTS
+
+libnm_tests_programs = \
+ libnm/tests/test-nm-client \
+ libnm/tests/test-remote-settings-client \
+ libnm/tests/test-secret-agent
+
+noinst_PROGRAMS += $(libnm_tests_programs)
+
+libnm_tests_cppflags = \
+ -I$(top_srcdir)/shared \
+ -I$(top_builddir)/shared \
+ -I$(top_srcdir)/libnm \
+ -I$(top_builddir)/libnm \
+ -I$(top_srcdir)/libnm-core \
+ -I$(top_builddir)/libnm-core \
+ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB \
+ -DTEST_NM_SERVICE=\"$(abs_top_srcdir)/tools/test-networkmanager-service.py\" \
+ $(GLIB_CFLAGS)
+
+libnm_tests_ldadd = \
+ $(top_builddir)/libnm/libnm.la \
+ $(GLIB_LIBS)
+
+libnm_tests_test_nm_client_CPPFLAGS = $(libnm_tests_cppflags)
+libnm_tests_test_remote_settings_client_CPPFLAGS = $(libnm_tests_cppflags)
+libnm_tests_test_secret_agent_CPPFLAGS = $(libnm_tests_cppflags)
+
+libnm_tests_test_nm_client_SOURCES = \
+ shared/nm-test-utils-impl.c \
+ shared/nm-test-libnm-utils.h \
+ libnm/tests/test-nm-client.c
+
+libnm_tests_test_remote_settings_client_SOURCES = \
+ shared/nm-test-utils-impl.c \
+ shared/nm-test-libnm-utils.h \
+ libnm/tests/test-remote-settings-client.c
+
+libnm_tests_test_secret_agent_SOURCES = \
+ shared/nm-test-utils-impl.c \
+ shared/nm-test-libnm-utils.h \
+ libnm/tests/test-secret-agent.c
+
+libnm_tests_test_nm_client_LDADD = $(libnm_tests_ldadd)
+libnm_tests_test_remote_settings_client_LDADD = $(libnm_tests_ldadd)
+libnm_tests_test_secret_agent_LDADD = $(libnm_tests_ldadd)
+
+TESTS += $(libnm_tests_programs)
+
+endif
+
+###############################################################################
+
+# just test, that we can build "nm-vpn-plugin-utils.c"
+
+noinst_LTLIBRARIES += \
+ libnm/tests/libnm-vpn-plugin-utils-test.la
+
+libnm_tests_libnm_vpn_plugin_utils_test_la_SOURCES = \
+ shared/nm-utils/nm-vpn-plugin-utils.c \
+ shared/nm-utils/nm-vpn-plugin-utils.h
+
+libnm_tests_libnm_vpn_plugin_utils_test_la_CFLAGS = \
+ $(GLIB_CFLAGS) \
+ -I$(srcdir)/shared \
+ -I$(srcdir)/libnm-core \
+ -I$(srcdir)/libnm
+
+libnm_tests_libnm_vpn_plugin_utils_test_la_LIBADD = \
+ $(GLIB_LIBS)
+
+###############################################################################
+
girdir = $(datadir)/gir-1.0
gir_DATA = $(INTROSPECTION_GIRS)
diff --git a/configure.ac b/configure.ac
index 4ed8c3790f..e9ab6e605c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1069,7 +1069,7 @@ else
with_valgrind_suppressions='$(top_srcdir)/valgrind.suppressions'
fi
fi
-AC_SUBST(NM_LOG_COMPILER, 'LOG_COMPILER = "$(top_srcdir)/tools/run-nm-test.sh" --called-from-make "$(LIBTOOL)" "$(with_valgrind)" "'"$with_valgrind_suppressions"'"'),
+AC_SUBST(NM_LOG_COMPILER, 'LOG_COMPILER = "$(top_srcdir)/tools/run-nm-test.sh" --called-from-make "$(LIBTOOL)" "$(with_valgrind)" "'"$with_valgrind_suppressions"'" --launch-dbus=auto'),
GTK_DOC_CHECK(1.0)
@@ -1169,8 +1169,6 @@ src/devices/wifi/Makefile
src/devices/wifi/tests/Makefile
src/devices/wwan/Makefile
libnm/libnm.pc
-libnm/Makefile
-libnm/tests/Makefile
libnm-util/libnm-util.pc
libnm-util/Makefile
libnm-util/tests/Makefile
diff --git a/libnm-glib/tests/Makefile.am b/libnm-glib/tests/Makefile.am
index 9d15802697..09f34d1847 100644
--- a/libnm-glib/tests/Makefile.am
+++ b/libnm-glib/tests/Makefile.am
@@ -13,7 +13,7 @@ AM_CPPFLAGS = \
noinst_PROGRAMS = $(TESTS)
-@NM_LOG_COMPILER@ --launch-dbus
+@NM_LOG_COMPILER@
TESTS = test-nm-client test-remote-settings-client
####### NMClient and non-settings tests #######
diff --git a/libnm/Makefile.am b/libnm/Makefile.am
deleted file mode 100644
index 3c6155b9c6..0000000000
--- a/libnm/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = tests
diff --git a/libnm/tests/Makefile.am b/libnm/tests/Makefile.am
deleted file mode 100644
index a143abaf51..0000000000
--- a/libnm/tests/Makefile.am
+++ /dev/null
@@ -1,61 +0,0 @@
-if ENABLE_TESTS
-
-AM_CPPFLAGS = \
- -I$(top_srcdir)/shared \
- -I$(top_builddir)/shared \
- -I$(top_srcdir)/libnm \
- -I$(top_builddir)/libnm \
- -I$(top_srcdir)/libnm-core \
- -I$(top_builddir)/libnm-core \
- -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB \
- -DTEST_NM_SERVICE=\"$(abs_top_srcdir)/tools/test-networkmanager-service.py\" \
- $(GLIB_CFLAGS)
-
-LDADD = \
- $(top_builddir)/libnm/libnm.la \
- $(GLIB_LIBS)
-
-noinst_PROGRAMS = $(TESTS)
-
-@NM_LOG_COMPILER@ --launch-dbus
-TESTS = test-nm-client test-remote-settings-client test-secret-agent
-
-test_nm_client_SOURCES = \
- $(top_builddir)/shared/nm-test-utils-impl.c \
- $(top_builddir)/shared/nm-test-libnm-utils.h \
- test-nm-client.c
-
-test_remote_settings_client_SOURCES = \
- $(top_builddir)/shared/nm-test-utils-impl.c \
- $(top_builddir)/shared/nm-test-libnm-utils.h \
- test-remote-settings-client.c
-
-test_secret_agent_SOURCES = \
- $(top_builddir)/shared/nm-test-utils-impl.c \
- $(top_builddir)/shared/nm-test-libnm-utils.h \
- test-secret-agent.c
-endif
-
-###############################################################################
-
-noinst_LTLIBRARIES = \
- libnm-vpn-plugin-utils-test.la
-
-libnm_vpn_plugin_utils_test_la_SOURCES = \
- $(top_srcdir)/shared/nm-utils/nm-vpn-plugin-utils.c \
- $(top_srcdir)/shared/nm-utils/nm-vpn-plugin-utils.h \
- $(NULL)
-
-libnm_vpn_plugin_utils_test_la_CFLAGS = \
- $(GLIB_CFLAGS) \
- -I$(top_srcdir)/shared \
- -I$(top_srcdir)/libnm-core \
- -I$(top_srcdir)/libnm \
- $(NULL)
-
-libnm_vpn_plugin_utils_test_la_LIBADD = \
- $(GLIB_LIBS) \
- $(NULL)
-
-###############################################################################
-
diff --git a/tools/run-nm-test.sh b/tools/run-nm-test.sh
index 809e95b739..34d30aab80 100755
--- a/tools/run-nm-test.sh
+++ b/tools/run-nm-test.sh
@@ -13,18 +13,22 @@ if [ "$1" == "--called-from-make" ]; then
shift
NMTST_LIBTOOL=($1 --mode=execute); shift
NMTST_VALGRIND="$1"; shift
+ NMTST_CHANGE_DIRECTORY=
+ if [[ "$NMTST_VALGRIND" == no ]]; then
+ NMTST_VALGRIND=
+ fi
SUPPRESSIONS="$1"; shift
if [ "$1" = "--launch-dbus" ]; then
NMTST_LAUNCH_DBUS=yes
shift
+ elif [ "$1" = "--launch-dbus=auto" ]; then
+ NMTST_LAUNCH_DBUS=
+ shift
else
NMTST_LAUNCH_DBUS=no
fi
TEST="$1"; shift
- if [[ "$NMTST_VALGRIND" == no ]]; then
- NMTST_VALGRIND=
- fi
else
if [ -n "${NMTST_LIBTOOL-:x}" ]; then
NMTST_LIBTOOL=(sh "$SCRIPT_PATH/../libtool" --mode=execute)
@@ -74,25 +78,25 @@ else
SUPPRESSIONS="$SCRIPT_PATH/../valgrind.suppressions"
fi
- [ -x "$TEST" ] || die "Test \"$TEST\" does not exist"
+fi
- TEST_PATH="$(readlink -f "$(dirname "$TEST")")"
+[ -x "$TEST" ] || die "Test \"$TEST\" does not exist"
+TEST_PATH="$(readlink -f "$(dirname "$TEST")")"
- if [ -n "${NMTST_LAUNCH_DBUS-x}" ]; then
- # autodetect whether to launch D-Bus based on the test path.
- if [[ $TEST_PATH == */libnm/tests || $TEST_PATH == */libnm-glib/tests ]]; then
- NMTST_LAUNCH_DBUS=yes
- else
- NMTST_LAUNCH_DBUS=no
- fi
+if [ -n "${NMTST_LAUNCH_DBUS:-x}" ]; then
+ # autodetect whether to launch D-Bus based on the test path.
+ if [[ $TEST_PATH == */libnm/tests || $TEST_PATH == */libnm-glib/tests ]]; then
+ NMTST_LAUNCH_DBUS=yes
+ else
+ NMTST_LAUNCH_DBUS=no
fi
+fi
- # some tests require you to cd into the base directory.
- # do that.
- if [ "$NMTST_VALGRIND_NO_CD" == "" ]; then
- cd "$TEST_PATH"
- TEST="./$(basename "$TEST")"
- fi
+# some tests require you to cd into the base directory.
+# do that.
+if [ "$NMTST_CHANGE_DIRECTORY" != "" ]; then
+ cd "$TEST_PATH"
+ TEST="./$(basename "$TEST")"
fi
NMTST_DBUS_RUN_SESSION=()