You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2018/02/01 01:14:44 UTC

[trafficserver] branch quic-latest updated (3f4fe3d -> 7452dc2)

This is an automated email from the ASF dual-hosted git repository.

masaori pushed a change to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git.


    from 3f4fe3d  Fix tests for QUICHandshake
     new 14dc16c  Write debug logs in stderr when unit tests run
     new 7452dc2  Cleanup test_QUICCrypto

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 iocore/net/quic/test/event_processor_main.cc | 10 +++--
 iocore/net/quic/test/main.cc                 | 17 ++++++++
 iocore/net/quic/test/test_QUICCrypto.cc      | 63 ++++++++--------------------
 3 files changed, 41 insertions(+), 49 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
masaori@apache.org.

[trafficserver] 01/02: Write debug logs in stderr when unit tests run

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 14dc16cc951b99f312f209e546ea4ce139c5b4f5
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Thu Feb 1 10:13:41 2018 +0900

    Write debug logs in stderr when unit tests run
---
 iocore/net/quic/test/event_processor_main.cc | 10 +++++++---
 iocore/net/quic/test/main.cc                 | 17 +++++++++++++++++
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/iocore/net/quic/test/event_processor_main.cc b/iocore/net/quic/test/event_processor_main.cc
index fbfead6..9132a38 100644
--- a/iocore/net/quic/test/event_processor_main.cc
+++ b/iocore/net/quic/test/event_processor_main.cc
@@ -27,9 +27,8 @@
 #include "catch.hpp"
 
 #include "I_EventSystem.h"
-#include "ts/ink_string.h"
 #include "ts/I_Layout.h"
-#include "diags.i"
+#include "ts/Diags.h"
 
 #define TEST_THREADS 1
 
@@ -39,8 +38,13 @@ struct EventProcessorListener : Catch::TestEventListenerBase {
   virtual void
   testRunStarting(Catch::TestRunInfo const &testRunInfo) override
   {
+    BaseLogFile *base_log_file = new BaseLogFile("stderr");
+    diags                      = new Diags(testRunInfo.name.c_str(), "" /* tags */, "" /* actions */, base_log_file);
+    diags->activate_taglist("vv_quic|quic", DiagsTagType_Debug);
+    diags->config.enabled[DiagsTagType_Debug] = true;
+    diags->show_location                      = SHOW_LOCATION_DEBUG;
+
     Layout::create();
-    init_diags("", nullptr);
     RecProcessInit(RECM_STAND_ALONE);
 
     ink_event_system_init(EVENT_SYSTEM_MODULE_VERSION);
diff --git a/iocore/net/quic/test/main.cc b/iocore/net/quic/test/main.cc
index 213dec8..f611f5e 100644
--- a/iocore/net/quic/test/main.cc
+++ b/iocore/net/quic/test/main.cc
@@ -25,3 +25,20 @@
 // https://github.com/philsquared/Catch/blob/master/docs/slow-compiles.md
 #define CATCH_CONFIG_MAIN
 #include "catch.hpp"
+
+#include "ts/Diags.h"
+
+struct EventProcessorListener : Catch::TestEventListenerBase {
+  using TestEventListenerBase::TestEventListenerBase; // inherit constructor
+
+  virtual void
+  testRunStarting(Catch::TestRunInfo const &testRunInfo) override
+  {
+    BaseLogFile *base_log_file = new BaseLogFile("stderr");
+    diags                      = new Diags(testRunInfo.name.c_str(), "" /* tags */, "" /* actions */, base_log_file);
+    diags->activate_taglist("vv_quic|quic", DiagsTagType_Debug);
+    diags->config.enabled[DiagsTagType_Debug] = true;
+    diags->show_location                      = SHOW_LOCATION_DEBUG;
+  }
+};
+CATCH_REGISTER_LISTENER(EventProcessorListener);

-- 
To stop receiving notification emails like this one, please contact
masaori@apache.org.

[trafficserver] 02/02: Cleanup test_QUICCrypto

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 7452dc21dfd2410ef30e510551134ed45d8fd09d
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Thu Feb 1 10:14:29 2018 +0900

    Cleanup test_QUICCrypto
---
 iocore/net/quic/test/test_QUICCrypto.cc | 63 +++++++++------------------------
 1 file changed, 17 insertions(+), 46 deletions(-)

diff --git a/iocore/net/quic/test/test_QUICCrypto.cc b/iocore/net/quic/test/test_QUICCrypto.cc
index aea6249..e0a2b72 100644
--- a/iocore/net/quic/test/test_QUICCrypto.cc
+++ b/iocore/net/quic/test/test_QUICCrypto.cc
@@ -74,39 +74,8 @@ TEST_CASE("QUICCrypto Cleartext", "[quic]")
   SSL_CTX_use_PrivateKey(server_ssl_ctx, PEM_read_bio_PrivateKey(key_bio, nullptr, nullptr, nullptr));
   QUICCrypto *server = new QUICCryptoTls(SSL_new(server_ssl_ctx), NET_VCONNECTION_IN);
 
-  // Client Hello
-  uint8_t client_hello[MAX_HANDSHAKE_MSG_LEN] = {0};
-  size_t client_hello_len                     = 0;
-  CHECK(client->handshake(client_hello, client_hello_len, MAX_HANDSHAKE_MSG_LEN, nullptr, 0) == SSL_ERROR_WANT_READ);
-  std::cout << "Client Hello" << std::endl;
-  print_hex(client_hello, client_hello_len);
-
-  // Server Hello
-  uint8_t server_hello[MAX_HANDSHAKE_MSG_LEN] = {0};
-  size_t server_hello_len                     = 0;
-  CHECK(server->handshake(server_hello, server_hello_len, MAX_HANDSHAKE_MSG_LEN, client_hello, client_hello_len) ==
-        SSL_ERROR_WANT_READ);
-  std::cout << "Server Hello" << std::endl;
-  print_hex(server_hello, server_hello_len);
-
-  // Client Fnished
-  uint8_t client_finished[MAX_HANDSHAKE_MSG_LEN] = {0};
-  size_t client_finished_len                     = 0;
-  CHECK(client->handshake(client_finished, client_finished_len, MAX_HANDSHAKE_MSG_LEN, server_hello, server_hello_len) ==
-        SSL_ERROR_NONE);
-  std::cout << "Client Finished" << std::endl;
-  print_hex(client_finished, client_finished_len);
-
-  // Post Handshake Msg
-  uint8_t post_handshake_msg[MAX_HANDSHAKE_MSG_LEN] = {0};
-  size_t post_handshake_msg_len                     = 0;
-  CHECK(server->handshake(post_handshake_msg, post_handshake_msg_len, MAX_HANDSHAKE_MSG_LEN, client_finished,
-                          client_finished_len) == SSL_ERROR_NONE);
-  std::cout << "Post Handshake Message" << std::endl;
-  print_hex(post_handshake_msg, post_handshake_msg_len);
-
-  CHECK(client->initialize_key_materials(0x8394c8f03e515708));
-  CHECK(server->initialize_key_materials(0x8394c8f03e515708));
+  CHECK(client->initialize_key_materials(0x8394c8f03e515700));
+  CHECK(server->initialize_key_materials(0x8394c8f03e515700));
 
   // encrypt - decrypt
   uint8_t original[] = {
@@ -119,7 +88,7 @@ TEST_CASE("QUICCrypto Cleartext", "[quic]")
   uint8_t ad[]     = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
 
   // client (encrypt) - server (decrypt)
-  std::cout << "Original Text" << std::endl;
+  std::cout << "### Original Text" << std::endl;
   print_hex(original, sizeof(original));
 
   uint8_t cipher[128] = {0}; // >= original len + EVP_AEAD_max_overhead
@@ -127,14 +96,14 @@ TEST_CASE("QUICCrypto Cleartext", "[quic]")
   CHECK(client->encrypt(cipher, cipher_len, sizeof(cipher), original, sizeof(original), pkt_num, ad, sizeof(ad),
                         QUICKeyPhase::CLEARTEXT));
 
-  std::cout << "Encrypted Text" << std::endl;
+  std::cout << "### Encrypted Text" << std::endl;
   print_hex(cipher, cipher_len);
 
   uint8_t plain[128] = {0};
   size_t plain_len   = 0;
   CHECK(server->decrypt(plain, plain_len, sizeof(plain), cipher, cipher_len, pkt_num, ad, sizeof(ad), QUICKeyPhase::CLEARTEXT));
 
-  std::cout << "Decrypted Text" << std::endl;
+  std::cout << "### Decrypted Text" << std::endl;
   print_hex(plain, plain_len);
 
   CHECK(sizeof(original) == (plain_len));
@@ -163,11 +132,14 @@ TEST_CASE("QUICCrypto 1-RTT", "[quic]")
   SSL_CTX_use_PrivateKey(server_ssl_ctx, PEM_read_bio_PrivateKey(key_bio, nullptr, nullptr, nullptr));
   QUICCrypto *server = new QUICCryptoTls(SSL_new(server_ssl_ctx), NET_VCONNECTION_IN);
 
+  CHECK(client->initialize_key_materials(0x8394c8f03e515708));
+  CHECK(server->initialize_key_materials(0x8394c8f03e515708));
+
   // Client Hello
   uint8_t client_hello[MAX_HANDSHAKE_MSG_LEN] = {0};
   size_t client_hello_len                     = 0;
   CHECK(client->handshake(client_hello, client_hello_len, MAX_HANDSHAKE_MSG_LEN, nullptr, 0) == SSL_ERROR_WANT_READ);
-  std::cout << "Client Hello" << std::endl;
+  std::cout << "### Client Hello" << std::endl;
   print_hex(client_hello, client_hello_len);
 
   // Server Hello
@@ -175,7 +147,7 @@ TEST_CASE("QUICCrypto 1-RTT", "[quic]")
   size_t server_hello_len                     = 0;
   CHECK(server->handshake(server_hello, server_hello_len, MAX_HANDSHAKE_MSG_LEN, client_hello, client_hello_len) ==
         SSL_ERROR_WANT_READ);
-  std::cout << "Server Hello" << std::endl;
+  std::cout << "### Server Hello" << std::endl;
   print_hex(server_hello, server_hello_len);
 
   // Client Fnished
@@ -183,20 +155,19 @@ TEST_CASE("QUICCrypto 1-RTT", "[quic]")
   size_t client_finished_len                     = 0;
   CHECK(client->handshake(client_finished, client_finished_len, MAX_HANDSHAKE_MSG_LEN, server_hello, server_hello_len) ==
         SSL_ERROR_NONE);
-  std::cout << "Client Finished" << std::endl;
+  std::cout << "### Client Finished" << std::endl;
   print_hex(client_finished, client_finished_len);
 
+  CHECK(client->update_key_materials());
+
   // Post Handshake Msg
   uint8_t post_handshake_msg[MAX_HANDSHAKE_MSG_LEN] = {0};
   size_t post_handshake_msg_len                     = 0;
   CHECK(server->handshake(post_handshake_msg, post_handshake_msg_len, MAX_HANDSHAKE_MSG_LEN, client_finished,
                           client_finished_len) == SSL_ERROR_NONE);
-  std::cout << "Post Handshake Message" << std::endl;
+  std::cout << "### Post Handshake Message" << std::endl;
   print_hex(post_handshake_msg, post_handshake_msg_len);
 
-  CHECK(client->initialize_key_materials(0x8394c8f03e515708));
-  CHECK(server->initialize_key_materials(0x8394c8f03e515708));
-  CHECK(client->update_key_materials());
   CHECK(server->update_key_materials());
 
   // encrypt - decrypt
@@ -210,7 +181,7 @@ TEST_CASE("QUICCrypto 1-RTT", "[quic]")
   uint8_t ad[]     = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
 
   // client (encrypt) - server (decrypt)
-  std::cout << "Original Text" << std::endl;
+  std::cout << "### Original Text" << std::endl;
   print_hex(original, sizeof(original));
 
   uint8_t cipher[128] = {0}; // >= original len + EVP_AEAD_max_overhead
@@ -218,14 +189,14 @@ TEST_CASE("QUICCrypto 1-RTT", "[quic]")
   CHECK(client->encrypt(cipher, cipher_len, sizeof(cipher), original, sizeof(original), pkt_num, ad, sizeof(ad),
                         QUICKeyPhase::PHASE_0));
 
-  std::cout << "Encrypted Text" << std::endl;
+  std::cout << "### Encrypted Text" << std::endl;
   print_hex(cipher, cipher_len);
 
   uint8_t plain[128] = {0};
   size_t plain_len   = 0;
   CHECK(server->decrypt(plain, plain_len, sizeof(plain), cipher, cipher_len, pkt_num, ad, sizeof(ad), QUICKeyPhase::PHASE_0));
 
-  std::cout << "Decrypted Text" << std::endl;
+  std::cout << "### Decrypted Text" << std::endl;
   print_hex(plain, plain_len);
 
   CHECK(sizeof(original) == (plain_len));

-- 
To stop receiving notification emails like this one, please contact
masaori@apache.org.