]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Unity test cleanup. Harlan Stenn.
authorHarlan Stenn <stenn@ntp.org>
Thu, 5 Nov 2015 11:47:50 +0000 (11:47 +0000)
committerHarlan Stenn <stenn@ntp.org>
Thu, 5 Nov 2015 11:47:50 +0000 (11:47 +0000)
bk: 563b41e6AwMn7s0FYEvuLKrDp0hbsA

17 files changed:
ChangeLog
sntp/tests/run-t-log.c
sntp/tests/t-log.c
sntp/tests/utilities.c
tests/bug-2803/bug-2803.c
tests/bug-2803/run-bug-2803.c
tests/libntp/a_md5encrypt.c
tests/libntp/caljulian.c
tests/libntp/lfpfunc.c
tests/libntp/netof.c
tests/libntp/prettydate.c
tests/libntp/recvbuff.c
tests/libntp/socktoa.c
tests/libntp/uglydate.c
tests/sandbox/smeartest.c
tests/sandbox/uglydate.c
tests/sec-2853/sec-2853.c

index 7752603079553f16ee109281f49d3ecc2da76936..cafc6ac0ae39c6184717a9a799ba68243f24a73a 100644 (file)
--- 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 <stenn@ntp.org>
 (4.2.8p4-RC1) 2015/10/06 Released by Harlan Stenn <stenn@ntp.org>
index dc9fa043bda7e7eb072954f80c3c685fbab6ec6a..e6ec758b1bfd7330e30fa1c7fae2ffaa97ce332c 100644 (file)
@@ -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());
 }
index 154658474e56e8e68250f632f8c447c6e745db22..f4def6dfc6126dd643b929a6e2c715540c258582 100644 (file)
@@ -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".
index 39d22d61bdca45a420baea7729a45f6800f4464a..a68aaacae9aef0aaf1ff7b4fa024071c0154f809 100644 (file)
@@ -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;
index 4ee6f02532a1840785791b7e290d68e514d224a7..df9dcdec77744ab68f52a61e3440775488a0fe4b 100644 (file)
@@ -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
index 05e6a5d03c45ddf79f473387c961ad6dd7e0574c..f4066f25f826e0326a8c29a7ccb099373347c49f 100644 (file)
@@ -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());
 }
index f46376efd343767af9f657e0ea3453802e70b97b..a7912ca4074fd3fdeeeb13084602b4e6416377a5 100644 (file)
@@ -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;
index ecf5d9255620801d63945a7af9a8fcccd6b9946e..ff35e1ab8173157554bbeabb19ca6287e53a3841 100644 (file)
@@ -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));
 }
index 1a13f37a0ae11a18477140851f71e3219ce6bb81..1f92a84ad2513122263a3bcb0d706e5c5af76289 100644 (file)
@@ -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);
        }       
 }
 
index 2fde6cc2e44859c2d0609e11f58d3aafe3b1d6a8..b0fcc1b1d3c5683d033e8164946d37d679b87472 100644 (file)
@@ -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;
index e1292bf6156e6e7e3e30eb5a7f13ac6fd4fca225..981e14699a42f10e063db01ae8327fb755a298be 100644 (file)
@@ -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;
 }
index 6d6cf8e5fe9beab4cd214cbb14c7e8c5f9866270..b9299d2e4d5915f18bb6e21c2ff69d0da59dec2a 100644 (file)
@@ -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);
index 6661fa553c890078996daed8fb3df4a6199df341..dc77ecfb4bf6cf89527cc8de54f48b4fc8703a98 100644 (file)
@@ -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";
index f47f3e429375896edc2c679617e5586813976acc..a044314cb4db0bff28ed13a27fa4854329e137db 100644 (file)
@@ -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));
 }
index a8ee2102e8742310793f91fd99f4f238e7862ddf..98fa51f2d79485661848f895880b6301c6cb4faf 100644 (file)
@@ -125,6 +125,7 @@ ltor(l_fp l)
 }
 
 
+int
 main()
 {
        l_fp l;
index a7879c117acdbd697be6584369967fd9ff30b137..5bc639ecea46343548c169b152406553758b3efa 100644 (file)
@@ -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));
 }
index 49589d28363317e336c3909abb891d5461fa86dc..fd89c5b82feec9adf231f2420de876472bd46d47 100644 (file)
@@ -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;