From: Harlan Stenn Date: Thu, 5 Nov 2015 11:47:50 +0000 (+0000) Subject: Unity test cleanup. Harlan Stenn. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e13f9b9305db5382a97d6ea7c8f3f835d7024cad;p=thirdparty%2Fntp.git Unity test cleanup. Harlan Stenn. bk: 563b41e6AwMn7s0FYEvuLKrDp0hbsA --- diff --git a/ChangeLog b/ChangeLog index 775260307..cafc6ac0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ - fixed data race conditions in threaded DNS worker. perlinger@ntp.org - limit threading warm-up to linux; FreeBSD bombs on it. perlinger@ntp.org * Unity cleanup for FreeBSD-6.4. Harlan Stenn. +* Unity test cleanup. Harlan Stenn. --- (4.2.8p4) 2015/10/21 Released by Harlan Stenn (4.2.8p4-RC1) 2015/10/06 Released by Harlan Stenn diff --git a/sntp/tests/run-t-log.c b/sntp/tests/run-t-log.c index dc9fa043b..e6ec758b1 100644 --- a/sntp/tests/run-t-log.c +++ b/sntp/tests/run-t-log.c @@ -51,7 +51,7 @@ int main(int argc, char *argv[]) UnityBegin("t-log.c"); RUN_TEST(testChangePrognameInMysyslog, 9); RUN_TEST(testOpenLogfileTest, 10); - RUN_TEST(testWriteInCustomLogfile, 35); + RUN_TEST(testWriteInCustomLogfile, 11); return (UnityEnd()); } diff --git a/sntp/tests/t-log.c b/sntp/tests/t-log.c index 154658474..f4def6dfc 100644 --- a/sntp/tests/t-log.c +++ b/sntp/tests/t-log.c @@ -8,6 +8,7 @@ void testChangePrognameInMysyslog(void); void testOpenLogfileTest(void); +void testWriteInCustomLogfile(void); //in var/log/syslog (may differ depending on your OS), logged name of the program will be "TEST_PROGNAME". diff --git a/sntp/tests/utilities.c b/sntp/tests/utilities.c index 39d22d61b..a68aaacae 100644 --- a/sntp/tests/utilities.c +++ b/sntp/tests/utilities.c @@ -96,12 +96,12 @@ test_IPv4Address(void) { void test_IPv6Address(void) { - const struct in6_addr address = { + const struct in6_addr address = { { { 0x20, 0x01, 0x0d, 0xb8, 0x85, 0xa3, 0x08, 0xd3, 0x13, 0x19, 0x8a, 0x2e, 0x03, 0x70, 0x73, 0x34 - }; + } } }; const char * expected = "2001:db8:85a3:8d3:1319:8a2e:370:7334"; sockaddr_u input; struct addrinfo inputA; diff --git a/tests/bug-2803/bug-2803.c b/tests/bug-2803/bug-2803.c index 4ee6f0253..df9dcdec7 100644 --- a/tests/bug-2803/bug-2803.c +++ b/tests/bug-2803/bug-2803.c @@ -15,7 +15,7 @@ int simpleTest(void); void setUp(void); void tearDown(void); -//void test_main(void); +void test_main(void); static int verbose = 1; // if not 0, also print results if test passed static int exit_on_err = 0; // if not 0, exit if test failed diff --git a/tests/bug-2803/run-bug-2803.c b/tests/bug-2803/run-bug-2803.c index 05e6a5d03..f4066f25f 100644 --- a/tests/bug-2803/run-bug-2803.c +++ b/tests/bug-2803/run-bug-2803.c @@ -31,6 +31,7 @@ //=======External Functions This Runner Calls===== extern void setUp(void); extern void tearDown(void); +extern void test_main(void); extern void test_main(void ); @@ -51,6 +52,7 @@ int main(int argc, char *argv[]) progname = argv[0]; UnityBegin("bug-2803.c"); RUN_TEST(test_main, 18); + RUN_TEST(test_main, 18); return (UnityEnd()); } diff --git a/tests/libntp/a_md5encrypt.c b/tests/libntp/a_md5encrypt.c index f46376efd..a7912ca40 100644 --- a/tests/libntp/a_md5encrypt.c +++ b/tests/libntp/a_md5encrypt.c @@ -87,12 +87,12 @@ test_IPv4AddressToRefId(void) { void test_IPv6AddressToRefId(void) { - const struct in6_addr address = { + const struct in6_addr address = { { { 0x20, 0x01, 0x0d, 0xb8, 0x85, 0xa3, 0x08, 0xd3, 0x13, 0x19, 0x8a, 0x2e, 0x03, 0x70, 0x73, 0x34 - }; + } } }; sockaddr_u addr; addr.sa6.sin6_family = AF_INET6; diff --git a/tests/libntp/caljulian.c b/tests/libntp/caljulian.c index ecf5d9255..ff35e1ab8 100644 --- a/tests/libntp/caljulian.c +++ b/tests/libntp/caljulian.c @@ -105,24 +105,24 @@ test_LeapYear(void) { void test_uLongBoundary(void) { - u_long time = 4294967295UL; // 2036-02-07 6:28:15 + u_long enc_time = 4294967295UL; // 2036-02-07 6:28:15 struct calendar expected = {2036,0,2,7,6,28,15}; struct calendar actual; - caljulian(time, &actual); + caljulian(enc_time, &actual); TEST_ASSERT_TRUE(IsEqual(expected, actual)); } void test_uLongWrapped(void) { - u_long time = 0; + u_long enc_time = 0; struct calendar expected = {2036,0,2,7,6,28,16}; struct calendar actual; - caljulian(time, &actual); + caljulian(enc_time, &actual); TEST_ASSERT_TRUE(IsEqual(expected, actual)); } diff --git a/tests/libntp/lfpfunc.c b/tests/libntp/lfpfunc.c index 1a13f37a0..1f92a84ad 100644 --- a/tests/libntp/lfpfunc.c +++ b/tests/libntp/lfpfunc.c @@ -283,15 +283,15 @@ eps(double d) //---------------------------------------------------------------------- void test_AdditionLR(void) { - size_t idx = 0; + for (idx = 0; idx < addsub_cnt; ++idx) { l_fp op1 = l_fp_init(addsub_tab[idx][0].h, addsub_tab[idx][0].l); l_fp op2 = l_fp_init(addsub_tab[idx][1].h, addsub_tab[idx][1].l); - l_fp exp = l_fp_init(addsub_tab[idx][2].h, addsub_tab[idx][2].l); + l_fp e_res = l_fp_init(addsub_tab[idx][2].h, addsub_tab[idx][2].l); l_fp res = l_fp_add(op1, op2); - TEST_ASSERT_EQUAL_l_fp(exp, res); + TEST_ASSERT_EQUAL_l_fp(e_res, res); } } @@ -301,10 +301,10 @@ test_AdditionRL(void) { for (idx = 0; idx < addsub_cnt; ++idx) { l_fp op2 = l_fp_init(addsub_tab[idx][0].h, addsub_tab[idx][0].l); l_fp op1 = l_fp_init(addsub_tab[idx][1].h, addsub_tab[idx][1].l); - l_fp exp = l_fp_init(addsub_tab[idx][2].h, addsub_tab[idx][2].l); + l_fp e_res = l_fp_init(addsub_tab[idx][2].h, addsub_tab[idx][2].l); l_fp res = l_fp_add(op1, op2); - TEST_ASSERT_EQUAL_l_fp(exp, res); + TEST_ASSERT_EQUAL_l_fp(e_res, res); } } @@ -318,11 +318,11 @@ test_SubtractionLR(void) { size_t idx = 0; for (idx = 0; idx < addsub_cnt; ++idx) { l_fp op2 = l_fp_init(addsub_tab[idx][0].h, addsub_tab[idx][0].l); - l_fp exp = l_fp_init(addsub_tab[idx][1].h, addsub_tab[idx][1].l); + l_fp e_res = l_fp_init(addsub_tab[idx][1].h, addsub_tab[idx][1].l); l_fp op1 = l_fp_init(addsub_tab[idx][2].h, addsub_tab[idx][2].l); l_fp res = l_fp_subtract(op1, op2); - TEST_ASSERT_EQUAL_l_fp(exp, res); + TEST_ASSERT_EQUAL_l_fp(e_res, res); } } @@ -330,12 +330,12 @@ void test_SubtractionRL(void) { size_t idx = 0; for (idx = 0; idx < addsub_cnt; ++idx) { - l_fp exp = l_fp_init(addsub_tab[idx][0].h, addsub_tab[idx][0].l); + l_fp e_res = l_fp_init(addsub_tab[idx][0].h, addsub_tab[idx][0].l); l_fp op2 = l_fp_init(addsub_tab[idx][1].h, addsub_tab[idx][1].l); l_fp op1 = l_fp_init(addsub_tab[idx][2].h, addsub_tab[idx][2].l); l_fp res = l_fp_subtract(op1, op2); - TEST_ASSERT_EQUAL_l_fp(exp, res); + TEST_ASSERT_EQUAL_l_fp(e_res, res); } } diff --git a/tests/libntp/netof.c b/tests/libntp/netof.c index 2fde6cc2e..b0fcc1b1d 100644 --- a/tests/libntp/netof.c +++ b/tests/libntp/netof.c @@ -50,19 +50,19 @@ void test_ClassAAddress(void) { void test_IPv6Address(void) { /* IPv6 addresses are assumed to have 64-bit host- and 64-bit network parts. */ - const struct in6_addr input_address = { + const struct in6_addr input_address = { { { 0x20, 0x01, 0x0d, 0xb8, - 0x85, 0xa3, 0x08, 0xd3, - 0x13, 0x19, 0x8a, 0x2e, - 0x03, 0x70, 0x73, 0x34 - }; // 2001:0db8:85a3:08d3:1319:8a2e:0370:7334 + 0x85, 0xa3, 0x08, 0xd3, + 0x13, 0x19, 0x8a, 0x2e, + 0x03, 0x70, 0x73, 0x34 + } } }; // 2001:0db8:85a3:08d3:1319:8a2e:0370:7334 - const struct in6_addr expected_address = { + const struct in6_addr expected_address = { { { 0x20, 0x01, 0x0d, 0xb8, - 0x85, 0xa3, 0x08, 0xd3, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 - }; // 2001:0db8:85a3:08d3:0000:0000:0000:0000 + 0x85, 0xa3, 0x08, 0xd3, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 + } } }; // 2001:0db8:85a3:08d3:0000:0000:0000:0000 sockaddr_u input; input.sa6.sin6_family = AF_INET6; diff --git a/tests/libntp/prettydate.c b/tests/libntp/prettydate.c index e1292bf61..981e14699 100644 --- a/tests/libntp/prettydate.c +++ b/tests/libntp/prettydate.c @@ -13,8 +13,9 @@ void test_ConstantDate(void) { const u_int32 HALF = 2147483648UL; - l_fp time = {{3485080800UL}, HALF}; /* 2010-06-09 14:00:00.5 */ + l_fp e_time = {{3485080800UL}, HALF}; /* 2010-06-09 14:00:00.5 */ TEST_ASSERT_EQUAL_STRING("cfba1ce0.80000000 Wed, Jun 9 2010 14:00:00.500", - gmprettydate(&time)); + gmprettydate(&e_time)); + return; } diff --git a/tests/libntp/recvbuff.c b/tests/libntp/recvbuff.c index 6d6cf8e5f..b9299d2e4 100644 --- a/tests/libntp/recvbuff.c +++ b/tests/libntp/recvbuff.c @@ -36,7 +36,7 @@ test_GetAndFree(void) { void test_GetAndFill(void) { - int initial = free_recvbuffs(); + // int initial = free_recvbuffs(); recvbuf_t* buf = get_free_recv_buffer(); add_full_recv_buffer(buf); diff --git a/tests/libntp/socktoa.c b/tests/libntp/socktoa.c index 6661fa553..dc77ecfb4 100644 --- a/tests/libntp/socktoa.c +++ b/tests/libntp/socktoa.c @@ -62,12 +62,12 @@ test_IPv6AddressWithPort(void) { void test_ScopedIPv6AddressWithPort(void) { #ifdef ISC_PLATFORM_HAVESCOPEID - const struct in6_addr address = { + const struct in6_addr address = { { { 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x12, 0x3f, 0xff, 0xfe, 0x29, 0xff, 0xfa - }; + } } }; const char* expected = "fe80::212:3fff:fe29:fffa%5"; diff --git a/tests/libntp/uglydate.c b/tests/libntp/uglydate.c index f47f3e429..a044314cb 100644 --- a/tests/libntp/uglydate.c +++ b/tests/libntp/uglydate.c @@ -11,8 +11,8 @@ void test_ConstantDateTime(void) { const u_int32 HALF = 2147483648UL; - l_fp time = {{3485080800UL}, HALF}; /* 2010-06-09 14:00:00.5 */ + l_fp e_time = {{3485080800UL}, HALF}; /* 2010-06-09 14:00:00.5 */ TEST_ASSERT_EQUAL_STRING("3485080800.500000 10:159:14:00:00.500", - uglydate(&time)); + uglydate(&e_time)); } diff --git a/tests/sandbox/smeartest.c b/tests/sandbox/smeartest.c index a8ee2102e..98fa51f2d 100644 --- a/tests/sandbox/smeartest.c +++ b/tests/sandbox/smeartest.c @@ -125,6 +125,7 @@ ltor(l_fp l) } +int main() { l_fp l; diff --git a/tests/sandbox/uglydate.c b/tests/sandbox/uglydate.c index a7879c117..5bc639ece 100644 --- a/tests/sandbox/uglydate.c +++ b/tests/sandbox/uglydate.c @@ -9,8 +9,8 @@ void test_ConstantDateTime(void) { const u_int32 HALF = 2147483648UL; - l_fp time = {3485080800UL, HALF}; // 2010-06-09 14:00:00.5 + l_fp e_time = {{3485080800UL}, HALF}; // 2010-06-09 14:00:00.5 TEST_ASSERT_EQUAL_STRING("3485080800.500000 10:159:14:00:00.500", - uglydate(&time)); + uglydate(&e_time)); } diff --git a/tests/sec-2853/sec-2853.c b/tests/sec-2853/sec-2853.c index 49589d283..fd89c5b82 100644 --- a/tests/sec-2853/sec-2853.c +++ b/tests/sec-2853/sec-2853.c @@ -13,7 +13,7 @@ int embedded_nul( void ); int trailing_space( void ); static int verbose = 1; // if not 0, also print results if test passed -static int exit_on_err = 0; // if not 0, exit if test failed +// static int exit_on_err = 0; // if not 0, exit if test failed void setUp(void) @@ -49,7 +49,6 @@ int basic_good( void ) { const char string[] = "good"; const char *EOstring; - char *cp; size_t len; int failed; @@ -74,7 +73,6 @@ int embedded_nul( void ) { const char string[] = "nul\0 there"; const char *EOstring; - char *cp; size_t len; int failed; @@ -99,7 +97,6 @@ int trailing_space( void ) { const char string[] = "trailing space "; const char *EOstring; - char *cp; size_t len; int failed;