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

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


The following commit(s) were added to refs/heads/quic-latest by this push:
     new 996ab43  Fix tests
996ab43 is described below

commit 996ab43b7632823249fd38ead7d401f0dfc7080b
Author: Masakazu Kitajo <[email protected]>
AuthorDate: Fri Aug 25 12:08:42 2017 +0900

    Fix tests
---
 iocore/net/quic/Mock.h                             | 20 ++++----
 iocore/net/quic/QUICGlobals.cc                     |  2 +-
 iocore/net/quic/QUICTransportParameters.cc         | 12 ++++-
 iocore/net/quic/test/Makefile.am                   | 55 +++++++++++++++++++---
 iocore/net/quic/test/test_QUICCrypto.cc            |  4 +-
 iocore/net/quic/test/test_QUICVersionNegotiator.cc |  5 +-
 6 files changed, 72 insertions(+), 26 deletions(-)

diff --git a/iocore/net/quic/Mock.h b/iocore/net/quic/Mock.h
index 842a6c7..4956b55 100644
--- a/iocore/net/quic/Mock.h
+++ b/iocore/net/quic/Mock.h
@@ -95,7 +95,7 @@ public:
 class MockQUICConnection : public QUICConnection
 {
 public:
-  MockQUICConnection() : QUICConnection() { this->_mutex = new_ProxyMutex(); };
+  MockQUICConnection(NetVConnectionContext_t context = NET_VCONNECTION_OUT) : 
QUICConnection(), _direction(context) { this->_mutex = new_ProxyMutex(); };
   void
   transmit_packet(std::unique_ptr<const QUICPacket> packet) override
   {
@@ -158,21 +158,16 @@ public:
     return 1280;
   }
 
-  void
-  set_transport_parameters(std::unique_ptr<QUICTransportParameters> tp) 
override
-  {
-  }
-
-  const QUICTransportParameters &
-  local_transport_parameters() override
+  NetVConnectionContext_t
+  direction() override
   {
-    return dummy_transport_parameters;
+    return _direction;
   }
 
-  const QUICTransportParameters &
-  remote_transport_parameters() override
+  SSLNextProtocolSet *
+  next_protocol_set() override
   {
-    return dummy_transport_parameters;
+    return nullptr;
   }
 
   void
@@ -193,6 +188,7 @@ public:
   int _frameCount[256] = {0};
 
   QUICTransportParametersInEncryptedExtensions dummy_transport_parameters;
+  NetVConnectionContext_t _direction;
 };
 
 class MockQUICPacketTransmitter : public QUICPacketTransmitter
diff --git a/iocore/net/quic/QUICGlobals.cc b/iocore/net/quic/QUICGlobals.cc
index cdad89b..ca45f67 100644
--- a/iocore/net/quic/QUICGlobals.cc
+++ b/iocore/net/quic/QUICGlobals.cc
@@ -23,7 +23,7 @@
 
 #include <cstring>
 #include "QUICGlobals.h"
-#include "P_QUICNetVConnection.h"
+#include "QUICConnection.h"
 #include "P_SSLNextProtocolSet.h"
 
 int QUIC::ssl_quic_qc_index = -1;
diff --git a/iocore/net/quic/QUICTransportParameters.cc 
b/iocore/net/quic/QUICTransportParameters.cc
index 53894c8..2acb5c1 100644
--- a/iocore/net/quic/QUICTransportParameters.cc
+++ b/iocore/net/quic/QUICTransportParameters.cc
@@ -178,13 +178,21 @@ 
QUICTransportParametersInClientHello::_parameters_offset() const
 QUICVersion
 QUICTransportParametersInClientHello::negotiated_version() const
 {
-  return QUICTypeUtil::read_QUICVersion(this->_buf.get());
+  if (this->_buf) {
+    return QUICTypeUtil::read_QUICVersion(this->_buf.get());
+  } else {
+    return this->_negotiated_version;
+  }
 }
 
 QUICVersion
 QUICTransportParametersInClientHello::initial_version() const
 {
-  return QUICTypeUtil::read_QUICVersion(this->_buf.get() + 
sizeof(QUICVersion));
+  if (this->_buf) {
+    return QUICTypeUtil::read_QUICVersion(this->_buf.get() + 
sizeof(QUICVersion));
+  } else {
+    return this->_initial_version;
+  }
 }
 
 //
diff --git a/iocore/net/quic/test/Makefile.am b/iocore/net/quic/test/Makefile.am
index b51245a..65f473c 100644
--- a/iocore/net/quic/test/Makefile.am
+++ b/iocore/net/quic/test/Makefile.am
@@ -125,7 +125,8 @@ test_QUICFrame_SOURCES = \
   ../QUICPacket.cc \
   ../QUICCrypto.cc \
   $(QUICCrypto_impl) \
-  ../QUICTypes.cc
+  ../QUICTypes.cc \
+  ../../SSLNextProtocolSet.cc
 
 test_QUICFrame_LDADD = \
   $(top_builddir)/lib/ts/libtsutil.la \
@@ -144,6 +145,8 @@ test_QUICFrameDispatcher_SOURCES = \
   main.cc \
   test_QUICFrameDispatcher.cc \
   ../QUICGlobals.cc \
+  ../QUICConfig.cc \
+  ../QUICVersionNegotiator.cc \
   ../QUICFrameDispatcher.cc \
   ../QUICTransportParameters.cc \
   ../QUICStreamManager.cc \
@@ -160,11 +163,15 @@ test_QUICFrameDispatcher_SOURCES = \
   ../QUICEchoApp.cc \
   ../QUICDebugNames.cc \
   ../QUICCrypto.cc \
-  $(QUICCrypto_impl)
+  $(QUICCrypto_impl) \
+  ../../SSLNextProtocolSet.cc
 
 test_QUICFrameDispatcher_LDADD = \
   $(top_builddir)/lib/ts/libtsutil.la \
   $(top_builddir)/iocore/eventsystem/libinkevent.a \
+  $(top_builddir)/lib/records/librecords_p.a \
+  $(top_builddir)/mgmt/libmgmt_p.la \
+  $(top_builddir)/lib/ts/libtsutil.la \
   $(top_builddir)/proxy/shared/libUglyLogStubs.a \
   @LIBTCL@ \
   @HWLOC_LIBS@
@@ -208,7 +215,8 @@ test_QUICStream_SOURCES = \
   ../QUICFrameDispatcher.cc \
   ../QUICStreamManager.cc \
   ../QUICApplicationMap.cc \
-  ../QUICCongestionController.cc
+  ../QUICCongestionController.cc \
+  ../../SSLNextProtocolSet.cc
 
 test_QUICStream_LDADD = \
   $(top_builddir)/lib/ts/libtsutil.la \
@@ -234,12 +242,29 @@ test_QUICTransportParameters_SOURCES = \
   main.cc \
   test_QUICTransportParameters.cc \
   ../QUICGlobals.cc \
+  ../QUICConfig.cc \
+  ../QUICApplication.cc \
+  ../QUICApplicationMap.cc \
+  ../QUICHandshake.cc \
+  ../QUICVersionNegotiator.cc \
+  ../QUICCrypto.cc \
+  $(QUICCrypto_impl) \
+  ../QUICStream.cc \
+  ../QUICStreamState.cc \
+  ../QUICStreamManager.cc \
+  ../QUICPacket.cc \
+  ../QUICFrame.cc \
+  ../QUICDebugNames.cc \
   ../QUICTransportParameters.cc \
-  ../QUICTypes.cc
+  ../QUICTypes.cc \
+  ../../SSLNextProtocolSet.cc
 
 test_QUICTransportParameters_LDADD = \
   $(top_builddir)/lib/ts/libtsutil.la \
   $(top_builddir)/proxy/shared/libUglyLogStubs.a \
+  $(top_builddir)/lib/records/librecords_p.a \
+  $(top_builddir)/mgmt/libmgmt_p.la \
+  $(top_builddir)/lib/ts/libtsutil.la \
   $(top_builddir)/iocore/eventsystem/libinkevent.a
 
 #
@@ -264,7 +289,8 @@ test_QUICCrypto_SOURCES = \
   ../QUICCrypto.cc \
   $(QUICCrypto_impl) \
   ../QUICCrypto.h \
-  ../QUICGlobals.cc
+  ../QUICGlobals.cc \
+  ../../SSLNextProtocolSet.cc
 
 #
 # test_QUICLossDetector
@@ -335,7 +361,8 @@ test_QUICAckFrameCreator_SOURCES = \
   ../QUICFrame.cc \
   ../QUICPacket.cc \
   ../QUICCrypto.cc \
-  $(QUICCrypto_impl)
+  $(QUICCrypto_impl) \
+  ../../SSLNextProtocolSet.cc
 
 #
 # test_QUICTypeUtil
@@ -349,6 +376,9 @@ test_QUICVersionNegotiator_LDFLAGS = \
 test_QUICVersionNegotiator_LDADD = \
   $(top_builddir)/lib/ts/libtsutil.la \
   $(top_builddir)/iocore/eventsystem/libinkevent.a \
+  $(top_builddir)/lib/records/librecords_p.a \
+  $(top_builddir)/mgmt/libmgmt_p.la \
+  $(top_builddir)/lib/ts/libtsutil.la \
   $(top_builddir)/proxy/shared/libUglyLogStubs.a \
   @LIBTCL@ \
   @HWLOC_LIBS@
@@ -361,7 +391,18 @@ test_QUICVersionNegotiator_SOURCES = \
   ../QUICPacket.cc \
   ../QUICCrypto.cc \
   $(QUICCrypto_impl) \
-  ../QUICVersionNegotiator.cc
+  ../QUICApplication.cc \
+  ../QUICApplicationMap.cc \
+  ../QUICHandshake.cc \
+  ../QUICStream.cc \
+  ../QUICStreamState.cc \
+  ../QUICStreamManager.cc \
+  ../QUICFrame.cc \
+  ../QUICDebugNames.cc \
+  ../QUICVersionNegotiator.cc \
+  ../QUICTransportParameters.cc \
+  ../QUICConfig.cc \
+  ../../SSLNextProtocolSet.cc
 
 include $(top_srcdir)/build/tidy.mk
 
diff --git a/iocore/net/quic/test/test_QUICCrypto.cc 
b/iocore/net/quic/test/test_QUICCrypto.cc
index 58d84e9..e97b83a 100644
--- a/iocore/net/quic/test/test_QUICCrypto.cc
+++ b/iocore/net/quic/test/test_QUICCrypto.cc
@@ -109,7 +109,7 @@ TEST_CASE("QUICCrypto 1-RTT", "[quic]")
   SSL_CTX *client_ssl_ctx = SSL_CTX_new(TLS_method());
   SSL_CTX_set_min_proto_version(client_ssl_ctx, TLS1_3_VERSION);
   SSL_CTX_set_max_proto_version(client_ssl_ctx, TLS1_3_VERSION);
-  QUICCrypto *client = new QUICCrypto(client_ssl_ctx, new 
MockNetVConnection(NET_VCONNECTION_OUT));
+  QUICCrypto *client = new QUICCrypto(SSL_new(client_ssl_ctx), 
NET_VCONNECTION_OUT);
 
   // Server
   SSL_CTX *server_ssl_ctx = SSL_CTX_new(TLS_method());
@@ -119,7 +119,7 @@ TEST_CASE("QUICCrypto 1-RTT", "[quic]")
   SSL_CTX_use_certificate(server_ssl_ctx, PEM_read_bio_X509(crt_bio, nullptr, 
nullptr, nullptr));
   BIO *key_bio(BIO_new_mem_buf(server_key, sizeof(server_key)));
   SSL_CTX_use_PrivateKey(server_ssl_ctx, PEM_read_bio_PrivateKey(key_bio, 
nullptr, nullptr, nullptr));
-  QUICCrypto *server = new QUICCrypto(server_ssl_ctx, new 
MockNetVConnection(NET_VCONNECTION_IN));
+  QUICCrypto *server = new QUICCrypto(SSL_new(server_ssl_ctx), 
NET_VCONNECTION_IN);
 
   // Client Hello
   uint8_t client_hello[MAX_HANDSHAKE_MSG_LEN] = {0};
diff --git a/iocore/net/quic/test/test_QUICVersionNegotiator.cc 
b/iocore/net/quic/test/test_QUICVersionNegotiator.cc
index da41550..1191efd 100644
--- a/iocore/net/quic/test/test_QUICVersionNegotiator.cc
+++ b/iocore/net/quic/test/test_QUICVersionNegotiator.cc
@@ -29,7 +29,7 @@
 TEST_CASE("QUICVersionNegotiator_Normal", "[quic]")
 {
   QUICPacketFactory packet_factory;
-  QUICVersionNegotiator vn(&packet_factory, new MockQUICPacketTransmitter());
+  QUICVersionNegotiator vn;
 
   // Check initial state
   CHECK(vn.status() == QUICVersionNegotiationStatus::NOT_NEGOTIATED);
@@ -41,7 +41,8 @@ TEST_CASE("QUICVersionNegotiator_Normal", "[quic]")
   CHECK(vn.status() == QUICVersionNegotiationStatus::NEGOTIATED);
 
   // Revalidate version
-  vn.revalidate(QUIC_SUPPORTED_VERSIONS[0]);
+  QUICTransportParametersInClientHello tp(QUIC_SUPPORTED_VERSIONS[0], 
QUIC_SUPPORTED_VERSIONS[0]);
+  vn.revalidate(&tp);
   CHECK(vn.status() == QUICVersionNegotiationStatus::REVALIDATED);
   CHECK(vn.negotiated_version() == QUIC_SUPPORTED_VERSIONS[0]);
 }

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to