From: Damir Tomic Date: Sat, 1 Aug 2015 20:40:51 +0000 (+0200) Subject: ntp_signdT.c: X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a82444cfa5e8d516fcf0922f6f0f6055239aea9;p=thirdparty%2Fntp.git ntp_signdT.c: 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 --- diff --git a/tests/ntpd/Makefile.am b/tests/ntpd/Makefile.am index bf61fb594..7b859c79d 100644 --- a/tests/ntpd/Makefile.am +++ b/tests/ntpd/Makefile.am @@ -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 \ diff --git a/tests/ntpd/ntp_signdT.c b/tests/ntpd/ntp_signdT.c index 710183d39..81162e4ef 100644 --- a/tests/ntpd/ntp_signdT.c +++ b/tests/ntpd/ntp_signdT.c @@ -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"; diff --git a/tests/ntpd/run-ntp_signdT.c b/tests/ntpd/run-ntp_signdT.c index 5e5700acf..f52065c55 100644 --- a/tests/ntpd/run-ntp_signdT.c +++ b/tests/ntpd/run-ntp_signdT.c @@ -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()); }