]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
ntp_signdT.c:
authorDamir Tomic <viperus@ntp.org>
Sat, 1 Aug 2015 20:40:51 +0000 (22:40 +0200)
committerDamir Tomic <viperus@ntp.org>
Sat, 1 Aug 2015 20:40:51 +0000 (22:40 +0200)
  MUST ADD #define HAVE_NTP_NAME above the #include "ntp_NAME.c"
Makefile.am:

  Added test ntp_singd again, renamed it to ntp_signdT (including the original ntp_signd.c doesn't work if you have 2 files with the same name).
  I included the original ntp_signd.c, so static functions can be tested.
  Additional .o objects had to be added for everyhting to work.

run-ntp_signdT.c:
  autogenerated

bk: 55bd2ed3Y5LQjK6E5iGheMWIPpsJMA

tests/ntpd/Makefile.am
tests/ntpd/ntp_signdT.c
tests/ntpd/run-ntp_signdT.c

index bf61fb594dc2dfc44751cbf20d6cbabd8e74afd9..7b859c79dee03761a3d118b533b286d99dea4d61 100644 (file)
@@ -61,7 +61,7 @@ tests_SOURCES = $(top_srcdir)/sntp/tests_main.cpp     \
                $(top_srcdir)/ntpd/ntp_prio_q.c         \
                $(top_srcdir)/ntpd/ntp_restrict.c       \
                $(top_srcdir)/ntpd/rc_cmdlength.c       \
-               $(top_srcdir)/ntpd/ntp_signd.c  \
+               $(top_srcdir)/ntpd/ntp_signd.c          \
                g_leapsec.cpp   \
                $(NULL)
 
@@ -157,15 +157,20 @@ $(srcdir)/run-rc_cmdlength.c: $(srcdir)/rc_cmdlength.c $(std_unity_list)
 ###
 test_ntp_signdT_CFLAGS =                       \
        -I$(top_srcdir)/sntp/unity      \
+       -Iwhy.h         \
        $(NULL)
 
 test_ntp_signdT_LDADD =                        \
        $(unity_tests_LDADD)            \
        $(top_builddir)/ntpd/libntpd.a  \
-       $(top_builddir)/ntpd/ntp_signd.o        \
        $(unity_tests_LDADD)            \
+       $(top_builddir)/ntpd/ntp_signd.o        \
+       $(top_builddir)/ntpd/ntp_config.o       \
+       $(top_builddir)/ntpd/ntp_io.o   \
        $(NULL)
 
+#      $(top_builddir)/ntpd/ntp_signd.o
+
 test_ntp_signdT_SOURCES =                      \
        ntp_signdT.c                    \
        run-ntp_signdT.c                        \
index 710183d39f53c96ed6da426e248d6acce6485ed1..81162e4ef6e0de8d61b446c3544bb80f006e5926 100644 (file)
@@ -8,13 +8,28 @@
 
 #include "test-libntp.h"
 
+#define HAVE_NTP_SIGND
+
 #include "ntp_signd.c"
 
+//extern int ux_socket_connect(const char *name);
+
+
 void 
 test_ux_socket_connect(void){
-       TEST_ASSERT_EQUAL(-1, ux_socket_connect(NULL));
-       TEST_ASSERT_EQUAL(-1, ux_socket_connect("127.0.0.1"));
 
+//send_via_ntp_signd(NULL,NULL,NULL,NULL,NULL);        
+       /*
+       send_via_ntp_signd(
+       struct recvbuf *rbufp,  
+       int     xmode,
+       keyid_t xkeyid, 
+       int flags,
+       struct pkt  *xpkt)
+*/
+       TEST_ASSERT_EQUAL(-1, ux_socket_connect(NULL));
+       //TEST_ASSERT_EQUAL(-1, ux_socket_connect("127.0.0.1:123"));
+       TEST_ASSERT_EQUAL(-1, ux_socket_connect("/socket"));
 
        //write_all()
        char *socketName = "Random_Socket_Name";
index 5e5700acfa0a1b105d6354f9bdeba27b01e607ec..f52065c55056e90009d026c3fb4c288efd6b1b23 100644 (file)
@@ -51,8 +51,8 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("ntp_signdT.c");
-  RUN_TEST(test_ux_socket_connect, 14);
-  RUN_TEST(test_write_all, 26);
+  RUN_TEST(test_ux_socket_connect, 19);
+  RUN_TEST(test_write_all, 41);
 
   return (UnityEnd());
 }