From 7b375953fa01c5f328b1b566d29f6c2c78d6609b Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 26 Feb 2017 21:25:28 +0100 Subject: [PATCH] build: merge tests/Makefile.am into top-level makefile --- .gitignore | 1 + Makefile.am | 130 +++++++++++++++++++++++++++++++++++++++++++++- configure.ac | 8 ++- tests/Makefile.am | 81 ----------------------------- 4 files changed, 132 insertions(+), 88 deletions(-) delete mode 100644 tests/Makefile.am diff --git a/.gitignore b/.gitignore index ad0cbc2..c22a603 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ Makefile.in defs.h.in defs.h.in~ /lib/stamp-h1 +test-suite.log /libnl-1.pc /lib/defs.h diff --git a/Makefile.am b/Makefile.am index 8e7e621..1b5c4e7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,8 +3,7 @@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = \ - . \ - tests + . if ENABLE_CLI SUBDIRS += src @@ -12,6 +11,11 @@ endif lib_LTLIBRARIES = +check_PROGRAMS = +check_programs = + +TESTS = + CLEANFILES = EXTRA_DIST = @@ -527,6 +531,125 @@ endif ############################################################################### +tests_cppflags = \ + -Wall \ + -D_GNU_SOURCE \ + -DSYSCONFDIR=\"$(sysconfdir)/libnl\" \ + -I$(srcdir)/include/linux-private \ + -I$(srcdir)/include \ + -I$(builddir)/include + +tests_ldadd = \ + lib/libnl-3.la \ + lib/libnl-nf-3.la \ + lib/libnl-genl-3.la \ + lib/libnl-route-3.la + +check_PROGRAMS += \ + tests/test-complex-HTB-with-hash-filters \ + tests/test-create-bond \ + tests/test-create-bridge \ + tests/test-create-ifb \ + tests/test-create-ip6tnl \ + tests/test-create-ipgre \ + tests/test-create-ipgretap \ + tests/test-create-ipip \ + tests/test-create-ipvlan \ + tests/test-create-ipvti \ + tests/test-create-macsec \ + tests/test-create-macvlan \ + tests/test-create-macvtap \ + tests/test-create-sit \ + tests/test-create-veth \ + tests/test-create-vlan \ + tests/test-create-vrf \ + tests/test-create-vxlan \ + tests/test-delete-link \ + tests/test-socket-creation \ + tests/test-u32-filter-with-actions + +tests_test_create_bond_CPPFLAGS = $(tests_cppflags) +tests_test_create_bond_LDADD = $(tests_ldadd) +tests_test_create_vlan_CPPFLAGS = $(tests_cppflags) +tests_test_create_vlan_LDADD = $(tests_ldadd) +tests_test_create_vxlan_CPPFLAGS = $(tests_cppflags) +tests_test_create_vxlan_LDADD = $(tests_ldadd) +tests_test_create_veth_CPPFLAGS = $(tests_cppflags) +tests_test_create_veth_LDADD = $(tests_ldadd) +tests_test_create_bridge_CPPFLAGS = $(tests_cppflags) +tests_test_create_bridge_LDADD = $(tests_ldadd) +tests_test_create_ip6tnl_CPPFLAGS = $(tests_cppflags) +tests_test_create_ip6tnl_LDADD = $(tests_ldadd) +tests_test_create_ipgre_CPPFLAGS = $(tests_cppflags) +tests_test_create_ipgre_LDADD = $(tests_ldadd) +tests_test_create_ipgretap_CPPFLAGS = $(tests_cppflags) +tests_test_create_ipgretap_LDADD = $(tests_ldadd) +tests_test_create_ipip_CPPFLAGS = $(tests_cppflags) +tests_test_create_ipip_LDADD = $(tests_ldadd) +tests_test_create_ipvti_CPPFLAGS = $(tests_cppflags) +tests_test_create_ipvti_LDADD = $(tests_ldadd) +tests_test_create_macsec_CPPFLAGS = $(tests_cppflags) +tests_test_create_macsec_LDADD = $(tests_ldadd) +tests_test_create_macvlan_CPPFLAGS = $(tests_cppflags) +tests_test_create_macvlan_LDADD = $(tests_ldadd) +tests_test_create_macvtap_CPPFLAGS = $(tests_cppflags) +tests_test_create_macvtap_LDADD = $(tests_ldadd) +tests_test_create_ipvlan_CPPFLAGS = $(tests_cppflags) +tests_test_create_ipvlan_LDADD = $(tests_ldadd) +tests_test_create_vrf_CPPFLAGS = $(tests_cppflags) +tests_test_create_vrf_LDADD = $(tests_ldadd) +tests_test_create_sit_CPPFLAGS = $(tests_cppflags) +tests_test_create_sit_LDADD = $(tests_ldadd) +tests_test_create_ifb_CPPFLAGS = $(tests_cppflags) +tests_test_create_ifb_LDADD = $(tests_ldadd) +tests_test_delete_link_CPPFLAGS = $(tests_cppflags) +tests_test_delete_link_LDADD = $(tests_ldadd) +tests_test_socket_creation_CPPFLAGS = $(tests_cppflags) +tests_test_socket_creation_LDADD = $(tests_ldadd) +tests_test_complex_HTB_with_hash_filters_CPPFLAGS = $(tests_cppflags) +tests_test_complex_HTB_with_hash_filters_LDADD = $(tests_ldadd) +tests_test_u32_filter_with_actions_CPPFLAGS = $(tests_cppflags) +tests_test_u32_filter_with_actions_LDADD = $(tests_ldadd) + +if ENABLE_CLI +check_PROGRAMS += \ + tests/test-cache-mngr \ + tests/test-genl \ + tests/test-nf-cache-mngr +endif + +tests_cli_ldadd = \ + $(tests_ldadd) \ + src/lib/libnl-cli-3.la + +tests_test_cache_mngr_CPPFLAGS = $(tests_cppflags) +tests_test_cache_mngr_LDADD = $(tests_cli_ldadd) +tests_test_genl_CPPFLAGS = $(tests_cppflags) +tests_test_genl_LDADD = $(tests_cli_ldadd) +tests_test_nf_cache_mngr_CPPFLAGS = $(tests_cppflags) +tests_test_nf_cache_mngr_LDADD = $(tests_cli_ldadd) + + +if WITH_CHECK +check_programs += tests/check-all +endif + +tests_check_all_SOURCES = \ + tests/util.h \ + tests/check-all.c \ + tests/check-addr.c \ + tests/check-attr.c + +tests_check_all_CPPFLAGS = \ + $(tests_cppflags) \ + $(CHECK_CFLAGS) + +tests_check_all_LDADD = \ + $(tests_ldadd) \ + $(CHECK_LIBS) + +############################################################################### + dist_man8_MANS = \ man/nl-classid-lookup.8 \ man/nl-pktloc-lookup.8 \ @@ -576,6 +699,9 @@ EXTRA_DIST += \ ############################################################################### +check_PROGRAMS += $(check_programs) +TESTS += $(check_programs) + if ENABLE_CLI pkgconfig_DATA += libnl-cli-3.0.pc endif diff --git a/configure.ac b/configure.ac index b72f9d1..809da6a 100644 --- a/configure.ac +++ b/configure.ac @@ -79,11 +79,10 @@ AC_C_CONST AC_C_INLINE PKG_CHECK_MODULES([CHECK], [check >= 0.9.0], - [enable_unit_tests="yes"], + [has_check="yes"], [AC_MSG_WARN([*** Disabling building of unit tests]) - enable_unit_tests="no"]) - -AM_CONDITIONAL([ENABLE_UNIT_TESTS], [test "$enable_unit_tests" = "yes"]) + has_check="no"]) +AM_CONDITIONAL(WITH_CHECK, [test "$has_check" = 'yes']) AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH], [Path to the pkgconfig directory [[LIBDIR/pkgconfig]]]), @@ -137,7 +136,6 @@ libnl-xfrm-3.0.pc libnl-idiag-3.0.pc src/Makefile src/lib/Makefile -tests/Makefile python/setup.py include/netlink/version.h ]) diff --git a/tests/Makefile.am b/tests/Makefile.am deleted file mode 100644 index c31fb52..0000000 --- a/tests/Makefile.am +++ /dev/null @@ -1,81 +0,0 @@ -# -*- Makefile -*- - -EXTRA_DIST = \ - util.h - -if ENABLE_UNIT_TESTS - -AM_CPPFLAGS = \ - -Wall \ - -I${top_srcdir}/include/linux-private \ - -I${top_srcdir}/include \ - -I${top_builddir}/include \ - -D_GNU_SOURCE \ - -DSYSCONFDIR=\"$(sysconfdir)/libnl\" - -LDADD = \ - ${top_builddir}/lib/libnl-3.la \ - ${top_builddir}/lib/libnl-nf-3.la \ - ${top_builddir}/lib/libnl-genl-3.la \ - ${top_builddir}/lib/libnl-route-3.la \ - @CHECK_LIBS@ - -AM_CFLAGS = @CHECK_CFLAGS@ - -UNIT_TESTS = check-all - -check_PROGRAMS = \ - test-create-bond \ - test-create-vlan \ - test-create-vxlan \ - test-create-veth \ - test-create-bridge \ - test-create-ip6tnl \ - test-create-ipgre \ - test-create-ipgretap \ - test-create-ipip \ - test-create-ipvti \ - test-create-macsec \ - test-create-macvlan \ - test-create-macvtap \ - test-create-ipvlan \ - test-create-vrf \ - test-create-sit \ - test-create-ifb \ - test-delete-link \ - test-socket-creation \ - test-complex-HTB-with-hash-filters \ - test-u32-filter-with-actions \ - ${UNIT_TESTS} - -TESTS = \ - ${UNIT_TESTS} - -if ENABLE_CLI -LDADD += ${top_builddir}/src/lib/libnl-cli-3.la -check_PROGRAMS += \ - test-cache-mngr \ - test-genl \ - test-nf-cache-mngr -endif - -test_cache_mngr_SOURCES = test-cache-mngr.c -test_create_bond_SOURCES = test-create-bond.c -test_create_vlan_SOURCES = test-create-vlan.c -test_create_vxlan_SOURCES = test-create-vxlan.c -test_create_veth_SOURCES = test-create-veth.c -test_create_bridge_SOURCES = test-create-bridge.c -test_create_ifb_SOURCES = test-create-ifb.c -test_delete_link_SOURCES = test-delete-link.c -test_genl_SOURCES = test-genl.c -test_nf_cache_mngr_SOURCES = test-nf-cache-mngr.c -test_socket_creation_SOURCES = test-socket-creation.c -test_complex_HTB_with_hash_filters_SOURCES = test-complex-HTB-with-hash-filters.c -test_u32_filter_with_actions_SOURCES = test-u32-filter-with-actions.c - -# Unit tests -check_all_SOURCES = \ - check-all.c \ - check-addr.c \ - check-attr.c -endif -- 2.40.0