build: merge "libnm/tests/Makefile.am" into toplevel Makefile

This commit is contained in:
Thomas Haller 2016-10-15 16:24:59 +02:00
parent 9061432d55
commit 7aefbcb622
6 changed files with 97 additions and 85 deletions

View file

@ -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)

View file

@ -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

View file

@ -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 #######

View file

@ -1 +0,0 @@
SUBDIRS = tests

View file

@ -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)
###############################################################################

View file

@ -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=()