From: Damir Tomic Date: Sat, 1 Aug 2015 18:49:22 +0000 (+0200) Subject: Makefile.am: X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3f72359c2217d2e9e7c821a75aec6928c8f1abf;p=thirdparty%2Fntp.git Makefile.am: added ntp_signdT ntp_signdT.c, run-ntp_signdT.c: new file bk: 55bd14b2VevHNrVjvFBULfdihHxHYA --- diff --git a/tests/ntpd/Makefile.am b/tests/ntpd/Makefile.am index c9430efcd..bf61fb594 100644 --- a/tests/ntpd/Makefile.am +++ b/tests/ntpd/Makefile.am @@ -14,6 +14,7 @@ check_PROGRAMS = \ test-ntp_restrict \ test-rc_cmdlength \ test-ntp_scanner \ + test-ntp_signdT \ $(NULL) # test-ntp_signd \ #doesn't work, can't link it because you can't link static function @@ -69,7 +70,7 @@ BUILT_SOURCES += \ $(srcdir)/run-ntp_prio_q.c \ $(srcdir)/run-ntp_restrict.c \ $(srcdir)/run-rc_cmdlength.c \ - $(srcdir)/run-ntp_signd.c \ + $(srcdir)/run-ntp_signdT.c \ $(NULL) noinst_HEADERS = g_ntpdtest.h \ @@ -154,25 +155,26 @@ $(srcdir)/run-rc_cmdlength.c: $(srcdir)/rc_cmdlength.c $(std_unity_list) $(run_unity) rc_cmdlength.c run-rc_cmdlength.c ### -test_ntp_signd_CFLAGS = \ +test_ntp_signdT_CFLAGS = \ -I$(top_srcdir)/sntp/unity \ $(NULL) -test_ntp_signd_LDADD = \ +test_ntp_signdT_LDADD = \ $(unity_tests_LDADD) \ $(top_builddir)/ntpd/libntpd.a \ $(top_builddir)/ntpd/ntp_signd.o \ $(unity_tests_LDADD) \ $(NULL) -test_ntp_signd_SOURCES = \ - ntp_signd.c \ - run-ntp_signd.c \ +test_ntp_signdT_SOURCES = \ + ntp_signdT.c \ + run-ntp_signdT.c \ $(srcdir)/../libntp/test-libntp.c \ + $(srcdir)/../../ntpd/ntp_signd.c \ $(NULL) -$(srcdir)/run-ntp_signd.c: $(srcdir)/ntp_signd.c $(std_unity_list) - $(run_unity) ntp_signd.c run-ntp_signd.c +$(srcdir)/run-ntp_signdT.c: $(srcdir)/ntp_signdT.c $(std_unity_list) + $(run_unity) ntp_signdT.c run-ntp_signdT.c ### test_ntp_scanner_CFLAGS = \ diff --git a/tests/ntpd/ntp_signdT.c b/tests/ntpd/ntp_signdT.c new file mode 100644 index 000000000..710183d39 --- /dev/null +++ b/tests/ntpd/ntp_signdT.c @@ -0,0 +1,28 @@ +#include "config.h" + +#include "ntp.h" +#include "ntp_calendar.h" +#include "ntp_stdlib.h" + +#include "unity.h" + +#include "test-libntp.h" + +#include "ntp_signd.c" + +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")); + + + //write_all() + char *socketName = "Random_Socket_Name"; + int length = strlen(socketName); + +} + +void +test_write_all(void){ + +} diff --git a/tests/ntpd/run-ntp_signdT.c b/tests/ntpd/run-ntp_signdT.c new file mode 100644 index 000000000..5e5700acf --- /dev/null +++ b/tests/ntpd/run-ntp_signdT.c @@ -0,0 +1,58 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include +#include "config.h" +#include "ntp.h" +#include "ntp_calendar.h" +#include "ntp_stdlib.h" +#include "test-libntp.h" + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_ux_socket_connect(void); +extern void test_write_all(void); + + +//=======Test Reset Option===== +void resetTest(void); +void resetTest(void) +{ + tearDown(); + setUp(); +} + +char *progname; + + +//=======MAIN===== +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); + + return (UnityEnd()); +}