- 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>
UnityBegin("t-log.c");
RUN_TEST(testChangePrognameInMysyslog, 9);
RUN_TEST(testOpenLogfileTest, 10);
- RUN_TEST(testWriteInCustomLogfile, 35);
+ RUN_TEST(testWriteInCustomLogfile, 11);
return (UnityEnd());
}
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".
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;
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
//=======External Functions This Runner Calls=====
extern void setUp(void);
extern void tearDown(void);
+extern void test_main(void);
extern void test_main(void );
progname = argv[0];
UnityBegin("bug-2803.c");
RUN_TEST(test_main, 18);
+ RUN_TEST(test_main, 18);
return (UnityEnd());
}
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;
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));
}
//----------------------------------------------------------------------
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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;
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;
}
void
test_GetAndFill(void) {
- int initial = free_recvbuffs();
+ // int initial = free_recvbuffs();
recvbuf_t* buf = get_free_recv_buffer();
add_full_recv_buffer(buf);
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";
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));
}
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));
}
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)
{
const char string[] = "good";
const char *EOstring;
- char *cp;
size_t len;
int failed;
{
const char string[] = "nul\0 there";
const char *EOstring;
- char *cp;
size_t len;
int failed;
{
const char string[] = "trailing space ";
const char *EOstring;
- char *cp;
size_t len;
int failed;