build: require boost >= 1.71.0
Refs: #5276
Change-Id: Ie428541639dcf1113acfb9e9d0a80f9be87d6cd3
diff --git a/tests/daemon/common/global.t.cpp b/tests/daemon/common/global.t.cpp
index b738d32..61556f7 100644
--- a/tests/daemon/common/global.t.cpp
+++ b/tests/daemon/common/global.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -29,6 +29,8 @@
#include "tests/daemon/global-io-fixture.hpp"
#include "tests/daemon/rib-io-fixture.hpp"
+#include <boost/asio/post.hpp>
+
#include <thread>
namespace nfd::tests {
@@ -37,8 +39,8 @@
BOOST_AUTO_TEST_CASE(ThreadLocalIoService)
{
- boost::asio::io_service* s1 = &getGlobalIoService();
- boost::asio::io_service* s2 = nullptr;
+ boost::asio::io_context* s1 = &getGlobalIoService();
+ boost::asio::io_context* s2 = nullptr;
std::thread t([&s2] { s2 = &getGlobalIoService(); });
t.join();
@@ -63,8 +65,8 @@
BOOST_FIXTURE_TEST_CASE(MainRibIoService, RibIoFixture)
{
- boost::asio::io_service* mainIo = &g_io;
- boost::asio::io_service* ribIo = g_ribIo;
+ boost::asio::io_context* mainIo = &g_io;
+ boost::asio::io_context* ribIo = g_ribIo;
BOOST_CHECK(mainIo != ribIo);
BOOST_CHECK(&getGlobalIoService() == mainIo);
@@ -72,15 +74,15 @@
BOOST_CHECK(&getRibIoService() == ribIo);
auto mainThreadId = std::this_thread::get_id();
- runOnRibIoService([&] {
+ boost::asio::post(getRibIoService(), [&] {
BOOST_CHECK(mainThreadId != std::this_thread::get_id());
BOOST_CHECK(&getGlobalIoService() == ribIo);
BOOST_CHECK(&getMainIoService() == mainIo);
BOOST_CHECK(&getRibIoService() == ribIo);
});
- runOnRibIoService([&] {
- runOnMainIoService([&] {
+ boost::asio::post(getRibIoService(), [&] {
+ boost::asio::post(getMainIoService(), [&] {
BOOST_CHECK(mainThreadId == std::this_thread::get_id());
BOOST_CHECK(&getGlobalIoService() == mainIo);
BOOST_CHECK(&getMainIoService() == mainIo);
@@ -92,7 +94,7 @@
BOOST_FIXTURE_TEST_CASE(PollInAllThreads, RibIoFixture)
{
bool hasRibRun = false;
- runOnRibIoService([&] { hasRibRun = true; });
+ boost::asio::post(getRibIoService(), [&] { hasRibRun = true; });
std::this_thread::sleep_for(std::chrono::seconds(1));
BOOST_CHECK_EQUAL(hasRibRun, false);
@@ -101,9 +103,9 @@
hasRibRun = false;
bool hasMainRun = false;
- runOnMainIoService([&] {
+ boost::asio::post(getMainIoService(), [&] {
hasMainRun = true;
- runOnRibIoService([&] { hasRibRun = true; });
+ boost::asio::post(getRibIoService(), [&] { hasRibRun = true; });
});
BOOST_CHECK_EQUAL(hasMainRun, false);
BOOST_CHECK_EQUAL(hasRibRun, false);
@@ -116,7 +118,7 @@
BOOST_FIXTURE_TEST_CASE(AdvanceClocks, RibIoTimeFixture)
{
bool hasRibRun = false;
- runOnRibIoService([&] { hasRibRun = true; });
+ boost::asio::post(getRibIoService(), [&] { hasRibRun = true; });
std::this_thread::sleep_for(std::chrono::seconds(1));
BOOST_CHECK_EQUAL(hasRibRun, false);
@@ -127,7 +129,7 @@
bool hasMainRun = false;
getScheduler().schedule(250_ms, [&] {
hasMainRun = true;
- runOnRibIoService([&] { hasRibRun = true; });
+ boost::asio::post(getRibIoService(), [&] { hasRibRun = true; });
});
BOOST_CHECK_EQUAL(hasMainRun, false);
BOOST_CHECK_EQUAL(hasRibRun, false);
diff --git a/tests/daemon/face/test-netif.hpp b/tests/daemon/face/test-netif.hpp
index 9e32d60..cf4e3fa 100644
--- a/tests/daemon/face/test-netif.hpp
+++ b/tests/daemon/face/test-netif.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -34,7 +34,7 @@
namespace nfd::tests {
/** \brief Enumerate network interfaces using the given NetworkMonitor
- * \param netmon a NetworkMonitor constructed on the global io_service.
+ * \param netmon a NetworkMonitor constructed on the global io_context.
* \note This function is blocking
* \note Signals are supported if caller keeps \p netmon running
*/
diff --git a/tests/daemon/face/unix-stream-transport-fixture.hpp b/tests/daemon/face/unix-stream-transport-fixture.hpp
index d95be2c..2590cda 100644
--- a/tests/daemon/face/unix-stream-transport-fixture.hpp
+++ b/tests/daemon/face/unix-stream-transport-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -48,7 +48,7 @@
{
public:
explicit
- AcceptorWithCleanup(boost::asio::io_service& io, const std::string& path = "")
+ AcceptorWithCleanup(boost::asio::io_context& io, const std::string& path = "")
: unix_stream::acceptor(io)
{
this->open();
diff --git a/tests/daemon/global-io-fixture.cpp b/tests/daemon/global-io-fixture.cpp
index 05aa8a1..2fdb6ed 100644
--- a/tests/daemon/global-io-fixture.cpp
+++ b/tests/daemon/global-io-fixture.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -42,11 +42,7 @@
GlobalIoFixture::pollIo()
{
if (g_io.stopped()) {
-#if BOOST_VERSION >= 106600
g_io.restart();
-#else
- g_io.reset();
-#endif
}
return g_io.poll();
}
diff --git a/tests/daemon/global-io-fixture.hpp b/tests/daemon/global-io-fixture.hpp
index e374ec0..5422e72 100644
--- a/tests/daemon/global-io-fixture.hpp
+++ b/tests/daemon/global-io-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -30,10 +30,11 @@
namespace nfd::tests {
-/** \brief A fixture providing proper setup and teardown of the global io_service.
+/**
+ * \brief A fixture providing proper setup and teardown of the global io_context.
*
- * Every daemon fixture or test case should inherit from this fixture,
- * to have per test case io_service initialization and cleanup.
+ * Every daemon fixture or test case should inherit from this fixture,
+ * to have per test case io_context initialization and cleanup.
*/
class GlobalIoFixture
{
@@ -42,18 +43,21 @@
~GlobalIoFixture();
- /** \brief Poll the global io_service.
+ /**
+ * \brief Poll the global io_context.
*/
size_t
pollIo();
protected:
- /** \brief Reference to the global io_service instance.
+ /**
+ * \brief Reference to the global io_context instance.
*/
- boost::asio::io_service& g_io;
+ boost::asio::io_context& g_io;
};
-/** \brief GlobalIoFixture that also overrides steady clock and system clock.
+/**
+ * \brief GlobalIoFixture that also overrides steady clock and system clock.
*/
class GlobalIoTimeFixture : public ClockFixture, public GlobalIoFixture
{
diff --git a/tests/daemon/rib-io-fixture.hpp b/tests/daemon/rib-io-fixture.hpp
index e825f7d..b280535 100644
--- a/tests/daemon/rib-io-fixture.hpp
+++ b/tests/daemon/rib-io-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -34,7 +34,8 @@
namespace nfd::tests {
-/** \brief A base test fixture that provides both main and RIB io_service.
+/**
+ * \brief A base test fixture that provides both main and RIB io_context.
*/
class RibIoFixture : public GlobalIoFixture
{
@@ -44,27 +45,31 @@
~RibIoFixture();
protected:
- /** \brief Poll main and RIB thread io_service to process all pending I/O events.
+ /**
+ * \brief Poll main and RIB thread io_context to process all pending I/O events.
*
* This call will execute all pending I/O events, including events that are posted
- * inside the processing event, i.e., main and RIB thread io_service will be polled
+ * inside the processing event, i.e., main and RIB thread io_context will be polled
* repeatedly until all pending events are processed.
*
- * \warning Must be called from the main thread
+ * \warning Must be called from the main thread.
*/
void
poll();
protected:
- /** \brief Pointer to global main io_service.
+ /**
+ * \brief Pointer to global main io_context.
*/
- boost::asio::io_service* g_mainIo = nullptr;
+ boost::asio::io_context* g_mainIo = nullptr;
- /** \brief Pointer to global RIB io_service.
+ /**
+ * \brief Pointer to global RIB io_context.
*/
- boost::asio::io_service* g_ribIo = nullptr;
+ boost::asio::io_context* g_ribIo = nullptr;
- /** \brief Global RIB thread.
+ /**
+ * \brief Global RIB thread.
*/
std::thread g_ribThread;
@@ -76,7 +81,8 @@
std::condition_variable m_ribPollEndCv;
};
-/** \brief RibIoFixture that also overrides steady clock and system clock.
+/**
+ * \brief RibIoFixture that also overrides steady clock and system clock.
*/
class RibIoTimeFixture : public ClockFixture, public RibIoFixture
{
diff --git a/tests/daemon/rib/service.t.cpp b/tests/daemon/rib/service.t.cpp
index 5b808cc..51189fc 100644
--- a/tests/daemon/rib/service.t.cpp
+++ b/tests/daemon/rib/service.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -29,7 +29,9 @@
#include "tests/test-common.hpp"
#include "tests/daemon/rib-io-fixture.hpp"
+#include <boost/asio/post.hpp>
#include <boost/property_tree/info_parser.hpp>
+
#include <sstream>
namespace nfd::tests {
@@ -63,7 +65,7 @@
BOOST_CHECK_THROW(Service::get(), std::logic_error);
BOOST_CHECK_THROW(Service(section, m_ribKeyChain), std::logic_error);
- runOnRibIoService([&] {
+ boost::asio::post(getRibIoService(), [&] {
{
BOOST_CHECK_THROW(Service::get(), std::logic_error);
Service ribService(section, m_ribKeyChain);
@@ -87,7 +89,7 @@
}
)CONFIG";
- runOnRibIoService([&] {
+ boost::asio::post(getRibIoService(), [&] {
BOOST_CHECK_NO_THROW(Service(makeSection(CONFIG), m_ribKeyChain));
});
poll();
@@ -102,7 +104,7 @@
}
)CONFIG";
- runOnRibIoService([&] {
+ boost::asio::post(getRibIoService(), [&] {
BOOST_CHECK_NO_THROW(Service(makeSection(CONFIG), m_ribKeyChain));
});
poll();
@@ -131,7 +133,7 @@
}
)CONFIG";
- runOnRibIoService([&] {
+ boost::asio::post(getRibIoService(), [&] {
BOOST_CHECK_EXCEPTION(Service(makeSection(CONFIG), m_ribKeyChain), ConfigFile::Error,
[] (const auto& e) {
return e.what() == "localhop_security and auto_prefix_propagate "