<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/792239890272ecfbd245eed3d6dd61f7d7f2205b">79223989</a></strong>
<div>
<span>by Amar Takhar</span>
<i>at 2015-12-04T14:34:10Z</i>
</div>
<pre class='commit-message'>Convert libntp/lfptostr.c.</pre>
</li>
<li>
<strong><a href="https://gitlab.com/NTPsec/ntpsec/commit/8afd78030ff7ceeee2087c34bb8ea01dcd6e6a03">8afd7803</a></strong>
<div>
<span>by Amar Takhar</span>
<i>at 2015-12-04T15:16:59Z</i>
</div>
<pre class='commit-message'>Convert ntpdig/packetProcessing.c.
This requires changes to ntpdig/main.c in order to inject the opt_authkey
option. Right now most of the tests are disabled.</pre>
</li>
</ul>
<h4>4 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
tests/common/tests_main.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
tests/libntp/lfptostr.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-2'>
tests/ntpdig/packetProcessing.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-3'>
tests/wscript
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/d19992d7a133f3dbd650d24b00157588c309663f...8afd78030ff7ceeee2087c34bb8ea01dcd6e6a03#diff-0'>
<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">@@ -34,7 +34,7 @@ static void RunAllTests(void)
</span> RUN_TEST_GROUP(kodDatabase);
RUN_TEST_GROUP(kodFile);
RUN_TEST_GROUP(packetHandling);
<span style="color: #000000;background-color: #ffdddd">-// RUN_TEST_GROUP(packetProcessing);
</span><span style="color: #000000;background-color: #ddffdd">+ RUN_TEST_GROUP(packetProcessing);
</span> RUN_TEST_GROUP(utilities);
#endif
<span style="color: #aaaaaa">@@ -50,7 +50,7 @@ static void RunAllTests(void)
</span> RUN_TEST_GROUP(hextolfp);
RUN_TEST_GROUP(humandate);
// RUN_TEST_GROUP(lfp);
<span style="color: #000000;background-color: #ffdddd">-// RUN_TEST_GROUP(lfptostr);
</span><span style="color: #000000;background-color: #ddffdd">+ RUN_TEST_GROUP(lfptostr);
</span> RUN_TEST_GROUP(modetoa);
RUN_TEST_GROUP(msyslog);
RUN_TEST_GROUP(netof);
</code></pre>
<br>
</li>
<li id='diff-1'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/d19992d7a133f3dbd650d24b00157588c309663f...8afd78030ff7ceeee2087c34bb8ea01dcd6e6a03#diff-1'>
<strong>
tests/libntp/lfptostr.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/tests/libntp/lfptostr.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/tests/libntp/lfptostr.c
</span><span style="color: #aaaaaa">@@ -1,10 +1,9 @@
</span> #include "config.h"
#include "ntp_stdlib.h"
<span style="color: #000000;background-color: #ffdddd">-extern "C" {
</span> #include "unity.h"
#include "unity_fixture.h"
<span style="color: #000000;background-color: #ffdddd">-}
</span><span style="color: #000000;background-color: #ddffdd">+#include "ntp_fp.h"
</span>
TEST_GROUP(lfptostr);
<span style="color: #aaaaaa">@@ -19,80 +18,75 @@ TEST_TEAR_DOWN(lfptostr) {}
</span> */
<span style="color: #000000;background-color: #ffdddd">-extern "C" {
-#include "ntp_fp.h"
-};
</span>
<span style="color: #000000;background-color: #ffdddd">-class lfptostrTest : public libntptest {
-protected:
- static const int LFP_MAX_PRECISION = 10;
- static const int LFP_MAX_PRECISION_MS = 7;
</span><span style="color: #000000;background-color: #ddffdd">+static const int LFP_MAX_PRECISION = 10;
+static const int LFP_MAX_PRECISION_MS = 7;
+
+static const int ONE_FOURTH = 1073741824; // (1 << 30)
+static const int HALF = (1 << 31);
+static const int THREE_FOURTH = -ONE_FOURTH;
+static const int HALF_PROMILLE_UP = 2147484; // slightly more than 0.0005
+static const int HALF_PROMILLE_DOWN = 2147483; // slightly less than 0.0005
</span>
<span style="color: #000000;background-color: #ffdddd">- static const int ONE_FOURTH = 1073741824; // (1 << 30)
- static const int HALF = (1 << 31);
- static const int THREE_FOURTH = -ONE_FOURTH;
- static const int HALF_PROMILLE_UP = 2147484; // slightly more than 0.0005
- static const int HALF_PROMILLE_DOWN = 2147483; // slightly less than 0.0005
-};
</span>
TEST(lfptostr, PositiveInteger) {
<span style="color: #000000;background-color: #ffdddd">- l_fp test = {200, 0}; // exact 200.0000000000
</span><span style="color: #000000;background-color: #ddffdd">+ l_fp test = {{200}, 0}; // exact 200.0000000000
</span>
TEST_ASSERT_EQUAL_STRING("200.0000000000", mfptoa(test.l_ui, test.l_uf, LFP_MAX_PRECISION));
TEST_ASSERT_EQUAL_STRING("200000.0000000", mfptoms(test.l_ui, test.l_uf, LFP_MAX_PRECISION_MS));
}
TEST(lfptostr, NegativeInteger) {
<span style="color: #000000;background-color: #ffdddd">- l_fp test = {-100, 0}; // -100
</span><span style="color: #000000;background-color: #ddffdd">+ l_fp test = {{-100}, 0}; // -100
</span>
TEST_ASSERT_EQUAL_STRING("-100.0000000000", lfptoa(&test, LFP_MAX_PRECISION));
TEST_ASSERT_EQUAL_STRING("-100000.0000000", lfptoms(&test, LFP_MAX_PRECISION_MS));
}
TEST(lfptostr, PositiveIntegerWithFraction) {
<span style="color: #000000;background-color: #ffdddd">- l_fp test = {200, ONE_FOURTH}; // 200.25
</span><span style="color: #000000;background-color: #ddffdd">+ l_fp test = {{200}, ONE_FOURTH}; // 200.25
</span>
TEST_ASSERT_EQUAL_STRING("200.2500000000", lfptoa(&test, LFP_MAX_PRECISION));
TEST_ASSERT_EQUAL_STRING("200250.0000000", lfptoms(&test, LFP_MAX_PRECISION_MS));
}
TEST(lfptostr, NegativeIntegerWithFraction) {
<span style="color: #000000;background-color: #ffdddd">- l_fp test = {-100, ONE_FOURTH}; // -99.75
</span><span style="color: #000000;background-color: #ddffdd">+ l_fp test = {{-100}, ONE_FOURTH}; // -99.75
</span>
TEST_ASSERT_EQUAL_STRING("-99.7500000000", lfptoa(&test, LFP_MAX_PRECISION));
TEST_ASSERT_EQUAL_STRING("-99750.0000000", lfptoms(&test, LFP_MAX_PRECISION_MS));
}
TEST(lfptostr, RoundingDownToInteger) {
<span style="color: #000000;background-color: #ffdddd">- l_fp test = {10, ONE_FOURTH}; // 10.25
</span><span style="color: #000000;background-color: #ddffdd">+ l_fp test = {{10}, ONE_FOURTH}; // 10.25
</span>
TEST_ASSERT_EQUAL_STRING("10", lfptoa(&test, 0));
TEST_ASSERT_EQUAL_STRING("10250", lfptoms(&test, 0));
}
TEST(lfptostr, RoundingMiddleToInteger) {
<span style="color: #000000;background-color: #ffdddd">- l_fp test = {10, HALF}; // 10.5
</span><span style="color: #000000;background-color: #ddffdd">+ l_fp test = {{10}, HALF}; // 10.5
</span>
TEST_ASSERT_EQUAL_STRING("11", lfptoa(&test, 0));
TEST_ASSERT_EQUAL_STRING("10500", lfptoms(&test, 0));
}
TEST(lfptostr, RoundingUpToInteger) {
<span style="color: #000000;background-color: #ffdddd">- l_fp test = {5, THREE_FOURTH}; // 5.75
</span><span style="color: #000000;background-color: #ddffdd">+ l_fp test = {{5}, THREE_FOURTH}; // 5.75
</span>
TEST_ASSERT_EQUAL_STRING("6", lfptoa(&test, 0));
TEST_ASSERT_EQUAL_STRING("5750", lfptoms(&test, 0));
}
TEST(lfptostr, SingleDecimal) {
<span style="color: #000000;background-color: #ffdddd">- l_fp test = {8, ONE_FOURTH}; // 8.25
</span><span style="color: #000000;background-color: #ddffdd">+ l_fp test = {{8}, ONE_FOURTH}; // 8.25
</span>
TEST_ASSERT_EQUAL_STRING("8.3", lfptoa(&test, 1));
TEST_ASSERT_EQUAL_STRING("8250.0", lfptoms(&test, 1));
}
TEST(lfptostr, MillisecondsRoundingUp) {
<span style="color: #000000;background-color: #ffdddd">- l_fp test = {1, HALF_PROMILLE_UP}; //slightly more than 1.0005
</span><span style="color: #000000;background-color: #ddffdd">+ l_fp test = {{1}, HALF_PROMILLE_UP}; //slightly more than 1.0005
</span>
TEST_ASSERT_EQUAL_STRING("1.0", lfptoa(&test, 1));
<span style="color: #aaaaaa">@@ -101,7 +95,7 @@ TEST(lfptostr, MillisecondsRoundingUp) {
</span> }
TEST(lfptostr, MillisecondsRoundingDown) {
<span style="color: #000000;background-color: #ffdddd">- l_fp test = {1, HALF_PROMILLE_DOWN}; // slightly less than 1.0005
</span><span style="color: #000000;background-color: #ddffdd">+ l_fp test = {{1}, HALF_PROMILLE_DOWN}; // slightly less than 1.0005
</span>
TEST_ASSERT_EQUAL_STRING("1.0", lfptoa(&test, 1));
<span style="color: #aaaaaa">@@ -110,7 +104,7 @@ TEST(lfptostr, MillisecondsRoundingDown) {
</span> }
TEST(lfptostr, UnsignedInteger) {
<span style="color: #000000;background-color: #ffdddd">- l_fp test = {3000000000UL, 0};
</span><span style="color: #000000;background-color: #ddffdd">+ l_fp test = {{3000000000UL}, 0};
</span>
TEST_ASSERT_EQUAL_STRING("3000000000.0", ulfptoa(&test, 1));
}
</code></pre>
<br>
</li>
<li id='diff-2'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/d19992d7a133f3dbd650d24b00157588c309663f...8afd78030ff7ceeee2087c34bb8ea01dcd6e6a03#diff-2'>
<strong>
tests/ntpdig/packetProcessing.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/tests/ntpdig/packetProcessing.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/tests/ntpdig/packetProcessing.c
</span><span style="color: #aaaaaa">@@ -1,92 +1,83 @@
</span><span style="color: #000000;background-color: #ffdddd">-extern "C" {
</span> #include "unity.h"
#include "unity_fixture.h"
<span style="color: #000000;background-color: #ffdddd">-}
-
-TEST_GROUP(packetProcessing);
-
-TEST_SETUP(packetProcessing) {}
</span>
<span style="color: #000000;background-color: #ffdddd">-TEST_TEAR_DOWN(packetProcessing) {}
</span><span style="color: #000000;background-color: #ddffdd">+//#include "ntpdigtest.h"
</span>
<span style="color: #000000;background-color: #ffdddd">-#include "ntpdigtest.h"
-
-extern "C" {
</span> #include "networking.h"
#include "ntp_stdlib.h"
<span style="color: #000000;background-color: #ffdddd">-};
</span>
<span style="color: #000000;background-color: #ffdddd">-#include <sstream>
-#include <string>
</span><span style="color: #000000;background-color: #ddffdd">+#define TEST_ASSERT_LESS_THAN(a, b) TEST_ASSERT_TRUE(a < b)
+#define TEST_ASSERT_GREATER_THAN(a, b) TEST_ASSERT_TRUE(a > b)
</span>
// Hacks into the key database.
<span style="color: #000000;background-color: #ffdddd">-extern key* key_ptr;
</span><span style="color: #000000;background-color: #ddffdd">+extern struct key* key_ptr;
</span> extern int key_cnt;
<span style="color: #000000;background-color: #ffdddd">-class packetProcessingTest : public ntpdigtest {
-protected:
- pkt testpkt;
- pkt testspkt;
- sockaddr_u testsock;
- bool restoreKeyDb;
-
- void PrepareAuthenticationTest(int key_id,
- int key_len,
- const char* type,
- const void* key_seq) {
- std::stringstream ss;
- ss << key_id;
-
- ActivateOption("-a", ss.str().c_str());
-
- key_cnt = 1;
- key_ptr = new key;
- key_ptr->next = NULL;
- key_ptr->key_id = key_id;
- key_ptr->key_len = key_len;
- memcpy(key_ptr->type, "MD5", 3);
-
- TEST_ASSERT_TRUE(key_len < sizeof(key_ptr->key_seq));
-
- memcpy(key_ptr->key_seq, key_seq, key_ptr->key_len);
- restoreKeyDb = true;
- }
</span><span style="color: #000000;background-color: #ddffdd">+struct pkt testpkt;
+struct pkt testspkt;
+sockaddr_u testsock;
+bool restoreKeyDb;
</span>
<span style="color: #000000;background-color: #ffdddd">- void PrepareAuthenticationTest(int key_id,
- int key_len,
- const void* key_seq) {
- PrepareAuthenticationTest(key_id, key_len, "MD5", key_seq);
- }
</span><span style="color: #000000;background-color: #ddffdd">+TEST_GROUP(packetProcessing);
</span>
<span style="color: #000000;background-color: #ffdddd">- virtual void SetUp() {
- restoreKeyDb = false;
</span><span style="color: #000000;background-color: #ddffdd">+TEST_SETUP(packetProcessing) {
+ restoreKeyDb = false;
</span>
<span style="color: #000000;background-color: #ffdddd">- /* Initialize the test packet and socket,
- * so they contain at least some valid data. */
- testpkt.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING, NTP_VERSION,
- MODE_SERVER);
- testpkt.stratum = STRATUM_REFCLOCK;
- memcpy(&testpkt.refid, "GPS\0", 4);
</span><span style="color: #000000;background-color: #ddffdd">+ /* Initialize the test packet and socket,
+ * so they contain at least some valid data. */
+ testpkt.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING, NTP_VERSION,
+ MODE_SERVER);
+ testpkt.stratum = STRATUM_REFCLOCK;
+ memcpy(&testpkt.refid, "GPS\0", 4);
</span>
<span style="color: #000000;background-color: #ffdddd">- /* Set the origin timestamp of the received packet to the
- * same value as the transmit timestamp of the sent packet. */
- l_fp tmp;
- tmp.l_ui = 1000UL;
- tmp.l_uf = 0UL;
</span><span style="color: #000000;background-color: #ddffdd">+ /* Set the origin timestamp of the received packet to the
+ * same value as the transmit timestamp of the sent packet. */
+ l_fp tmp;
+ tmp.l_ui = 1000UL;
+ tmp.l_uf = 0UL;
</span>
<span style="color: #000000;background-color: #ffdddd">- HTONL_FP(&tmp, &testpkt.org);
- HTONL_FP(&tmp, &testspkt.xmt);
- }
</span><span style="color: #000000;background-color: #ddffdd">+ HTONL_FP(&tmp, &testpkt.org);
+ HTONL_FP(&tmp, &testspkt.xmt);
+}
</span>
<span style="color: #000000;background-color: #ffdddd">- virtual void TearDown() {
- if (restoreKeyDb) {
- key_cnt = 0;
- delete key_ptr;
- key_ptr = NULL;
- }
</span><span style="color: #000000;background-color: #ddffdd">+TEST_TEAR_DOWN(packetProcessing) {
+ if (restoreKeyDb) {
+ key_cnt = 0;
+ key_ptr = NULL;
</span> }
<span style="color: #000000;background-color: #ffdddd">-};
</span><span style="color: #000000;background-color: #ddffdd">+}
+
+/*
+void PrepareAuthenticationTest(int key_id,
+ int key_len,
+ const char* type,
+ const void* key_seq) {
+
+ char key_id_buf[20];
+ snprintf(key_id_buf, 20, "%d", key_id);
+
+ ActivateOption("-a", key_id_buf);
+
+ key_cnt = 1;
+ key_ptr = *key;
+ key_ptr->next = NULL;
+ key_ptr->key_id = key_id;
+ key_ptr->key_len = key_len;
+ memcpy(key_ptr->type, "MD5", 3);
</span>
<span style="color: #000000;background-color: #ddffdd">+ TEST_ASSERT_TRUE(key_len < sizeof(key_ptr->key_seq));
+
+ memcpy(key_ptr->key_seq, key_seq, key_ptr->key_len);
+ restoreKeyDb = true;
+}
+
+void PrepareAuthenticationTest(int key_id,
+ int key_len,
+ const void* key_seq) {
+ PrepareAuthenticationTest(key_id, key_len, "MD5", key_seq);
+}
+
+*/
</span> TEST(packetProcessing, TooShortLength) {
TEST_ASSERT_EQUAL(PACKET_UNUSEABLE,
process_pkt(&testpkt, &testsock, LEN_PKT_NOMAC - 1,
<span style="color: #aaaaaa">@@ -109,7 +100,11 @@ TEST(packetProcessing, TooShortExtensionFieldLength) {
</span> /* The lower 16-bits are the length of the extension field.
* This lengths must be multiples of 4 bytes, which gives
* a minimum of 4 byte extension field length. */
<span style="color: #000000;background-color: #ddffdd">+/* warning: array index 7 is past the end of the array (which contains 6 elements) [-Warray-bounds] */
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Warray-bounds"
</span> testpkt.exten[7] = htonl(3); // 3 bytes is too short.
<span style="color: #000000;background-color: #ddffdd">+#pragma clang diagnostic pop
</span>
/* We send in a pkt_len of header size + 4 byte extension
* header + 24 byte MAC, this prevents the length error to
<span style="color: #aaaaaa">@@ -121,6 +116,7 @@ TEST(packetProcessing, TooShortExtensionFieldLength) {
</span> MODE_SERVER, &testspkt, "UnitTest", true));
}
<span style="color: #000000;background-color: #ddffdd">+/*
</span> TEST(packetProcessing, UnauthenticatedPacketReject) {
// Activate authentication option
ActivateOption("-a", "123");
<span style="color: #aaaaaa">@@ -188,9 +184,10 @@ TEST(packetProcessing, AuthenticatedPacketUnknownKey) {
</span> process_pkt(&testpkt, &testsock, pkt_len,
MODE_SERVER, &testspkt, "UnitTest", true));
}
<span style="color: #000000;background-color: #ddffdd">+*/
</span>
TEST(packetProcessing, ServerVersionTooOld) {
<span style="color: #000000;background-color: #ffdddd">- TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
</span><span style="color: #000000;background-color: #ddffdd">+// TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
</span>
testpkt.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING,
NTP_OLDVERSION - 1,
<span style="color: #aaaaaa">@@ -205,7 +202,7 @@ TEST(packetProcessing, ServerVersionTooOld) {
</span> }
TEST(packetProcessing, ServerVersionTooNew) {
<span style="color: #000000;background-color: #ffdddd">- TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
</span><span style="color: #000000;background-color: #ddffdd">+// TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
</span>
testpkt.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING,
NTP_VERSION + 1,
<span style="color: #aaaaaa">@@ -220,7 +217,7 @@ TEST(packetProcessing, ServerVersionTooNew) {
</span> }
TEST(packetProcessing, NonWantedMode) {
<span style="color: #000000;background-color: #ffdddd">- TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
</span><span style="color: #000000;background-color: #ddffdd">+// TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
</span>
testpkt.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING,
NTP_VERSION,
<span style="color: #aaaaaa">@@ -235,7 +232,7 @@ TEST(packetProcessing, NonWantedMode) {
</span>
/* Tests bug 1597 */
TEST(packetProcessing, KoDRate) {
<span style="color: #000000;background-color: #ffdddd">- TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
</span><span style="color: #000000;background-color: #ddffdd">+// TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
</span>
testpkt.stratum = STRATUM_PKT_UNSPEC;
memcpy(&testpkt.refid, "RATE", 4);
<span style="color: #aaaaaa">@@ -246,7 +243,7 @@ TEST(packetProcessing, KoDRate) {
</span> }
TEST(packetProcessing, KoDDeny) {
<span style="color: #000000;background-color: #ffdddd">- TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
</span><span style="color: #000000;background-color: #ddffdd">+// TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
</span>
testpkt.stratum = STRATUM_PKT_UNSPEC;
memcpy(&testpkt.refid, "DENY", 4);
<span style="color: #aaaaaa">@@ -257,7 +254,7 @@ TEST(packetProcessing, KoDDeny) {
</span> }
TEST(packetProcessing, RejectUnsyncedServer) {
<span style="color: #000000;background-color: #ffdddd">- TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
</span><span style="color: #000000;background-color: #ddffdd">+// TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
</span>
testpkt.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOTINSYNC,
NTP_VERSION,
<span style="color: #aaaaaa">@@ -269,7 +266,7 @@ TEST(packetProcessing, RejectUnsyncedServer) {
</span> }
TEST(packetProcessing, RejectWrongResponseServerMode) {
<span style="color: #000000;background-color: #ffdddd">- TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
</span><span style="color: #000000;background-color: #ddffdd">+// TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
</span>
l_fp tmp;
tmp.l_ui = 1000UL;
<span style="color: #aaaaaa">@@ -286,7 +283,7 @@ TEST(packetProcessing, RejectWrongResponseServerMode) {
</span> }
TEST(packetProcessing, AcceptNoSentPacketBroadcastMode) {
<span style="color: #000000;background-color: #ffdddd">- TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
</span><span style="color: #000000;background-color: #ddffdd">+// TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
</span>
testpkt.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING,
NTP_VERSION,
<span style="color: #aaaaaa">@@ -298,13 +295,14 @@ TEST(packetProcessing, AcceptNoSentPacketBroadcastMode) {
</span> }
TEST(packetProcessing, CorrectUnauthenticatedPacket) {
<span style="color: #000000;background-color: #ffdddd">- TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
</span><span style="color: #000000;background-color: #ddffdd">+// TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
</span>
TEST_ASSERT_EQUAL(LEN_PKT_NOMAC,
process_pkt(&testpkt, &testsock, LEN_PKT_NOMAC,
MODE_SERVER, &testspkt, "UnitTest", true));
}
<span style="color: #000000;background-color: #ddffdd">+/*
</span> TEST(packetProcessing, CorrectAuthenticatedPacketMD5) {
PrepareAuthenticationTest(10, 15, "123456789abcdef");
TEST_ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION));
<span style="color: #aaaaaa">@@ -343,17 +341,34 @@ TEST(packetProcessing, CorrectAuthenticatedPacketSHA1) {
</span> process_pkt(&testpkt, &testsock, pkt_len,
MODE_SERVER, &testspkt, "UnitTest", true));
}
<span style="color: #000000;background-color: #ddffdd">+*/
</span>
TEST_GROUP_RUNNER(packetProcessing) {
<span style="color: #000000;background-color: #ffdddd">- RUN_TEST_CASE(packetProcessing, GenerateUnauthenticatedPacket);
- RUN_TEST_CASE(packetProcessing, GenerateAuthenticatedPacket);
- RUN_TEST_CASE(packetProcessing, OffsetCalculationPositiveOffset);
- RUN_TEST_CASE(packetProcessing, OffsetCalculationNegativeOffset);
- RUN_TEST_CASE(packetProcessing, HandleUnusableServer);
- RUN_TEST_CASE(packetProcessing, HandleUnusablePacket);
- RUN_TEST_CASE(packetProcessing, HandleServerAuthenticationFailure);
- RUN_TEST_CASE(packetProcessing, HandleKodDemobilize);
- RUN_TEST_CASE(packetProcessing, HandleKodRate);
- RUN_TEST_CASE(packetProcessing, HandleCorrectPacket);
</span><span style="color: #000000;background-color: #ddffdd">+ RUN_TEST_CASE(packetProcessing, TooShortLength);
+ RUN_TEST_CASE(packetProcessing, LengthNotMultipleOfFour);
+ RUN_TEST_CASE(packetProcessing, TooShortExtensionFieldLength);
+
+// Need to inject opt_authkey in ntpdig/main.c
+// RUN_TEST_CASE(packetProcessing, UnauthenticatedPacketReject);
+// RUN_TEST_CASE(packetProcessing, CryptoNAKPacketReject);
+// RUN_TEST_CASE(packetProcessing, AuthenticatedPacketInvalid);
+// RUN_TEST_CASE(packetProcessing, AuthenticatedPacketUnknownKey);
+
+/*
+These tests are failing with SERVER_UNUSEABLE (-1) != SERVER_AUTH_FAIL (-3)
+
+ RUN_TEST_CASE(packetProcessing, ServerVersionTooOld);
+ RUN_TEST_CASE(packetProcessing, ServerVersionTooNew);
+ RUN_TEST_CASE(packetProcessing, NonWantedMode);
+ RUN_TEST_CASE(packetProcessing, KoDRate);
+ RUN_TEST_CASE(packetProcessing, KoDDeny);
+ RUN_TEST_CASE(packetProcessing, RejectUnsyncedServer);
+ RUN_TEST_CASE(packetProcessing, RejectWrongResponseServerMode);
+ RUN_TEST_CASE(packetProcessing, AcceptNoSentPacketBroadcastMode);
+ RUN_TEST_CASE(packetProcessing, CorrectUnauthenticatedPacket);
+*/
+
+// Need to inject opt_authkey in ntpdig/main.c
+// RUN_TEST_CASE(packetProcessing, CorrectAuthenticatedPacketMD5);
+// RUN_TEST_CASE(packetProcessing, CorrectAuthenticatedPacketSHA1);
</span> }
<span style="color: #000000;background-color: #ffdddd">-
</span></code></pre>
<br>
</li>
<li id='diff-3'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/d19992d7a133f3dbd650d24b00157588c309663f...8afd78030ff7ceeee2087c34bb8ea01dcd6e6a03#diff-3'>
<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">@@ -30,7 +30,7 @@ def build(ctx):
</span> "ntpdig/kodDatabase.c",
"ntpdig/kodFile.c",
"ntpdig/packetHandling.c",
<span style="color: #000000;background-color: #ffdddd">-# "ntpdig/packetProcessing.c",
</span><span style="color: #000000;background-color: #ddffdd">+ "ntpdig/packetProcessing.c",
</span> "ntpdig/utilities.c",
] + common_source
<span style="color: #aaaaaa">@@ -65,7 +65,7 @@ def build(ctx):
</span> "libntp/hextolfp.c",
"libntp/humandate.c",
# "libntp/lfpfunc.c",
<span style="color: #000000;background-color: #ffdddd">-# "libntp/lfptostr.c",
</span><span style="color: #000000;background-color: #ddffdd">+ "libntp/lfptostr.c",
</span> "libntp/modetoa.c",
"libntp/msyslog.c",
"libntp/netof.c",
</code></pre>
<br>
</li>
</div>
<div class='footer' style='margin-top: 10px;'>
<p>
—
<br>
<a href="https://gitlab.com/NTPsec/ntpsec/compare/d19992d7a133f3dbd650d24b00157588c309663f...8afd78030ff7ceeee2087c34bb8ea01dcd6e6a03">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.
</p>
</div>
</body>
</html>