Browse Source

[master] Corrected distcheck failure in cfgrpt

Merges branch 'trac3929'
Thomas Markwalder 9 years ago
parent
commit
223626338a

+ 1 - 0
Makefile.am

@@ -127,6 +127,7 @@ install-exec-hook:
 ### in the distributed tarball:
 EXTRA_DIST = tools/system_messages.py
 EXTRA_DIST += tools/path_replacer.sh
+EXTRA_DIST += tools/mk_cfgrpt.sh
 
 #### include external sources in the distributed tarball:
 EXTRA_DIST += ext/asio/README

+ 2 - 5
configure.ac

@@ -1393,7 +1393,6 @@ AC_CONFIG_FILES([compatcheck/Makefile
                  src/bin/d2/tests/Makefile
                  src/bin/d2/tests/d2_process_tests.sh
                  src/bin/d2/tests/test_data_files_config.h
-                 src/bin/cfgrpt/Makefile
                  src/bin/dhcp4/Makefile
                  src/bin/dhcp4/spec_config.h.pre
                  src/bin/dhcp4/tests/Makefile
@@ -1442,6 +1441,8 @@ AC_CONFIG_FILES([compatcheck/Makefile
                  src/lib/asiolink/tests/Makefile
                  src/lib/cc/Makefile
                  src/lib/cc/tests/Makefile
+                 src/lib/cfgrpt/Makefile
+                 src/lib/cfgrpt/tests/Makefile
                  src/lib/config/Makefile
                  src/lib/config/tests/Makefile
                  src/lib/config/tests/data_def_unittests_config.h
@@ -1651,10 +1652,6 @@ Developer:
 
 END
 
-# Create config_report.cc with embedded config.report
-chmod +x ${srcdir}/tools/mk_cfgrpt.sh
-${srcdir}/tools/mk_cfgrpt.sh ${srcdir}/src/bin/cfgrpt/config_report.cc
-
 cat config.report
 cat <<EOF
 

+ 1 - 1
src/bin/Makefile.am

@@ -1,4 +1,4 @@
 # The following build order must be maintained.
-SUBDIRS = cfgrpt dhcp4 dhcp6 d2 perfdhcp admin lfc keactrl
+SUBDIRS = dhcp4 dhcp6 d2 perfdhcp admin lfc keactrl
 
 check-recursive: all-recursive

+ 0 - 12
src/bin/cfgrpt/Makefile.am

@@ -1,12 +0,0 @@
-AM_CPPFLAGS = -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
-
-# Get rid of generated message files on a clean
-CLEANFILES = *.gcno *.gcda
-
-# config_report.cc was generated by configure
-DISTCLEANFILES = config_report.cc
-
-# convenience archive
-noinst_LTLIBRARIES = libcfgrpt.la
-
-libcfgrpt_la_SOURCES = config_report.h config_report.cc cfgrpt.cc

+ 1 - 1
src/bin/d2/Makefile.am

@@ -106,7 +106,7 @@ kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
 kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
 kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
-kea_dhcp_ddns_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
+kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
 
 kea_dhcp_ddnsdir = $(pkgdatadir)
 kea_dhcp_ddns_DATA = dhcp-ddns.spec

+ 1 - 1
src/bin/d2/tests/Makefile.am

@@ -87,7 +87,7 @@ d2_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.l
 d2_unittests_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
 d2_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 d2_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
-d2_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
+d2_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
 d2_unittests_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
 
 endif

+ 1 - 1
src/bin/dhcp4/Makefile.am

@@ -85,7 +85,7 @@ kea_dhcp4_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
 kea_dhcp4_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
 kea_dhcp4_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
 kea_dhcp4_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
-kea_dhcp4_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
+kea_dhcp4_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
 
 kea_dhcp4dir = $(pkgdatadir)
 kea_dhcp4_DATA = dhcp4.spec

+ 1 - 1
src/bin/dhcp4/tests/Makefile.am

@@ -109,7 +109,7 @@ dhcp4_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
 dhcp4_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
 dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.la
 dhcp4_unittests_LDADD += $(top_builddir)/src/lib/util/io/libkea-util-io.la
-dhcp4_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
+dhcp4_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
 dhcp4_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
 endif
 

+ 1 - 1
src/bin/dhcp6/Makefile.am

@@ -85,7 +85,7 @@ kea_dhcp6_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
 kea_dhcp6_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 kea_dhcp6_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
 kea_dhcp6_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
-kea_dhcp6_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
+kea_dhcp6_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
 kea_dhcp6_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
 
 kea_dhcp6dir = $(pkgdatadir)

+ 1 - 1
src/bin/dhcp6/tests/Makefile.am

@@ -111,7 +111,7 @@ dhcp6_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
 dhcp6_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
 dhcp6_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 dhcp6_unittests_LDADD += $(top_builddir)/src/lib/util/io/libkea-util-io.la
-dhcp6_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
+dhcp6_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
 dhcp6_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
 
 endif

+ 1 - 1
src/bin/lfc/Makefile.am

@@ -65,6 +65,6 @@ kea_lfc_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
 kea_lfc_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
 kea_lfc_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 kea_lfc_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
-kea_lfc_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
+kea_lfc_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
 
 kea_lfcdir = $(pkgdatadir)

+ 1 - 1
src/bin/lfc/tests/Makefile.am

@@ -58,7 +58,7 @@ lfc_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
 lfc_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
 lfc_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 lfc_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
-lfc_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
+lfc_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
 
 endif
 

+ 1 - 1
src/bin/perfdhcp/Makefile.am

@@ -48,7 +48,7 @@ perfdhcp_LDADD = libperfdhcp.la
 perfdhcp_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
 perfdhcp_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
 perfdhcp_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
-perfdhcp_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
+perfdhcp_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
 
 # ... and the documentation
 EXTRA_DIST = perfdhcp_internals.dox

+ 1 - 1
src/bin/perfdhcp/tests/Makefile.am

@@ -47,7 +47,7 @@ run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
 run_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
 run_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
 run_unittests_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la
-run_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
+run_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
 run_unittests_LDADD += $(GTEST_LDADD)
 endif
 

+ 1 - 1
src/lib/Makefile.am

@@ -1,3 +1,3 @@
 # The following build order must be maintained.
 SUBDIRS = exceptions util log hooks cryptolink dns cc asiolink dhcp config stats \
-          asiodns testutils dhcp_ddns dhcpsrv
+          asiodns testutils dhcp_ddns dhcpsrv cfgrpt

src/bin/cfgrpt/.gitignore → src/lib/cfgrpt/.gitignore


+ 21 - 0
src/lib/cfgrpt/Makefile.am

@@ -0,0 +1,21 @@
+SUBDIRS = . tests
+AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
+
+# Get rid of generated message files on a clean
+CLEANFILES = *.gcno *.gcda config_report.cc
+
+# config_report.cc is generated below
+BUILT_SOURCES = config_report.cc
+
+# convenience archive
+noinst_LTLIBRARIES = libcfgrpt.la
+
+nodist_libcfgrpt_la_SOURCES = config_report.cc
+libcfgrpt_la_SOURCES = config_report.h cfgrpt.cc
+
+# set pathname to the input configuration report
+report_file = $(abs_top_builddir)/config.report
+
+# Generate config_report.cc
+config_report.cc: $(report_file)
+	${SHELL} $(top_srcdir)/tools/mk_cfgrpt.sh $(report_file) $(top_builddir)/src/lib/cfgrpt/config_report.cc

src/bin/cfgrpt/cfgrpt.cc → src/lib/cfgrpt/cfgrpt.cc


+ 2 - 0
src/bin/cfgrpt/config_report.h

@@ -15,6 +15,8 @@
 #ifndef CONFIG_REPORT_H
 #define CONFIG_REPORT_H
 
+#include <string>
+
 namespace isc {
 namespace detail {
 

+ 31 - 0
src/lib/cfgrpt/tests/Makefile.am

@@ -0,0 +1,31 @@
+SUBDIRS = .
+
+AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
+AM_CPPFLAGS += $(BOOST_INCLUDES)
+AM_CPPFLAGS += -DTEST_DATA_DIR=\"$(abs_top_srcdir)/src/lib/testutils/testdata\"
+AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_top_builddir)/src/lib/config/tests\"
+
+AM_CXXFLAGS = $(KEA_CXXFLAGS)
+
+if USE_STATIC_LINK
+AM_LDFLAGS = -static
+endif
+
+CLEANFILES = *.gcno *.gcda
+
+TESTS_ENVIRONMENT = \
+	$(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
+
+TESTS =
+if HAVE_GTEST
+TESTS += run_unittests
+run_unittests_SOURCES = config_report_unittests.cc run_unittests.cc
+
+run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
+run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
+run_unittests_LDADD =  $(GTEST_LDADD)
+run_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
+
+endif
+
+noinst_PROGRAMS = $(TESTS)

+ 34 - 0
src/lib/cfgrpt/tests/config_report_unittests.cc

@@ -0,0 +1,34 @@
+// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+#include <config.h>
+#include <cfgrpt/config_report.h>
+
+#include <gtest/gtest.h>
+
+using namespace isc;
+using namespace std;
+
+// This test verifies that the getConfigReport() function
+// returns the actual config report.
+TEST(ConfigReportTest, getConfigReport) {
+
+    // Fetch the report string
+    std::string cfgReport = isc::detail::getConfigReport();
+
+    // Verify that it is not empty and does contain the
+    // extended version number
+    ASSERT_FALSE(cfgReport.empty());
+    EXPECT_NE(std::string::npos, cfgReport.find(EXTENDED_VERSION, 0));
+}

+ 24 - 0
src/lib/cfgrpt/tests/run_unittests.cc

@@ -0,0 +1,24 @@
+// Copyright (C) 2015  Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+#include <gtest/gtest.h>
+
+int
+main(int argc, char* argv[]) {
+    ::testing::InitGoogleTest(&argc, argv);
+
+    int result = RUN_ALL_TESTS();
+
+    return (result);
+}

+ 1 - 1
tools/.gitignore

@@ -1 +1 @@
-/path_replacer.sh
+/path_replacer.sh

+ 16 - 4
tools/mk_cfgrpt.sh

@@ -17,14 +17,26 @@
 # Called by configure
 #
 
-dest=$1
+report_file="$1"
+dest="$2"
+
+if [ -z ${report_file} ]
+then
+    echo "ERROR mk_cfgrpt.sh - input report: $report_file does not exist"
+    exit -1
+fi
 
 # Initializes
-cat > $dest
+cat /dev/null > $dest
+if [ $? -ne 0 ]
+then
+    echo "ERROR mk_cfgrpt.sh - cannot create config output file: $dest"
+    exit -1
+fi
 
 # Header
 cat >> $dest << END
-// config_report.cc. Generated from config.report by tools/mk_cfgrpt_header.sh
+// config_report.cc. Generated from config.report by tools/mk_cfgrpt.sh
 
 namespace isc {
 namespace detail {
@@ -34,7 +46,7 @@ END
 
 # Body: escape '\'s and '"'s, preprend '    ";;;; ' and append '",'
 sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/    ";;;; /' -e 's/$/",/' \
-    < config.report >> $dest
+    < $report_file >> $dest
 
 # Trailer
 cat >> $dest <<END