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/03/26 07:16:49 UTC

[trafficserver] 03/03: Fix unit tests

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 d774873ebc8ed4edc51b822f78c4d7e1b1c87b4a
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Mon Mar 26 16:15:41 2018 +0900

    Fix unit tests
---
 iocore/net/quic/QUICStream.cc              |  1 -
 iocore/net/quic/test/Makefile.am           | 40 ++++++++++++++++++--------
 iocore/net/quic/test/stub_QUICConfig.cc    | 45 ++++++++++++++++++++++++++++++
 iocore/net/quic/test/test_QUICHandshake.cc |  3 --
 4 files changed, 74 insertions(+), 15 deletions(-)

diff --git a/iocore/net/quic/QUICStream.cc b/iocore/net/quic/QUICStream.cc
index fb69e58..9e78714 100644
--- a/iocore/net/quic/QUICStream.cc
+++ b/iocore/net/quic/QUICStream.cc
@@ -27,7 +27,6 @@
 #include "P_VConnection.h"
 #include "QUICStreamManager.h"
 #include "QUICDebugNames.h"
-#include "QUICConfig.h"
 
 #define QUICStreamDebug(fmt, ...)                                                                                       \
   Debug("quic_stream", "[%" PRIx64 "] [%" PRIx64 "] [%s] " fmt, static_cast<uint64_t>(this->_connection_id), this->_id, \
diff --git a/iocore/net/quic/test/Makefile.am b/iocore/net/quic/test/Makefile.am
index d8e6a09..1c4b445 100644
--- a/iocore/net/quic/test/Makefile.am
+++ b/iocore/net/quic/test/Makefile.am
@@ -169,6 +169,7 @@ test_QUICFrameDispatcher_SOURCES = \
   test_QUICFrameDispatcher.cc \
   ../QUICGlobals.cc \
   ../QUICConfig.cc \
+  stub_QUICConfig.cc \
   ../QUICVersionNegotiator.cc \
   ../QUICFrameDispatcher.cc \
   ../QUICTransportParameters.cc \
@@ -198,6 +199,7 @@ test_QUICFrameDispatcher_SOURCES = \
 
 test_QUICFrameDispatcher_LDADD = \
   $(top_builddir)/lib/ts/libtsutil.la \
+  $(top_builddir)/iocore/net/quic/libquic.a \
   $(top_builddir)/iocore/eventsystem/libinkevent.a \
   $(top_builddir)/lib/records/librecords_p.a \
   $(top_builddir)/mgmt/libmgmt_p.la \
@@ -206,7 +208,6 @@ test_QUICFrameDispatcher_LDADD = \
   @LIBTCL@ \
   @HWLOC_LIBS@
 
-
 #
 # test_QUICStreamState
 #
@@ -249,7 +250,8 @@ test_QUICStream_SOURCES = \
   ../QUICStreamManager.cc \
   ../QUICApplicationMap.cc \
   ../QUICCongestionController.cc \
-  ../../SSLNextProtocolSet.cc
+  ../../SSLNextProtocolSet.cc \
+  stub_QUICConfig.cc
 
 test_QUICStream_LDADD = \
   $(top_builddir)/lib/ts/libtsutil.la \
@@ -280,7 +282,9 @@ test_QUICStreamManager_SOURCES = \
   ../QUICStreamManager.cc \
   ../QUICApplicationMap.cc \
   ../QUICCongestionController.cc \
-  ../../SSLNextProtocolSet.cc
+  ../../SSLNextProtocolSet.cc \
+  ../QUICConfig.cc \
+  stub_QUICConfig.cc
 
 test_QUICStreamManager_LDADD = \
   $(top_builddir)/lib/ts/libtsutil.la \
@@ -307,6 +311,7 @@ test_QUICTransportParameters_SOURCES = \
   test_QUICTransportParameters.cc \
   ../QUICGlobals.cc \
   ../QUICConfig.cc \
+  stub_QUICConfig.cc \
   ../QUICApplication.cc \
   ../QUICApplicationMap.cc \
   ../QUICHandshake.cc \
@@ -332,6 +337,7 @@ test_QUICTransportParameters_SOURCES = \
 
 test_QUICTransportParameters_LDADD = \
   $(top_builddir)/lib/ts/libtsutil.la \
+  $(top_builddir)/iocore/net/quic/libquic.a \
   $(top_builddir)/proxy/shared/libUglyLogStubs.a \
   $(top_builddir)/lib/records/librecords_p.a \
   $(top_builddir)/mgmt/libmgmt_p.la \
@@ -345,8 +351,7 @@ test_QUICKeyGenerator_CPPFLAGS = \
   $(AM_CPPFLAGS)
 
 test_QUICKeyGenerator_LDFLAGS = \
-  @AM_LDFLAGS@ \
-  @OPENSSL_LDFLAGS@
+  @AM_LDFLAGS@
 
 test_QUICKeyGenerator_LDADD = \
   @OPENSSL_LIBS@ \
@@ -442,7 +447,9 @@ test_QUICLossDetector_SOURCES = \
   ../QUICHandshakeProtocol.cc \
   ../QUICTLS.cc \
   $(QUICTLS_impl) \
-  ../QUICFrame.cc
+  ../QUICFrame.cc \
+  ../../SSLNextProtocolSet.cc \
+  stub_QUICConfig.cc
 
 #
 # test_QUICTypeUtil
@@ -455,10 +462,12 @@ test_QUICTypeUtil_LDFLAGS = \
 
 test_QUICTypeUtil_LDADD = \
   $(top_builddir)/iocore/eventsystem/libinkevent.a \
+  $(top_builddir)/iocore/net/quic/libquic.a \
   $(top_builddir)/lib/records/librecords_p.a \
   $(top_builddir)/mgmt/libmgmt_p.la \
   $(top_builddir)/proxy/shared/libUglyLogStubs.a \
-  $(top_builddir)/lib/ts/libtsutil.la
+  $(top_builddir)/lib/ts/libtsutil.la \
+  @OPENSSL_LIBS@
 
 test_QUICTypeUtil_SOURCES = \
   main.cc \
@@ -477,7 +486,9 @@ test_QUICTypeUtil_SOURCES = \
   ../QUICTLS.cc \
   $(QUICTLS_impl) \
   ../QUICIntUtil.cc \
-  ../QUICTypes.cc
+  ../QUICTypes.cc \
+  ../../SSLNextProtocolSet.cc \
+  stub_QUICConfig.cc
 
 #
 # test_QUICAckFrameCreator
@@ -490,6 +501,7 @@ test_QUICAckFrameCreator_LDFLAGS = \
 
 test_QUICAckFrameCreator_LDADD = \
   $(top_builddir)/iocore/eventsystem/libinkevent.a \
+  $(top_builddir)/iocore/net/quic/libquic.a \
   $(top_builddir)/lib/records/librecords_p.a \
   $(top_builddir)/mgmt/libmgmt_p.la \
   $(top_builddir)/proxy/shared/libUglyLogStubs.a \
@@ -515,7 +527,8 @@ test_QUICAckFrameCreator_SOURCES = \
   ../QUICHandshakeProtocol.cc \
   ../QUICTLS.cc \
   $(QUICTLS_impl) \
-  ../../SSLNextProtocolSet.cc
+  ../../SSLNextProtocolSet.cc \
+  stub_QUICConfig.cc
 
 #
 # test_QUICTypeUtil
@@ -529,6 +542,7 @@ test_QUICVersionNegotiator_LDFLAGS = \
 test_QUICVersionNegotiator_LDADD = \
   $(top_builddir)/lib/ts/libtsutil.la \
   $(top_builddir)/iocore/eventsystem/libinkevent.a \
+  $(top_builddir)/iocore/net/quic/libquic.a \
   $(top_builddir)/lib/records/librecords_p.a \
   $(top_builddir)/mgmt/libmgmt_p.la \
   $(top_builddir)/lib/ts/libtsutil.la \
@@ -562,6 +576,7 @@ test_QUICVersionNegotiator_SOURCES = \
   ../QUICVersionNegotiator.cc \
   ../QUICTransportParameters.cc \
   ../QUICConfig.cc \
+  stub_QUICConfig.cc \
   ../../SSLNextProtocolSet.cc
 
 #
@@ -576,6 +591,7 @@ test_QUICFlowController_LDFLAGS = \
 test_QUICFlowController_LDADD = \
   $(top_builddir)/lib/ts/libtsutil.la \
   $(top_builddir)/iocore/eventsystem/libinkevent.a \
+  $(top_builddir)/iocore/net/quic/libquic.a \
   $(top_builddir)/lib/records/librecords_p.a \
   $(top_builddir)/mgmt/libmgmt_p.la \
   $(top_builddir)/lib/ts/libtsutil.la \
@@ -620,7 +636,8 @@ test_QUICIncomingFrameBuffer_SOURCES = \
   ../QUICCongestionController.cc \
   ../../SSLNextProtocolSet.cc \
   ../QUICIncomingFrameBuffer.cc \
-  test_QUICIncomingFrameBuffer.cc
+  test_QUICIncomingFrameBuffer.cc \
+  stub_QUICConfig.cc
 
 test_QUICIncomingFrameBuffer_LDADD = \
   $(top_builddir)/lib/ts/libtsutil.la \
@@ -646,7 +663,8 @@ test_QUICHandshake_SOURCES = \
   event_processor_main.cc \
   test_QUICHandshake.cc \
   ../QUICHandshake.cc \
-  ../../SSLNextProtocolSet.cc
+  ../../SSLNextProtocolSet.cc \
+  stub_QUICConfig.cc
 
 test_QUICHandshake_LDADD = \
   $(top_builddir)/lib/ts/libtsutil.la \
diff --git a/iocore/net/quic/test/stub_QUICConfig.cc b/iocore/net/quic/test/stub_QUICConfig.cc
new file mode 100644
index 0000000..22f7f81
--- /dev/null
+++ b/iocore/net/quic/test/stub_QUICConfig.cc
@@ -0,0 +1,45 @@
+/** @file
+ *
+ *  Stubs for QUICConfig
+ *
+ *  @section license License
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+#include "ts/ink_assert.h"
+
+#include "P_SSLConfig.h"
+
+bool
+SSLParseCertificateConfiguration(const SSLConfigParams *, SSL_CTX *)
+{
+  ink_assert(false);
+  return false;
+}
+
+SSLConfigParams *
+SSLConfig::acquire()
+{
+  ink_assert(false);
+  return nullptr;
+}
+
+void
+SSLConfig::release(SSLConfigParams *)
+{
+  ink_assert(false);
+}
diff --git a/iocore/net/quic/test/test_QUICHandshake.cc b/iocore/net/quic/test/test_QUICHandshake.cc
index 8e8ad8d..30268d4 100644
--- a/iocore/net/quic/test/test_QUICHandshake.cc
+++ b/iocore/net/quic/test/test_QUICHandshake.cc
@@ -25,14 +25,11 @@
 
 #include "Mock.h"
 #include "QUICHandshake.h"
-#include "QUICConfig.h"
 
 #include "./server_cert.h"
 
 TEST_CASE("1-RTT handshake ", "[quic]")
 {
-  QUICConfig::startup();
-
   // setup client
   QUICConnection *client_qc = new MockQUICConnection(NET_VCONNECTION_OUT);
 

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