From: Harlan Stenn Date: Sun, 31 Oct 2010 03:28:54 +0000 (-0700) Subject: Put the sntp tests under sntp/ X-Git-Tag: NTP_4_2_7P76~6^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ead4773a2af446a8f228a5d0b711fa343caaac31;p=thirdparty%2Fntp.git Put the sntp tests under sntp/ --- Put the sntp tests under sntp/ bk: 4ccce276-GfAYIBBAIqc8cgxWfxqOw --- diff --git a/ChangeLog b/ChangeLog index 24e0c4c0c..054ed9075 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* Put the sntp tests under sntp/ . * Documentation updates from Dave Mills. * Include Linus Karlsson's GSoC 2010 testing code. (4.2.7p74) 2010/10/29 Released by Harlan Stenn diff --git a/configure.ac b/configure.ac index bfd076dca..38c6d2bb6 100644 --- a/configure.ac +++ b/configure.ac @@ -4910,7 +4910,6 @@ AM_CONDITIONAL([GTEST_AVAILABLE], [test x${GTEST_CONFIG} != x]) AC_CONFIG_FILES(tests/Makefile) AC_CONFIG_FILES(tests/libntp/Makefile) -AC_CONFIG_FILES(tests/sntp/Makefile) AC_CONFIG_SUBDIRS(sntp) diff --git a/sntp/Makefile.am b/sntp/Makefile.am index bb0952f9b..9a470e141 100644 --- a/sntp/Makefile.am +++ b/sntp/Makefile.am @@ -28,6 +28,7 @@ if NEED_LIBOPTS SUBDIRS+= libopts endif SUBDIRS+= . +SUBDIRS+= tests sntp_SOURCES = \ crypto.c \ diff --git a/sntp/configure.ac b/sntp/configure.ac index 0c907ccd6..00a141eea 100644 --- a/sntp/configure.ac +++ b/sntp/configure.ac @@ -43,6 +43,9 @@ AC_CONFIG_HEADER([config.h]) dnl AC_ARG_PROGRAM AC_PREREQ([2.53]) +# Expose a cross-compilation indicator to makefiles +AM_CONDITIONAL(SNTP_CROSSCOMPILE, test $build != $host) + # Checks for programs. AC_PROG_CC @@ -790,4 +793,21 @@ AC_SUBST(BINSUBDIR) AM_CONDITIONAL(NTP_BINSUBDIR_IS_BIN, test "bin" = "$BINSUBDIR") AC_CONFIG_FILES([Makefile]) + +AC_PROG_CXX + +AC_PATH_PROG([GTEST_CONFIG], [gtest-config]) +if test x${GTEST_CONFIG} != x ; then + GTEST_LDFLAGS=`$GTEST_CONFIG --ldflags` + GTEST_LIBS=`$GTEST_CONFIG --libs` + GTEST_CXXFLAGS=`$GTEST_CONFIG --cxxflags` + GTEST_CPPFLAGS=`$GTEST_CONFIG --cppflags` + AC_SUBST(GTEST_LDFLAGS) + AC_SUBST(GTEST_LIBS) + AC_SUBST(GTEST_CXXFLAGS) + AC_SUBST(GTEST_CPPFLAGS) +fi +AM_CONDITIONAL([GTEST_AVAILABLE], [test x${GTEST_CONFIG} != x]) + +AC_CONFIG_FILES(tests/Makefile) AC_OUTPUT diff --git a/sntp/tests/Makefile.am b/sntp/tests/Makefile.am new file mode 100644 index 000000000..f37367515 --- /dev/null +++ b/sntp/tests/Makefile.am @@ -0,0 +1,54 @@ +check_PROGRAMS = tests + +sntp_objs = .. + +sntp_SOURCES_USED = $(sntp_objs)/crypto.o \ + $(sntp_objs)/kod_management.o \ + $(sntp_objs)/log.o \ + $(sntp_objs)/main.o \ + $(sntp_objs)/networking.o \ + $(sntp_objs)/sntp-opts.o \ + $(sntp_objs)/utilities.o + +base_SOURCES = $(srcdir)/../tests_main.cpp \ + sntptest.cpp + +tests_SOURCES = $(base_SOURCES) \ + crypto.cpp \ + keyFile.cpp \ + kodDatabase.cpp \ + kodFile.cpp \ + logFile.cpp \ + networking.cpp \ + packetHandling.cpp \ + packetProcessing.cpp \ + utilities.cpp + +LDADD = @GTEST_LDFLAGS@ \ + @GTEST_LIBS@ \ + $(LIBOPTS_LDADD) \ + @top_builddir@/../libntp/libntp.a \ + @LCRYPTO@ \ + $(sntp_SOURCES_USED) + +AM_CXXFLAGS = @GTEST_CXXFLAGS@ +AM_CPPFLAGS = @GTEST_CPPFLAGS@ + +INCLUDES = $(LIBOPTS_CFLAGS) \ + -I$(top_srcdir)/../include \ + -I$(top_srcdir)/../lib/isc/include \ + -I$(top_srcdir)/../lib/isc/nothreads/include \ + -I$(top_srcdir)/../lib/isc/unix/include \ + -I$(top_srcdir)/../tests \ + -I$(top_srcdir) + +TESTS = + +TEST_INPUT_DIR = $(abs_srcdir)/data +TEST_OUTPUT_DIR = $(abs_builddir)/data + +TESTS_ENVIRONMENT = $(top_srcdir)/tests/test-driver $(TEST_INPUT_DIR) $(TEST_OUTPUT_DIR) + +if !SNTP_CROSSCOMPILE +TESTS += $(check_PROGRAMS) +endif diff --git a/tests/sntp/crypto.cpp b/sntp/tests/crypto.cpp similarity index 100% rename from tests/sntp/crypto.cpp rename to sntp/tests/crypto.cpp diff --git a/tests/sntp/data/debug-input-lfp-bin b/sntp/tests/data/debug-input-lfp-bin similarity index 100% rename from tests/sntp/data/debug-input-lfp-bin rename to sntp/tests/data/debug-input-lfp-bin diff --git a/tests/sntp/data/debug-input-lfp-dec b/sntp/tests/data/debug-input-lfp-dec similarity index 100% rename from tests/sntp/data/debug-input-lfp-dec rename to sntp/tests/data/debug-input-lfp-dec diff --git a/tests/sntp/data/debug-input-lfp-hex b/sntp/tests/data/debug-input-lfp-hex similarity index 100% rename from tests/sntp/data/debug-input-lfp-hex rename to sntp/tests/data/debug-input-lfp-hex diff --git a/tests/sntp/data/debug-input-pkt b/sntp/tests/data/debug-input-pkt similarity index 100% rename from tests/sntp/data/debug-input-pkt rename to sntp/tests/data/debug-input-pkt diff --git a/tests/sntp/data/key-test-ascii b/sntp/tests/data/key-test-ascii similarity index 100% rename from tests/sntp/data/key-test-ascii rename to sntp/tests/data/key-test-ascii diff --git a/tests/sntp/data/key-test-comments b/sntp/tests/data/key-test-comments similarity index 100% rename from tests/sntp/data/key-test-comments rename to sntp/tests/data/key-test-comments diff --git a/tests/sntp/data/key-test-empty b/sntp/tests/data/key-test-empty similarity index 100% rename from tests/sntp/data/key-test-empty rename to sntp/tests/data/key-test-empty diff --git a/tests/sntp/data/key-test-hex b/sntp/tests/data/key-test-hex similarity index 100% rename from tests/sntp/data/key-test-hex rename to sntp/tests/data/key-test-hex diff --git a/tests/sntp/data/key-test-invalid-hex b/sntp/tests/data/key-test-invalid-hex similarity index 100% rename from tests/sntp/data/key-test-invalid-hex rename to sntp/tests/data/key-test-invalid-hex diff --git a/tests/sntp/data/kod-expected-multiple b/sntp/tests/data/kod-expected-multiple similarity index 100% rename from tests/sntp/data/kod-expected-multiple rename to sntp/tests/data/kod-expected-multiple diff --git a/tests/sntp/data/kod-expected-single b/sntp/tests/data/kod-expected-single similarity index 100% rename from tests/sntp/data/kod-expected-single rename to sntp/tests/data/kod-expected-single diff --git a/tests/sntp/data/kod-test-blanks b/sntp/tests/data/kod-test-blanks similarity index 100% rename from tests/sntp/data/kod-test-blanks rename to sntp/tests/data/kod-test-blanks diff --git a/tests/sntp/data/kod-test-correct b/sntp/tests/data/kod-test-correct similarity index 100% rename from tests/sntp/data/kod-test-correct rename to sntp/tests/data/kod-test-correct diff --git a/tests/sntp/data/kod-test-empty b/sntp/tests/data/kod-test-empty similarity index 100% rename from tests/sntp/data/kod-test-empty rename to sntp/tests/data/kod-test-empty diff --git a/tests/sntp/data/log-expected-debug b/sntp/tests/data/log-expected-debug similarity index 100% rename from tests/sntp/data/log-expected-debug rename to sntp/tests/data/log-expected-debug diff --git a/tests/sntp/data/log-expected-log b/sntp/tests/data/log-expected-log similarity index 100% rename from tests/sntp/data/log-expected-log rename to sntp/tests/data/log-expected-log diff --git a/tests/sntp/fileHandlingTest.h b/sntp/tests/fileHandlingTest.h similarity index 100% rename from tests/sntp/fileHandlingTest.h rename to sntp/tests/fileHandlingTest.h diff --git a/tests/sntp/keyFile.cpp b/sntp/tests/keyFile.cpp similarity index 100% rename from tests/sntp/keyFile.cpp rename to sntp/tests/keyFile.cpp diff --git a/tests/sntp/kodDatabase.cpp b/sntp/tests/kodDatabase.cpp similarity index 100% rename from tests/sntp/kodDatabase.cpp rename to sntp/tests/kodDatabase.cpp diff --git a/tests/sntp/kodFile.cpp b/sntp/tests/kodFile.cpp similarity index 100% rename from tests/sntp/kodFile.cpp rename to sntp/tests/kodFile.cpp diff --git a/tests/sntp/logFile.cpp b/sntp/tests/logFile.cpp similarity index 100% rename from tests/sntp/logFile.cpp rename to sntp/tests/logFile.cpp diff --git a/tests/sntp/networking.cpp b/sntp/tests/networking.cpp similarity index 100% rename from tests/sntp/networking.cpp rename to sntp/tests/networking.cpp diff --git a/tests/sntp/packetHandling.cpp b/sntp/tests/packetHandling.cpp similarity index 100% rename from tests/sntp/packetHandling.cpp rename to sntp/tests/packetHandling.cpp diff --git a/tests/sntp/packetProcessing.cpp b/sntp/tests/packetProcessing.cpp similarity index 100% rename from tests/sntp/packetProcessing.cpp rename to sntp/tests/packetProcessing.cpp diff --git a/tests/sntp/sntptest.cpp b/sntp/tests/sntptest.cpp similarity index 100% rename from tests/sntp/sntptest.cpp rename to sntp/tests/sntptest.cpp diff --git a/tests/sntp/sntptest.h b/sntp/tests/sntptest.h similarity index 100% rename from tests/sntp/sntptest.h rename to sntp/tests/sntptest.h diff --git a/tests/sntp/test-driver b/sntp/tests/test-driver similarity index 100% rename from tests/sntp/test-driver rename to sntp/tests/test-driver diff --git a/tests/sntp/utilities.cpp b/sntp/tests/utilities.cpp similarity index 100% rename from tests/sntp/utilities.cpp rename to sntp/tests/utilities.cpp diff --git a/tests/tests_main.cpp b/sntp/tests_main.cpp similarity index 100% rename from tests/tests_main.cpp rename to sntp/tests_main.cpp diff --git a/tests/tests_main.h b/sntp/tests_main.h similarity index 100% rename from tests/tests_main.h rename to sntp/tests_main.h diff --git a/tests/Makefile.am b/tests/Makefile.am index eea4e8968..5b02c6e0d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS = if GTEST_AVAILABLE -SUBDIRS += libntp sntp +SUBDIRS += libntp endif diff --git a/tests/libntp/Makefile.am b/tests/libntp/Makefile.am index 06a7898bc..bc5c2ffde 100644 --- a/tests/libntp/Makefile.am +++ b/tests/libntp/Makefile.am @@ -2,7 +2,7 @@ check_PROGRAMS = tests LDADD = @LCRYPTO@ @GTEST_LDFLAGS@ @GTEST_LIBS@ @top_builddir@/libntp/libntp.a AM_CXXFLAGS = @GTEST_CXXFLAGS@ AM_CPPFLAGS = @GTEST_CPPFLAGS@ -tests_SOURCES = ../tests_main.cpp \ +tests_SOURCES = $(top_srcdir)/sntp/tests_main.cpp \ libntptest.cpp \ a_md5encrypt.cpp \ atoint.cpp \ @@ -40,10 +40,12 @@ tests_SOURCES = ../tests_main.cpp \ ymd2yd.cpp -INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \ - -I$(top_srcdir)/lib/isc/nothreads/include \ - -I$(top_srcdir)/lib/isc/unix/include \ - -I$(top_srcdir)/tests +INCLUDES = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/lib/isc/include \ + -I$(top_srcdir)/lib/isc/nothreads/include \ + -I$(top_srcdir)/lib/isc/unix/include \ + -I$(top_srcdir)/sntp TESTS = diff --git a/tests/sntp/Makefile.am b/tests/sntp/Makefile.am deleted file mode 100644 index d2cfb68bd..000000000 --- a/tests/sntp/Makefile.am +++ /dev/null @@ -1,52 +0,0 @@ -check_PROGRAMS = tests - -sntp_src = $(top_builddir)/sntp - -sntp_SOURCES_USED = $(sntp_src)/crypto.o \ - $(sntp_src)/kod_management.o \ - $(sntp_src)/log.o \ - $(sntp_src)/main.o \ - $(sntp_src)/networking.o \ - $(sntp_src)/sntp-opts.o \ - $(sntp_src)/utilities.o - -base_SOURCES = ../tests_main.cpp \ - sntptest.cpp - -tests_SOURCES = $(base_SOURCES) \ - crypto.cpp \ - keyFile.cpp \ - kodDatabase.cpp \ - kodFile.cpp \ - logFile.cpp \ - networking.cpp \ - packetHandling.cpp \ - packetProcessing.cpp \ - utilities.cpp - -LDADD = @GTEST_LDFLAGS@ \ - @GTEST_LIBS@ \ - $(LIBOPTS_LDADD) \ - @top_builddir@/libntp/libntp.a \ - @LCRYPTO@ \ - $(sntp_SOURCES_USED) - -AM_CXXFLAGS = @GTEST_CXXFLAGS@ -AM_CPPFLAGS = @GTEST_CPPFLAGS@ - -INCLUDES = $(LIBOPTS_CFLAGS) -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \ - -I$(top_srcdir)/lib/isc/nothreads/include \ - -I$(top_srcdir)/lib/isc/unix/include \ - -I$(top_srcdir)/tests \ - -I$(top_srcdir)/sntp - -TESTS = - -TEST_INPUT_DIR = $(abs_srcdir)/data -TEST_OUTPUT_DIR = $(abs_builddir)/data - -TESTS_ENVIRONMENT = $(top_srcdir)/tests/sntp/test-driver $(TEST_INPUT_DIR) $(TEST_OUTPUT_DIR) - -if !NTP_CROSSCOMPILE -TESTS += $(check_PROGRAMS) -endif