<html lang='en'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<title>
GitLab
</title>
</meta>
</head>
<style>
img {
max-width: 100%;
height: auto;
}
p.details {
font-style:italic;
color:#777
}
.footer p {
font-size:small;
color:#777
}
pre.commit-message {
white-space: pre-wrap;
}
.file-stats a {
text-decoration: none;
}
.file-stats .new-file {
color: #090;
}
.file-stats .deleted-file {
color: #B00;
}
</style>
<body>
<div class='content'>
<h3>Amar Takhar pushed to branch master at <a href="https://gitlab.com/NTPsec/ntpsec">NTPsec / ntpsec</a></h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://gitlab.com/NTPsec/ntpsec/commit/7cf738ee47216ea8d439f223b2edde5796280a85">7cf738ee</a></strong>
<div>
<span>by Amar Takhar</span>
<i>at 2015-11-20T15:16:43Z</i>
</div>
<pre class='commit-message'>Add output dir fir tests and add more flexible test option passing.</pre>
</li>
<li>
<strong><a href="https://gitlab.com/NTPsec/ntpsec/commit/c650d4a357aa714fee2b49502723fe28bb65460d">c650d4a3</a></strong>
<div>
<span>by Amar Takhar</span>
<i>at 2015-11-20T15:31:40Z</i>
</div>
<pre class='commit-message'>Add kodFile.c to ntpdig tests.</pre>
</li>
<li>
<strong><a href="https://gitlab.com/NTPsec/ntpsec/commit/ce33665f5d97757c594dede326c9a99958741130">ce33665f</a></strong>
<div>
<span>by Amar Takhar</span>
<i>at 2015-11-20T16:08:14Z</i>
</div>
<pre class='commit-message'>Remove debug print that snuck in.</pre>
</li>
<li>
<strong><a href="https://gitlab.com/NTPsec/ntpsec/commit/b3dcc8845ab57c95218e8b73587694e9b1334255">b3dcc884</a></strong>
<div>
<span>by Amar Takhar</span>
<i>at 2015-11-20T16:09:19Z</i>
</div>
<pre class='commit-message'>Add partial work for nameresolution.c
* This was useless as resolve_hosts was only in 4.2.6 sntp.</pre>
</li>
<li>
<strong><a href="https://gitlab.com/NTPsec/ntpsec/commit/83cb3da6e017dcc82b2bc756be713481ea9f0e8f">83cb3da6</a></strong>
<div>
<span>by Amar Takhar</span>
<i>at 2015-11-20T16:10:07Z</i>
</div>
<pre class='commit-message'>Remove nameresolution.(c|cpp) as it tests a deleted function.</pre>
</li>
</ul>
<h4>5 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
pylib/waf.py
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
tests/common/tests_main.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-2'>
tests/ntpdig/kodFile.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-3'>
<span class='deleted-file'>
−
tests/ntpdig/nameresolution.cpp
</span>
</a>
</li>
<li class='file-stats'>
<a href='#diff-4'>
tests/wscript
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/deb812550f5373780aefc65266ea7cb01bbeb584...83cb3da6e017dcc82b2bc756be713481ea9f0e8f#diff-0'>
<strong>
pylib/waf.py
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/pylib/waf.py
</span><span style="color: #000000;background-color: #ddffdd">+++ b/pylib/waf.py
</span><span style="color: #aaaaaa">@@ -73,9 +73,9 @@ def ntp_test(ctx, **kwargs):
</span> bldnode = ctx.bldnode.abspath()
tg = ctx(**kwargs)
<span style="color: #000000;background-color: #ffdddd">- if hasattr(tg, "test_data"):
- test_data = tg.test_data
- else:
- test_data = None
</span><span style="color: #000000;background-color: #ddffdd">+ args = ["%s/tests/%s" % (bldnode, tg.target), "-v"]
</span>
<span style="color: #000000;background-color: #ffdddd">- tg.ut_exec = ["%s/tests/%s" % (bldnode, tg.target), "-v", tg.test_data]
</span><span style="color: #000000;background-color: #ddffdd">+ if hasattr(tg, "test_args"):
+ args += tg.test_args
+
+ tg.ut_exec = args
</span></code></pre>
<br>
</li>
<li id='diff-1'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/deb812550f5373780aefc65266ea7cb01bbeb584...83cb3da6e017dcc82b2bc756be713481ea9f0e8f#diff-1'>
<strong>
tests/common/tests_main.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/tests/common/tests_main.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/tests/common/tests_main.c
</span><span style="color: #aaaaaa">@@ -29,7 +29,7 @@ static void RunAllTests(void)
</span> RUN_TEST_GROUP(crypto);
RUN_TEST_GROUP(keyFile);
RUN_TEST_GROUP(kodDatabase);
<span style="color: #000000;background-color: #ffdddd">-// RUN_TEST_GROUP(kodFile);
</span><span style="color: #000000;background-color: #ddffdd">+ RUN_TEST_GROUP(kodFile);
</span> RUN_TEST_GROUP(packetHandling);
#endif
</code></pre>
<br>
</li>
<li id='diff-2'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/deb812550f5373780aefc65266ea7cb01bbeb584...83cb3da6e017dcc82b2bc756be713481ea9f0e8f#diff-2'>
<strong>
tests/ntpdig/kodFile.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/tests/ntpdig/kodFile.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/tests/ntpdig/kodFile.c
</span><span style="color: #aaaaaa">@@ -90,7 +90,7 @@ TEST(kodFile, WriteEmptyFile) {
</span> * Open file and ensure that the filesize is 0 bytes.
*/
is = fopen(kod_db_file, "wb");
<span style="color: #000000;background-color: #ffdddd">- TEST_ASSERT_NULL(is);
</span><span style="color: #000000;background-color: #ddffdd">+ TEST_ASSERT_NOT_NULL(is);
</span> TEST_ASSERT_FALSE(ferror(is));
TEST_ASSERT_EQUAL(0, GetFileSize(is));
<span style="color: #aaaaaa">@@ -120,11 +120,11 @@ TEST(kodFile, WriteFileWithSingleEntry) {
</span> * Open file and compare sizes.
*/
actual = fopen(kod_db_file, "rb");
<span style="color: #000000;background-color: #ffdddd">- TEST_ASSERT_NULL(actual);
</span><span style="color: #000000;background-color: #ddffdd">+ TEST_ASSERT_NOT_NULL(actual);
</span> TEST_ASSERT_FALSE(ferror(actual));
expected_file = CreatePath("kod-expected-single", INPUT_DIR);;
expected = fopen(expected_file, "rb");
<span style="color: #000000;background-color: #ffdddd">- TEST_ASSERT_NULL(expected);
</span><span style="color: #000000;background-color: #ddffdd">+ TEST_ASSERT_NOT_NULL(expected);
</span> TEST_ASSERT_FALSE(ferror(expected));
TEST_ASSERT_EQUAL(GetFileSize(expected), GetFileSize(actual));
<span style="color: #aaaaaa">@@ -162,11 +162,11 @@ TEST(kodFile, WriteFileWithMultipleEntries) {
</span> * Open file and compare sizes and content.
*/
actual = fopen(kod_db_file, "rb");
<span style="color: #000000;background-color: #ffdddd">- TEST_ASSERT_NULL(actual);
</span><span style="color: #000000;background-color: #ddffdd">+ TEST_ASSERT_NOT_NULL(actual);
</span> TEST_ASSERT_FALSE(ferror(actual));
<span style="color: #000000;background-color: #ffdddd">- expected_file = CreatePath("kod-expected-single", INPUT_DIR);;
</span><span style="color: #000000;background-color: #ddffdd">+ expected_file = CreatePath("kod-expected-multiple", INPUT_DIR);;
</span> expected = fopen(expected_file, "rb");
<span style="color: #000000;background-color: #ffdddd">- TEST_ASSERT_NULL(expected);
</span><span style="color: #000000;background-color: #ddffdd">+ TEST_ASSERT_NOT_NULL(expected);
</span> TEST_ASSERT_FALSE(ferror(expected));
TEST_ASSERT_EQUAL(GetFileSize(expected), GetFileSize(actual));
<span style="color: #aaaaaa">@@ -178,3 +178,12 @@ TEST(kodFile, WriteFileWithMultipleEntries) {
</span> free((void*) kod_db_file);
free((void*) expected_file);
}
<span style="color: #000000;background-color: #ddffdd">+
+TEST_GROUP_RUNNER(kodFile) {
+ RUN_TEST_CASE(kodFile, ReadEmptyFile);
+ RUN_TEST_CASE(kodFile, ReadCorrectFile);
+ RUN_TEST_CASE(kodFile, ReadFileWithBlankLines);
+ RUN_TEST_CASE(kodFile, WriteEmptyFile);
+ RUN_TEST_CASE(kodFile, WriteFileWithSingleEntry);
+ RUN_TEST_CASE(kodFile, WriteFileWithMultipleEntries);
+}
</span></code></pre>
<br>
</li>
<li id='diff-3'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/deb812550f5373780aefc65266ea7cb01bbeb584...83cb3da6e017dcc82b2bc756be713481ea9f0e8f#diff-3'>
<strong>
tests/ntpdig/nameresolution.cpp
</strong>
deleted
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/tests/ntpdig/nameresolution.cpp
</span><span style="color: #000000;background-color: #ddffdd">+++ /dev/null
</span><span style="color: #aaaaaa">@@ -1,182 +0,0 @@
</span><span style="color: #000000;background-color: #ffdddd">-extern "C" {
-#include "unity.h"
-#include "unity_fixture.h"
-}
-
-TEST_GROUP(nameresolution);
-
-TEST_SETUP(nameresolution) {}
-
-TEST_TEAR_DOWN(nameresolution) {}
-
-#include "ntpdigtest.h"
-
-extern "C" {
-#include "networking.h"
-};
-
-class networkingTest : public ntpdigtest {
-protected:
- bool CompareAddrinfo(const char* host,
- int family, int flags,
- const addrinfo& actual) {
- if (family != actual.ai_family)
- return false
- << "Family mismatch, expected: " << family
- << " but was: " << actual.ai_family;
- sockaddr_u* sock = new sockaddr_u;
- void* expectedaddr = NULL, *actualaddr = NULL;
- int size = 0, addrsize = 0;
- if (family == AF_INET) {
- expectedaddr = &sock->sa4.sin_addr;
- actualaddr = &((sockaddr_u*)actual.ai_addr)->sa4.sin_addr;
- size = sizeof(sock->sa4);
- addrsize = sizeof(sock->sa4.sin_addr);
- } else {
- expectedaddr = &sock->sa6.sin6_addr;
- actualaddr = &((sockaddr_u*)actual.ai_addr)->sa6.sin6_addr;
- size = sizeof(sock->sa6);
- addrsize = sizeof(sock->sa6.sin6_addr);
- }
- sock->sa.sa_family = family;
-
- if (inet_pton(family, host, expectedaddr) != 1)
- return false
- << "inet_pton failed!";
-
- if (flags != actual.ai_flags)
- return false
- << "Flags mismatch, expected: " << flags
- << " but was: " << actual.ai_flags;
-
- if (size != actual.ai_addrlen)
- return false
- << "Address length mismatch, expected: " << size
- << " but was: " << actual.ai_addrlen;
-
- if (memcmp(expectedaddr, actualaddr, addrsize) != 0)
- return false
- << "Address mismatch";
- return true;
- }
-};
-
-TEST(networking, ResolveSingleAddress) {
- const char* HOSTS[1] = {"192.0.2.1"};
- const int HOSTCOUNT = COUNTOF(HOSTS);
-
- addrinfo** actual = NULL;
-
- TEST_ASSERT_EQUAL(1, resolve_hosts(HOSTS, HOSTCOUNT, &actual, PF_UNSPEC));
-
- TEST_ASSERT_TRUE(actual != NULL);
- TEST_ASSERT_TRUE(CompareAddrinfo(HOSTS[0], AF_INET, 0, **actual));
-}
-
-TEST(networking, ResolveMultipleAddresses) {
- const char* HOSTS[3] = {"192.0.2.1", "192.0.2.5", "192.0.2.10"};
- const int HOSTCOUNT = COUNTOF(HOSTS);
-
- addrinfo** actual = NULL;
-
- TEST_ASSERT_EQUAL(3, resolve_hosts(HOSTS, HOSTCOUNT, &actual, PF_UNSPEC));
-
- TEST_ASSERT_TRUE(actual != NULL);
- for (int i=0; i<HOSTCOUNT; i++) {
- TEST_ASSERT_TRUE(CompareAddrinfo(HOSTS[i], AF_INET, 0, *actual[i]))
- << "Failed for host number " << i;
- }
-}
-
-TEST(networking, ResolveIPv6Address) {
- const char* HOSTS[1] = {"2001:0DB8:AC10:FE01:0:0:0:0"};
- const int HOSTCOUNT = COUNTOF(HOSTS);
-
- addrinfo** actual = NULL;
-
- TEST_ASSERT_EQUAL(1, resolve_hosts(HOSTS, HOSTCOUNT, &actual, PF_UNSPEC));
- TEST_ASSERT_TRUE(actual != NULL);
-
- TEST_ASSERT_TRUE(CompareAddrinfo(HOSTS[0], AF_INET6, 0, **actual));
-}
-
-TEST(networking, ResolveIPv6InvalidComparision) {
- const char* HOSTS[1] = {"2001:0DB8:AC10:FE01::"};
- const char* INVALID = "2001:0db8:ac10:fe01:0:1:0:0";
- const int HOSTCOUNT = COUNTOF(HOSTS);
-
- addrinfo** actual = NULL;
-
- TEST_ASSERT_EQUAL(1, resolve_hosts(HOSTS, HOSTCOUNT, &actual, PF_UNSPEC));
- TEST_ASSERT_TRUE(actual != NULL);
-
- TEST_ASSERT_FALSE(CompareAddrinfo(INVALID, AF_INET6, 0, **actual));
-}
-
-TEST(networking, ResolveMixedAddressTypes) {
- const char* HOSTS[4] = {"2001:0db8:ac10:fe01::", "192.0.2.10",
- "192.0.2.30", "2001:ab0:1000::"};
- const int FAMILIES[4] = {AF_INET6, AF_INET, AF_INET, AF_INET6};
- const int HOSTCOUNT = COUNTOF(HOSTS);
-
- addrinfo** actual = NULL;
-
- TEST_ASSERT_EQUAL(4, resolve_hosts(HOSTS, HOSTCOUNT, &actual, PF_UNSPEC));
- TEST_ASSERT_TRUE(actual != NULL);
-
- for (int i=0; i<HOSTCOUNT; i++) {
- TEST_ASSERT_TRUE(CompareAddrinfo(HOSTS[i], FAMILIES[i], 0, *actual[i]))
- << "Failed for host number " << i;
- }
-}
-
-TEST(networking, ResolveInvalidAddress) {
- const char* HOSTS[1] = {"192.258.2.1"};
- const int HOSTCOUNT = COUNTOF(HOSTS);
-
- addrinfo** actual = NULL;
-
- TEST_ASSERT_EQUAL(0, resolve_hosts(HOSTS, HOSTCOUNT, &actual, PF_UNSPEC));
-}
-
-TEST(networking, ResolveMixedAddressValidity) {
- const char* HOSTS[3] = {"2001:52ij:130:1::", "192.0.2.13", "192.0.257.1"};
- const int HOSTCOUNT = COUNTOF(HOSTS);
-
- addrinfo** actual = NULL;
-
- TEST_ASSERT_EQUAL(1, resolve_hosts(HOSTS, HOSTCOUNT, &actual, PF_UNSPEC));
- TEST_ASSERT_TRUE(actual != NULL);
-
- TEST_ASSERT_TRUE(CompareAddrinfo(HOSTS[1], AF_INET, 0, **actual));
-}
-
-TEST(networking, ResolveIgnoringIPv6) {
- const char* HOSTS[4] = {"2001:0db8:ac10:fe01::", "192.0.2.10",
- "192.0.2.30", "2001:ab0:1000::"};
- const int FAMILIES[4] = {AF_INET6, AF_INET, AF_INET, AF_INET6};
- const int HOSTCOUNT = COUNTOF(HOSTS);
-
- addrinfo** actual = NULL;
-
- TEST_ASSERT_EQUAL(2, resolve_hosts(HOSTS, HOSTCOUNT, &actual, AF_INET));
- TEST_ASSERT_TRUE(actual != NULL);
-
- TEST_ASSERT_TRUE(CompareAddrinfo(HOSTS[1], FAMILIES[1], 0, *actual[0]));
- TEST_ASSERT_TRUE(CompareAddrinfo(HOSTS[2], FAMILIES[2], 0, *actual[1]));
-}
-
-TEST(networking, ResolveIgnoringIPv4) {
- const char* HOSTS[4] = {"2001:0db8:ac10:fe01::", "192.0.2.10",
- "192.0.2.30", "2001:ab0:1000::"};
- const int FAMILIES[4] = {AF_INET6, AF_INET, AF_INET, AF_INET6};
- const int HOSTCOUNT = COUNTOF(HOSTS);
-
- addrinfo** actual = NULL;
-
- TEST_ASSERT_EQUAL(2, resolve_hosts(HOSTS, HOSTCOUNT, &actual, AF_INET6));
- TEST_ASSERT_TRUE(actual != NULL);
-
- TEST_ASSERT_TRUE(CompareAddrinfo(HOSTS[0], FAMILIES[0], 0, *actual[0]));
- TEST_ASSERT_TRUE(CompareAddrinfo(HOSTS[3], FAMILIES[3], 0, *actual[1]));
-}
</span></code></pre>
<br>
</li>
<li id='diff-4'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/deb812550f5373780aefc65266ea7cb01bbeb584...83cb3da6e017dcc82b2bc756be713481ea9f0e8f#diff-4'>
<strong>
tests/wscript
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/tests/wscript
</span><span style="color: #000000;background-color: #ddffdd">+++ b/tests/wscript
</span><span style="color: #aaaaaa">@@ -26,7 +26,7 @@ def build(ctx):
</span> "ntpdig/fileHandlingTest.c",
"ntpdig/keyFile.c",
"ntpdig/kodDatabase.c",
<span style="color: #000000;background-color: #ffdddd">-# "ntpdig/kodFile.c",
</span><span style="color: #000000;background-color: #ddffdd">+ "ntpdig/kodFile.c",
</span> # "ntpdig/networking.c",
"ntpdig/packetHandling.c",
] + common_source
<span style="color: #aaaaaa">@@ -43,7 +43,7 @@ def build(ctx):
</span> ],
use = "unity ntpdig_obj ntp isc M",
source = ntpdig_source,
<span style="color: #000000;background-color: #ffdddd">- test_data = "%s/tests/ntpdig/data/" % srcnode,
</span><span style="color: #000000;background-color: #ddffdd">+ test_args = ["%s/tests/ntpdig/data/" % srcnode, "%s/tests/ntpdig/" % bldnode]
</span> )
</code></pre>
<br>
</li>
</div>
<div class='footer' style='margin-top: 10px;'>
<p>
—
<br>
<a href="https://gitlab.com/NTPsec/ntpsec/compare/deb812550f5373780aefc65266ea7cb01bbeb584...83cb3da6e017dcc82b2bc756be713481ea9f0e8f">View it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":["merge_requests","issues","commit"],"url":"https://gitlab.com/NTPsec/ntpsec/compare/deb812550f5373780aefc65266ea7cb01bbeb584...83cb3da6e017dcc82b2bc756be713481ea9f0e8f"}}</script>
</p>
</div>
</body>
</html>