Merge pull request #3072 from octo/ff/network_test
authorrjablonx <36538481+rjablonx@users.noreply.github.com>
Fri, 12 Jul 2019 11:09:00 +0000 (13:09 +0200)
committerGitHub <noreply@github.com>
Fri, 12 Jul 2019 11:09:00 +0000 (13:09 +0200)
Add a unit test for the network plugin.

1  2 
Makefile.am

diff --combined Makefile.am
@@@ -276,7 -276,7 +276,7 @@@ collectd_LDFLAGS += -ldl -Wl,--out-impl
  else
  collectd_SOURCES += src/daemon/cmd.c
  endif
 -      
 +
  if BUILD_FEATURE_DAEMON
  collectd_CPPFLAGS += -DPIDFILE='"${localstatedir}/run/${PACKAGE_NAME}.pid"'
  endif
@@@ -1065,32 -1065,11 +1065,32 @@@ if BUILD_PLUGIN_INTEL_RD
  pkglib_LTLIBRARIES += intel_rdt.la
  intel_rdt_la_SOURCES = \
        src/intel_rdt.c \
 +      src/utils/proc_pids/proc_pids.c \
 +      src/utils/proc_pids/proc_pids.h \
        src/utils/config_cores/config_cores.h \
        src/utils/config_cores/config_cores.c
  intel_rdt_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBPQOS_CPPFLAGS)
  intel_rdt_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBPQOS_LDFLAGS)
  intel_rdt_la_LIBADD = $(BUILD_WITH_LIBPQOS_LIBS)
 +
 +test_plugin_intel_rdt_SOURCES = \
 +      src/intel_rdt_test.c \
 +      src/utils/config_cores/config_cores.c \
 +      src/utils/proc_pids/proc_pids.c \
 +      src/daemon/configfile.c \
 +      src/daemon/types_list.c
 +test_plugin_intel_rdt_CPPFLAGS = $(AM_CPPFLAGS)
 +test_plugin_intel_rdt_LDFLAGS = $(PLUGIN_LDFLAGS)
 +test_plugin_intel_rdt_LDADD = liboconfig.la libplugin_mock.la
 +check_PROGRAMS += test_plugin_intel_rdt
 +TESTS += test_plugin_intel_rdt
 +
 +test_utils_proc_pids_SOURCES = \
 +      src/utils/proc_pids/proc_pids_test.c \
 +      src/testing.h
 +test_utils_proc_pids_LDADD = libplugin_mock.la
 +check_PROGRAMS += test_utils_proc_pids
 +TESTS += test_utils_proc_pids
  endif
  
  if BUILD_PLUGIN_INTERFACE
@@@ -1391,6 -1370,21 +1391,21 @@@ network_la_CPPFLAGS += $(GCRYPT_CPPFLAG
  network_la_LDFLAGS += $(GCRYPT_LDFLAGS)
  network_la_LIBADD += $(GCRYPT_LIBS)
  endif
+ test_plugin_network_SOURCES = \
+       src/network_test.c \
+       src/utils_fbhash.c \
+       src/daemon/configfile.c \
+       src/daemon/types_list.c
+ test_plugin_network_CPPFLAGS = $(AM_CPPFLAGS) $(GCRYPT_CPPFLAGS)
+ test_plugin_network_LDFLAGS = $(PLUGIN_LDFLAGS) $(GCRYPT_LDFLAGS)
+ test_plugin_network_LDADD = \
+       libavltree.la \
+       liboconfig.la \
+       libplugin_mock.la \
+       libmetadata.la \
+       $(GCRYPT_LIBS)
+ check_PROGRAMS += test_plugin_network
  endif
  
  if BUILD_PLUGIN_NFS
@@@ -1960,13 -1954,12 +1975,13 @@@ virt_la_CFLAGS = $(AM_CFLAGS) 
  virt_la_LDFLAGS = $(PLUGIN_LDFLAGS)
  virt_la_LIBADD = libignorelist.la $(BUILD_WITH_LIBVIRT_LIBS) $(BUILD_WITH_LIBXML2_LIBS)
  
 -test_plugin_virt_SOURCES = src/virt_test.c
 +test_plugin_virt_SOURCES = src/virt_test.c src/daemon/configfile.c \
 +      src/daemon/types_list.c
  test_plugin_virt_CPPFLAGS = $(AM_CPPFLAGS) \
        $(BUILD_WITH_LIBVIRT_CPPFLAGS) $(BUILD_WITH_LIBXML2_CFLAGS)
  test_plugin_virt_LDFLAGS = $(PLUGIN_LDFLAGS) \
        $(BUILD_WITH_LIBVIRT_LDFLAGS) $(BUILD_WITH_LIBXML2_LDFLAGS)
 -test_plugin_virt_LDADD = libplugin_mock.la \
 +test_plugin_virt_LDADD = liboconfig.la libplugin_mock.la \
        $(BUILD_WITH_LIBVIRT_LIBS) $(BUILD_WITH_LIBXML2_LIBS)
  check_PROGRAMS += test_plugin_virt
  TESTS += test_plugin_virt
@@@ -2079,12 -2072,6 +2094,12 @@@ write_stackdriver_la_LIBADD = libformat
                       $(BUILD_WITH_LIBCURL_LIBS)
  endif
  
 +if BUILD_PLUGIN_WRITE_SYSLOG
 +pkglib_LTLIBRARIES += write_syslog.la
 +write_syslog_la_SOURCES = src/write_syslog.c
 +write_syslog_la_LDFLAGS = $(PLUGIN_LDFLAGS)
 +endif
 +
  if BUILD_PLUGIN_WRITE_TSDB
  pkglib_LTLIBRARIES += write_tsdb.la
  write_tsdb_la_SOURCES = src/write_tsdb.c
@@@ -2137,10 -2124,20 +2152,10 @@@ am__v_POD2MAN_C_0 = @echo "  POD2MAN " 
  am__v_POD2MAN_C_1 =
  
  .pod.1:
 -      $(AM_V_POD2MAN_C)pod2man --release=$(VERSION) --center=$(PACKAGE) $< \
 -              >.pod2man.tmp.$$$$ 2>/dev/null && mv -f .pod2man.tmp.$$$$ $@ || true
 -      @if grep '\<POD ERRORS\>' $@ >/dev/null 2>&1; \
 -      then \
 -              echo "$@ has some POD errors!"; false; \
 -      fi
 +      $(AM_V_POD2MAN_C)pod2man --release=$(VERSION) --center=$(PACKAGE) $< $@
  
  .pod.5:
 -      $(AM_V_POD2MAN_C)pod2man --section=5 --release=$(VERSION) --center=$(PACKAGE) $< \
 -              >.pod2man.tmp.$$$$ 2>/dev/null && mv -f .pod2man.tmp.$$$$ $@ || true
 -      @if grep '\<POD ERRORS\>' $@ >/dev/null 2>&1; \
 -      then \
 -              echo "$@ has some POD errors!"; false; \
 -      fi
 +      $(AM_V_POD2MAN_C)pod2man --section=5 --release=$(VERSION) --center=$(PACKAGE) $< $@
  
  V_PROTOC = $(v_protoc_@AM_V@)
  v_protoc_ = $(v_protoc_@AM_DEFAULT_V@)