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 "
diff --git a/tests/io-fixture.hpp b/tests/io-fixture.hpp
index fec308e..ebc40da 100644
--- a/tests/io-fixture.hpp
+++ b/tests/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,
@@ -28,7 +28,7 @@
#include "tests/clock-fixture.hpp"
-#include <boost/asio/io_service.hpp>
+#include <boost/asio/io_context.hpp>
namespace nfd::tests {
@@ -39,17 +39,13 @@
afterTick() final
{
if (m_io.stopped()) {
-#if BOOST_VERSION >= 106600
m_io.restart();
-#else
- m_io.reset();
-#endif
}
m_io.poll();
}
protected:
- boost::asio::io_service m_io;
+ boost::asio::io_context m_io;
};
} // namespace nfd::tests
diff --git a/tests/other/wscript b/tests/other/wscript
index a2099aa..1514f61 100644
--- a/tests/other/wscript
+++ b/tests/other/wscript
@@ -31,7 +31,7 @@
# main
bld.objects(target=f'other-tests-{module}-main',
source='../main.cpp',
- use='BOOST',
+ use='BOOST_TESTS',
defines=[f'BOOST_TEST_MODULE={name}'])
# module
bld.program(name=module,
diff --git a/tests/tools/ndn-autoconfig/procedure.t.cpp b/tests/tools/ndn-autoconfig/procedure.t.cpp
index ea5311b..d6a024d 100644
--- a/tests/tools/ndn-autoconfig/procedure.t.cpp
+++ b/tests/tools/ndn-autoconfig/procedure.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,
@@ -66,10 +66,10 @@
/** \param stageName stage name
* \param nCalls pointer to a variable which is incremented each time doStart is invoked
* \param result expected result, nullopt to cause a failued
- * \param io io_service to asynchronously post the result
+ * \param io io_context to asynchronously post the result
*/
DummyStage(const std::string& stageName, int* nCalls,
- const std::optional<FaceUri>& result, boost::asio::io_service& io)
+ const std::optional<FaceUri>& result, boost::asio::io_context& io)
: m_stageName(stageName)
, m_nCalls(nCalls)
, m_result(result)
@@ -90,7 +90,8 @@
if (m_nCalls != nullptr) {
++(*m_nCalls);
}
- m_io.post([this] {
+
+ boost::asio::post(m_io, [this] {
if (m_result) {
this->succeed(*m_result);
}
@@ -104,7 +105,7 @@
std::string m_stageName;
int* m_nCalls;
std::optional<FaceUri> m_result;
- boost::asio::io_service& m_io;
+ boost::asio::io_context& m_io;
};
/** \brief Two-stage Procedure where the first stage succeeds and the second stage fails.
@@ -133,7 +134,7 @@
int nCalls2 = 0;
private:
- boost::asio::io_service& m_io;
+ boost::asio::io_context& m_io;
};
/** \brief Two-stage Procedure where the first stage fails and the second stage succeeds.
@@ -160,7 +161,7 @@
int nCalls2 = 0;
private:
- boost::asio::io_service& m_io;
+ boost::asio::io_context& m_io;
};
BOOST_AUTO_TEST_SUITE(NdnAutoconfig)
diff --git a/tests/tools/nfdc/status-report.t.cpp b/tests/tools/nfdc/status-report.t.cpp
index dcf797c..2e9626e 100644
--- a/tests/tools/nfdc/status-report.t.cpp
+++ b/tests/tools/nfdc/status-report.t.cpp
@@ -45,7 +45,7 @@
class DummyModule : public Module
{
public:
- DummyModule(const std::string& moduleName, boost::asio::io_service& io)
+ DummyModule(const std::string& moduleName, boost::asio::io_context& io)
: m_moduleName(moduleName)
, m_scheduler(io)
, m_res(0)
diff --git a/tests/wscript b/tests/wscript
index ed4eb19..6e27661 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -35,7 +35,7 @@
target='tests-common',
features='pch',
source=bld.path.ant_glob('*.cpp', excl='main.cpp'),
- use='core-objects',
+ use='BOOST_TESTS core-objects',
headers='../core/common.hpp boost-test.hpp',
defines=[tmpdir])
@@ -43,7 +43,7 @@
# main() for the module
bld.objects(target=f'unit-tests-{module}-main',
source='main.cpp',
- use='BOOST',
+ use='BOOST_TESTS',
defines=[f'BOOST_TEST_MODULE=NFD {module.capitalize()}'])
subdir = 'daemon/rib' if module == 'rib' else module