From: Damir Tomic Date: Thu, 25 Jun 2015 14:34:19 +0000 (+0200) Subject: packetProcessing.c: X-Git-Tag: NTP_4_2_8P3_RC3~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=240162e703bd5f7218c6e90e66f61460308814f3;p=thirdparty%2Fntp.git packetProcessing.c: fixed SetUp() -> setUp() and TearDown() -> tearDown() which seemed to work because of extern functions bk: 558c116b-voNJrcEWcMo1XSIoHrZmA --- diff --git a/sntp/tests/packetProcessing.c b/sntp/tests/packetProcessing.c index 34ac79007..27ab72e4d 100644 --- a/sntp/tests/packetProcessing.c +++ b/sntp/tests/packetProcessing.c @@ -43,7 +43,9 @@ void PrepareAuthenticationTestMD5(int key_id, PrepareAuthenticationTest(key_id, key_len, "MD5", key_seq); } -void SetUp() { +void setUp() { + + sntptest(); restoreKeyDb = false; /* Initialize the test packet and socket, @@ -64,7 +66,7 @@ void SetUp() { } -void TearDown() { +void tearDown() { if (restoreKeyDb) { key_cnt = 0; @@ -72,7 +74,7 @@ void TearDown() { key_ptr = NULL; } - //sntptest_destroy(); //only on the final test!! if counter == 0 etc... + sntptest_destroy(); //only on the final test!! if counter == 0 etc... } @@ -113,7 +115,7 @@ void test_TooShortExtensionFieldLength(void) { } void test_UnauthenticatedPacketReject(void) { - sntptest(); + //sntptest(); // Activate authentication option ActivateOption("-a", "123"); TEST_ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION)); @@ -127,7 +129,6 @@ void test_UnauthenticatedPacketReject(void) { } void test_CryptoNAKPacketReject(void) { -sntptest_destroy(); // Activate authentication option ActivateOption("-a", "123"); TEST_ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION)); @@ -140,7 +141,6 @@ sntptest_destroy(); } void test_AuthenticatedPacketInvalid(void) { -sntptest_destroy(); // Activate authentication option PrepareAuthenticationTestMD5(50, 9, "123456789"); TEST_ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION)); @@ -163,7 +163,7 @@ sntptest_destroy(); MODE_SERVER, &testspkt, "UnitTest")); } -void test_AuthenticatedPacketUnknownKey(void) {sntptest_destroy(); +void test_AuthenticatedPacketUnknownKey(void) { // Activate authentication option PrepareAuthenticationTestMD5(30, 9, "123456789"); TEST_ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION)); @@ -279,7 +279,7 @@ void test_RejectWrongResponseServerMode(void) { MODE_SERVER, &testspkt, "UnitTest")); } -void test_AcceptNoSentPacketBroadcastMode(void) { sntptest_destroy(); +void test_AcceptNoSentPacketBroadcastMode(void) { TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION)); testpkt.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING, @@ -291,7 +291,7 @@ void test_AcceptNoSentPacketBroadcastMode(void) { sntptest_destroy(); MODE_BROADCAST, NULL, "UnitTest")); } -void test_CorrectUnauthenticatedPacket(void) { sntptest_destroy(); +void test_CorrectUnauthenticatedPacket(void) { TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION)); TEST_ASSERT_EQUAL(LEN_PKT_NOMAC, @@ -299,7 +299,7 @@ void test_CorrectUnauthenticatedPacket(void) { sntptest_destroy(); MODE_SERVER, &testspkt, "UnitTest")); } -void test_CorrectAuthenticatedPacketMD5(void) { sntptest_destroy(); +void test_CorrectAuthenticatedPacketMD5(void) { PrepareAuthenticationTestMD5(10, 15, "123456789abcdef"); TEST_ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION)); @@ -319,7 +319,7 @@ void test_CorrectAuthenticatedPacketMD5(void) { sntptest_destroy(); } -void test_CorrectAuthenticatedPacketSHA1(void) { sntptest_destroy(); +void test_CorrectAuthenticatedPacketSHA1(void) { PrepareAuthenticationTest(20, 15, "SHA1", "abcdefghijklmno"); TEST_ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION)); diff --git a/sntp/tests/run-packetProcessing.c b/sntp/tests/run-packetProcessing.c index b222d6eda..f41d5c7eb 100644 --- a/sntp/tests/run-packetProcessing.c +++ b/sntp/tests/run-packetProcessing.c @@ -63,12 +63,12 @@ int main(int argc, char *argv[]) progname = argv[0]; Unity.TestFile = "packetProcessing.c"; UnityBegin("packetProcessing.c"); - RUN_TEST(test_TooShortLength, 81); - RUN_TEST(test_LengthNotMultipleOfFour, 90); - RUN_TEST(test_TooShortExtensionFieldLength, 99); - RUN_TEST(test_UnauthenticatedPacketReject, 115); - RUN_TEST(test_CryptoNAKPacketReject, 129); - RUN_TEST(test_AuthenticatedPacketInvalid, 142); + RUN_TEST(test_TooShortLength, 83); + RUN_TEST(test_LengthNotMultipleOfFour, 92); + RUN_TEST(test_TooShortExtensionFieldLength, 101); + RUN_TEST(test_UnauthenticatedPacketReject, 117); + RUN_TEST(test_CryptoNAKPacketReject, 131); + RUN_TEST(test_AuthenticatedPacketInvalid, 143); RUN_TEST(test_AuthenticatedPacketUnknownKey, 166); RUN_TEST(test_ServerVersionTooOld, 186); RUN_TEST(test_ServerVersionTooNew, 201);