aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHannes Rantzsch <[email protected]>2019-06-27 11:01:35 +0200
committerHannes Rantzsch <[email protected]>2019-06-27 11:01:35 +0200
commit60bfa5b935370bb1cc4a14bd47c6cf90a70343eb (patch)
tree9ab8608ffc4a5dc54df5d233b4a3e7a6f4d98c6f
parent289638388699a221b81b821526d378b09283b5c6 (diff)
Boost 1.70 compatibility in asio_stream unit test
-rw-r--r--src/tests/unit_asio_stream.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/tests/unit_asio_stream.cpp b/src/tests/unit_asio_stream.cpp
index 5fd67cbd4..c32cfb9d8 100644
--- a/src/tests/unit_asio_stream.cpp
+++ b/src/tests/unit_asio_stream.cpp
@@ -13,11 +13,19 @@
#include <botan/asio_stream.h>
#include <botan/tls_callbacks.h>
-// first boost version to include boost/beast/experimental/test/stream.hpp
+// The boost::beast::test::stream we use is available starting from boost
+// version 1.68, so we cannot run these tests with a smaller version.
#include <boost/version.hpp>
#if BOOST_VERSION >= 106800
+// boost::beast::test::stream's include path has been changed in boost version
+// 1.70.
+#if BOOST_VERSION < 107000
#include <boost/beast/experimental/test/stream.hpp>
+#else
+#include <boost/beast/_experimental/test/stream.hpp>
+#endif
+
#include <boost/bind.hpp>
namespace Botan_Tests {
@@ -87,7 +95,15 @@ class ThrowingMockChannel : public MockChannel
}
};
-using TestStream = boost::beast::test::stream;
+// Unfortunately, boost::beast::test::stream keeps lowest_layer_type private and
+// only friends boost::asio::ssl::stream. We need to make our own.
+class TestStream : public boost::beast::test::stream
+ {
+ public:
+ using boost::beast::test::stream::stream;
+ using lowest_layer_type = boost::beast::test::stream;
+ };
+
using FailCount = boost::beast::test::fail_count;
class AsioStream : public Botan::TLS::Stream<TestStream, MockChannel>