diff --git a/README-dev.md b/README-dev.md index 4cd0ef9..e7acc71 100644 --- a/README-dev.md +++ b/README-dev.md @@ -119,5 +119,5 @@ main(int argc, char* argv[]) ### Command Line Arguments -[Boost.Program\_options](https://www.boost.org/doc/libs/1_65_1/doc/html/program_options.html) +[Boost.Program\_options](https://www.boost.org/doc/libs/1_71_0/doc/html/program_options.html) is strongly preferred over `getopt(3)` for parsing command line arguments. diff --git a/tests/README.md b/tests/README.md index ca34f42..11f51f4 100644 --- a/tests/README.md +++ b/tests/README.md @@ -8,15 +8,19 @@ except the object that contains the `main()` function. For example: - bld(features='cxx', - name='tool-subtool-objects', +```python +def build(bld): + bld.objects( + target='tool-subtool-objects', source=bld.path.ant_glob('subtool/*.cpp', excl='subtool/main.cpp'), use='core-objects') - bld(features='cxx cxxprogram', + bld.program( + name='subtool', target='../../bin/subtool', source='subtool/main.cpp', use='tool-subtool-objects') bld(name='tool-objects', use='tool-subtool-objects') +``` diff --git a/tests/io-fixture.hpp b/tests/io-fixture.hpp index 71b098a..8f7fe27 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 +#include namespace ndn::tests { @@ -39,17 +39,13 @@ class IoFixture : public ClockFixture 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 ndn::tests diff --git a/tests/peek/ndnpeek.t.cpp b/tests/peek/ndnpeek.t.cpp index e7162b0..8a51b8e 100644 --- a/tests/peek/ndnpeek.t.cpp +++ b/tests/peek/ndnpeek.t.cpp @@ -24,7 +24,6 @@ #include -#include #include namespace ndn::peek::tests { @@ -129,7 +128,7 @@ class OutputPayloadOnly BOOST_AUTO_TEST_SUITE(Peek) BOOST_FIXTURE_TEST_SUITE(TestNdnPeek, NdnPeekFixture) -using OutputChecks = boost::mpl::vector; +using OutputChecks = std::tuple; BOOST_AUTO_TEST_CASE_TEMPLATE(Default, OutputCheck, OutputChecks) { diff --git a/tests/ping/integrated.t.cpp b/tests/ping/integrated.t.cpp index 6994beb..4a85fda 100644 --- a/tests/ping/integrated.t.cpp +++ b/tests/ping/integrated.t.cpp @@ -25,6 +25,7 @@ #include "tests/key-chain-fixture.hpp" #include +#include namespace ndn::ping::tests { @@ -53,7 +54,7 @@ class PingIntegratedFixture : public IoFixture, public KeyChainFixture void receive(DummyClientFace& face, const Packet& pkt) { - m_io.post([=, &face] { + boost::asio::post(m_io, [=, &face] { if (!wantLoss) { face.receive(pkt); } diff --git a/tests/test-case.t.cpp.sample b/tests/test-case.t.cpp.sample index a2f74c1..07e4d2b 100644 --- a/tests/test-case.t.cpp.sample +++ b/tests/test-case.t.cpp.sample @@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE(Test1) int i = 0; // For reference of available Boost.Test macros, see - // https://www.boost.org/doc/libs/1_65_1/libs/test/doc/html/boost_test/testing_tools/summary.html + // https://www.boost.org/doc/libs/1_71_0/libs/test/doc/html/boost_test/testing_tools/summary.html BOOST_REQUIRE_NO_THROW(i = 1); BOOST_CHECK_EQUAL(i, 1); diff --git a/tests/wscript b/tests/wscript index 5a21139..2f12f81 100644 --- a/tests/wscript +++ b/tests/wscript @@ -6,5 +6,5 @@ def build(bld): target=f'{top}/unit-tests', name='unit-tests', source=bld.path.ant_glob(['*.cpp'] + [f'{tool}/**/*.cpp' for tool in bld.env.BUILD_TOOLS]), - use=['core-objects'] + [f'{tool}-objects' for tool in bld.env.BUILD_TOOLS], + use=['BOOST_TESTS', 'core-objects'] + [f'{tool}-objects' for tool in bld.env.BUILD_TOOLS], install_path=None) diff --git a/tools/chunks/catchunks/pipeline-interests.cpp b/tools/chunks/catchunks/pipeline-interests.cpp index 218df28..ec30dd7 100644 --- a/tools/chunks/catchunks/pipeline-interests.cpp +++ b/tools/chunks/catchunks/pipeline-interests.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2016-2022, Regents of the University of California, + * Copyright (c) 2016-2023, Regents of the University of California, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University. * @@ -31,7 +31,8 @@ #include "pipeline-interests.hpp" #include "data-fetcher.hpp" -#include +#include +#include namespace ndn::chunks { @@ -101,8 +102,9 @@ PipelineInterests::onFailure(const std::string& reason) cancel(); - if (m_onFailure) - m_face.getIoService().post([this, reason] { m_onFailure(reason); }); + if (m_onFailure) { + boost::asio::post(m_face.getIoService(), [this, reason] { m_onFailure(reason); }); + } } void diff --git a/wscript b/wscript index c6a2fa7..d03de91 100644 --- a/wscript +++ b/wscript @@ -37,17 +37,15 @@ def configure(conf): conf.check_cfg(package='libndn-cxx', args=['libndn-cxx >= 0.8.1', '--cflags', '--libs'], uselib_store='NDN_CXX', pkg_config_path=pkg_config_path) - boost_libs = ['system', 'program_options'] - if conf.env.WITH_TESTS: - boost_libs.append('unit_test_framework') - conf.define('WITH_TESTS', 1) - - conf.check_boost(lib=boost_libs, mt=True) - if conf.env.BOOST_VERSION_NUMBER < 106501: - conf.fatal('The minimum supported version of Boost is 1.65.1.\n' + conf.check_boost(lib='program_options', mt=True) + if conf.env.BOOST_VERSION_NUMBER < 107100: + conf.fatal('The minimum supported version of Boost is 1.71.0.\n' 'Please upgrade your distribution or manually install a newer version of Boost.\n' 'For more information, see https://redmine.named-data.net/projects/nfd/wiki/Boost') + if conf.env.WITH_TESTS: + conf.check_boost(lib='unit_test_framework', mt=True, uselib_store='BOOST_TESTS') + conf.recurse('tools') conf.check_compiler_flags() @@ -56,6 +54,8 @@ def configure(conf): conf.load('coverage') conf.load('sanitizers') + conf.define_cond('WITH_TESTS', conf.env.WITH_TESTS) + conf.msg('Tools to build', ', '.join(conf.env.BUILD_TOOLS)) def build(bld): @@ -69,8 +69,8 @@ def build(bld): bld.objects( target='core-objects', - source=bld.path.find_node('core').ant_glob('*.cpp') + ['core/version.cpp'], - use='NDN_CXX BOOST', + source=bld.path.find_dir('core').ant_glob('*.cpp') + ['core/version.cpp'], + use='BOOST NDN_CXX', includes='.', export_includes='.')