diff --git a/tests/core/algorithm.t.cpp b/tests/core/algorithm.t.cpp index 75ebe832..fb232389 100644 --- a/tests/core/algorithm.t.cpp +++ b/tests/core/algorithm.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2015, Regents of the University of California, +/* + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -30,7 +30,7 @@ namespace nfd { namespace tests { -BOOST_FIXTURE_TEST_SUITE(TestAlgorithm, BaseFixture) +BOOST_AUTO_TEST_SUITE(TestAlgorithm) BOOST_AUTO_TEST_CASE(FindLastIf) { @@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE(FindLastIf) BOOST_CHECK_LE(hit2, vec.size()); } -BOOST_AUTO_TEST_SUITE_END() +BOOST_AUTO_TEST_SUITE_END() // TestAlgorithm } // namespace tests } // namespace nfd diff --git a/tests/core/config-file.t.cpp b/tests/core/config-file.t.cpp index 0be1cf18..c2ceb858 100644 --- a/tests/core/config-file.t.cpp +++ b/tests/core/config-file.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, 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 { namespace tests { -BOOST_FIXTURE_TEST_SUITE(TestConfigFile, BaseFixture) +BOOST_AUTO_TEST_SUITE(TestConfigFile) static const std::string CONFIG = R"CONFIG( a @@ -283,7 +283,7 @@ BOOST_AUTO_TEST_CASE(ReplaceSubscriber) BOOST_CHECK(sub2.allCallbacksFired()); } -class MissingCallbackFixture : public BaseFixture +class MissingCallbackFixture { public: void diff --git a/tests/core/counter.t.cpp b/tests/core/counter.t.cpp index ce9a086a..387b13f6 100644 --- a/tests/core/counter.t.cpp +++ b/tests/core/counter.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2017, Regents of the University of California, +/* + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -30,7 +30,7 @@ namespace nfd { namespace tests { -BOOST_FIXTURE_TEST_SUITE(TestCounter, BaseFixture) +BOOST_AUTO_TEST_SUITE(TestCounter) BOOST_AUTO_TEST_CASE(PacketCnt) { diff --git a/tests/core/network-predicate.t.cpp b/tests/core/network-predicate.t.cpp index a0a510e5..378b6aa2 100644 --- a/tests/core/network-predicate.t.cpp +++ b/tests/core/network-predicate.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -30,6 +30,7 @@ #include #include + #include #include @@ -39,7 +40,7 @@ namespace tests { BOOST_AUTO_TEST_SUITE(TestNetworkPredicate) template -class NetworkPredicateBaseFixture : public BaseFixture +class NetworkPredicateBaseFixture { public: void diff --git a/tests/core/network.t.cpp b/tests/core/network.t.cpp index 62eabdea..4ab71b56 100644 --- a/tests/core/network.t.cpp +++ b/tests/core/network.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -30,7 +30,7 @@ namespace nfd { namespace tests { -BOOST_FIXTURE_TEST_SUITE(TestNetwork, BaseFixture) +BOOST_AUTO_TEST_SUITE(TestNetwork) using boost::asio::ip::address; diff --git a/tests/core/privilege-helper.t.cpp b/tests/core/privilege-helper.t.cpp index 594f42f3..58f89472 100644 --- a/tests/core/privilege-helper.t.cpp +++ b/tests/core/privilege-helper.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -30,7 +30,7 @@ namespace nfd { namespace tests { -BOOST_FIXTURE_TEST_SUITE(TestPrivilegeHelper, BaseFixture) +BOOST_AUTO_TEST_SUITE(TestPrivilegeHelper) BOOST_AUTO_TEST_CASE(DropRaise) { diff --git a/tests/core/rtt-estimator.t.cpp b/tests/core/rtt-estimator.t.cpp index e5952e98..526b03d1 100644 --- a/tests/core/rtt-estimator.t.cpp +++ b/tests/core/rtt-estimator.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2017, Regents of the University of California, +/* + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -30,9 +30,9 @@ namespace nfd { namespace tests { -BOOST_FIXTURE_TEST_SUITE(TestRttEstimator, BaseFixture) +BOOST_AUTO_TEST_SUITE(TestRttEstimator) -static inline double +static double computeRtoAsFloatSeconds(RttEstimator& rtt) { typedef time::duration FloatSeconds; diff --git a/tests/daemon/face/channel-fixture.hpp b/tests/daemon/face/channel-fixture.hpp index 8f94a097..3e130958 100644 --- a/tests/daemon/face/channel-fixture.hpp +++ b/tests/daemon/face/channel-fixture.hpp @@ -28,6 +28,7 @@ #include "face/channel.hpp" +#include "tests/test-common.hpp" #include "tests/daemon/limited-io.hpp" #include @@ -39,7 +40,7 @@ namespace tests { using namespace nfd::tests; template -class ChannelFixture : public BaseFixture +class ChannelFixture : public GlobalIoFixture { static_assert(std::is_base_of::value, "ChannelFixture must be instantiated with a type derived from Channel"); diff --git a/tests/daemon/face/ethernet-channel.t.cpp b/tests/daemon/face/ethernet-channel.t.cpp index 9e70441c..d7a1cec6 100644 --- a/tests/daemon/face/ethernet-channel.t.cpp +++ b/tests/daemon/face/ethernet-channel.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -25,6 +25,7 @@ #include "face/ethernet-channel.hpp" +#include "tests/test-common.hpp" #include "ethernet-fixture.hpp" namespace nfd { diff --git a/tests/daemon/face/ethernet-fixture.hpp b/tests/daemon/face/ethernet-fixture.hpp index 0a75fcc7..5a8160e5 100644 --- a/tests/daemon/face/ethernet-fixture.hpp +++ b/tests/daemon/face/ethernet-fixture.hpp @@ -38,9 +38,9 @@ namespace tests { using namespace nfd::tests; -/** \brief a fixture providing a list of EthernetTransport-capable network interfaces +/** \brief Fixture providing a list of EthernetTransport-capable network interfaces. */ -class EthernetFixture : public virtual BaseFixture +class EthernetFixture : public virtual GlobalIoFixture { protected: EthernetFixture() diff --git a/tests/daemon/face/face-system-fixture.hpp b/tests/daemon/face/face-system-fixture.hpp index b7254fab..de3aca81 100644 --- a/tests/daemon/face/face-system-fixture.hpp +++ b/tests/daemon/face/face-system-fixture.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -32,7 +32,9 @@ #include "fw/face-table.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include "test-netif.hpp" + #include namespace nfd { @@ -41,7 +43,7 @@ namespace tests { using namespace nfd::tests; -class FaceSystemFixture : public virtual BaseFixture +class FaceSystemFixture : public virtual GlobalIoFixture { public: FaceSystemFixture() diff --git a/tests/daemon/face/face.t.cpp b/tests/daemon/face/face.t.cpp index 2876a37e..2dd3c955 100644 --- a/tests/daemon/face/face.t.cpp +++ b/tests/daemon/face/face.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2016, Regents of the University of California, +/* + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -24,11 +24,12 @@ */ #include "face/face.hpp" +#include "face/generic-link-service.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include "dummy-face.hpp" #include "dummy-transport.hpp" -#include "face/generic-link-service.hpp" namespace nfd { namespace face { @@ -37,7 +38,7 @@ namespace tests { using namespace nfd::tests; BOOST_AUTO_TEST_SUITE(Face) -BOOST_FIXTURE_TEST_SUITE(TestFace, BaseFixture) +BOOST_FIXTURE_TEST_SUITE(TestFace, GlobalIoFixture) using nfd::Face; diff --git a/tests/daemon/face/generic-link-service.t.cpp b/tests/daemon/face/generic-link-service.t.cpp index 00b6517e..d10dba52 100644 --- a/tests/daemon/face/generic-link-service.t.cpp +++ b/tests/daemon/face/generic-link-service.t.cpp @@ -26,9 +26,10 @@ #include "face/generic-link-service.hpp" #include "face/face.hpp" -#include "dummy-transport.hpp" -#include "tests/key-chain-fixture.hpp" #include "tests/test-common.hpp" +#include "tests/key-chain-fixture.hpp" +#include "tests/daemon/global-io-fixture.hpp" +#include "dummy-transport.hpp" #include #include @@ -45,7 +46,7 @@ BOOST_AUTO_TEST_SUITE(Face) using nfd::Face; -class GenericLinkServiceFixture : public UnitTestTimeFixture, public KeyChainFixture +class GenericLinkServiceFixture : public GlobalIoTimeFixture, public KeyChainFixture { protected: GenericLinkServiceFixture() diff --git a/tests/daemon/face/internal-face.t.cpp b/tests/daemon/face/internal-face.t.cpp index dfb98889..4c1618b9 100644 --- a/tests/daemon/face/internal-face.t.cpp +++ b/tests/daemon/face/internal-face.t.cpp @@ -27,6 +27,7 @@ #include "transport-test-common.hpp" #include "tests/key-chain-fixture.hpp" +#include "tests/daemon/global-io-fixture.hpp" namespace nfd { namespace face { @@ -36,7 +37,7 @@ using namespace nfd::tests; BOOST_AUTO_TEST_SUITE(Face) -class InternalFaceFixture : public UnitTestTimeFixture, public KeyChainFixture +class InternalFaceFixture : public GlobalIoTimeFixture, public KeyChainFixture { public: InternalFaceFixture() diff --git a/tests/daemon/face/lp-fragmenter.t.cpp b/tests/daemon/face/lp-fragmenter.t.cpp index 4bc8607d..9421619a 100644 --- a/tests/daemon/face/lp-fragmenter.t.cpp +++ b/tests/daemon/face/lp-fragmenter.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -27,6 +27,7 @@ #include "face/transport.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" namespace nfd { namespace face { @@ -34,7 +35,7 @@ namespace tests { using namespace nfd::tests; -class LpFragmenterFixture : public BaseFixture +class LpFragmenterFixture : public GlobalIoFixture { protected: LpFragmenter fragmenter{{}}; diff --git a/tests/daemon/face/lp-reassembler.t.cpp b/tests/daemon/face/lp-reassembler.t.cpp index 1d4ee6a4..f24eb980 100644 --- a/tests/daemon/face/lp-reassembler.t.cpp +++ b/tests/daemon/face/lp-reassembler.t.cpp @@ -26,6 +26,7 @@ #include "face/lp-reassembler.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" namespace nfd { namespace face { @@ -33,7 +34,7 @@ namespace tests { using namespace nfd::tests; -class LpReassemblerFixture : public UnitTestTimeFixture +class LpReassemblerFixture : public GlobalIoTimeFixture { protected: LpReassemblerFixture() diff --git a/tests/daemon/face/lp-reliability.t.cpp b/tests/daemon/face/lp-reliability.t.cpp index d2b9f222..8ec1dd0e 100644 --- a/tests/daemon/face/lp-reliability.t.cpp +++ b/tests/daemon/face/lp-reliability.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -28,6 +28,7 @@ #include "face/generic-link-service.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include "dummy-face.hpp" #include "dummy-transport.hpp" @@ -91,7 +92,7 @@ private: } }; -class LpReliabilityFixture : public UnitTestTimeFixture +class LpReliabilityFixture : public GlobalIoTimeFixture { public: LpReliabilityFixture() diff --git a/tests/daemon/face/multicast-udp-transport-fixture.hpp b/tests/daemon/face/multicast-udp-transport-fixture.hpp index 06455c76..775b12dd 100644 --- a/tests/daemon/face/multicast-udp-transport-fixture.hpp +++ b/tests/daemon/face/multicast-udp-transport-fixture.hpp @@ -29,8 +29,9 @@ #include "face/multicast-udp-transport.hpp" #include "face/face.hpp" -#include "dummy-receive-link-service.hpp" +#include "tests/test-common.hpp" #include "tests/daemon/limited-io.hpp" +#include "dummy-receive-link-service.hpp" namespace nfd { namespace face { @@ -40,7 +41,7 @@ using namespace nfd::tests; namespace ip = boost::asio::ip; using ip::udp; -class MulticastUdpTransportFixture : public BaseFixture +class MulticastUdpTransportFixture : public GlobalIoFixture { protected: MulticastUdpTransportFixture() diff --git a/tests/daemon/face/null-face.t.cpp b/tests/daemon/face/null-face.t.cpp index 40752455..6d34770c 100644 --- a/tests/daemon/face/null-face.t.cpp +++ b/tests/daemon/face/null-face.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2015, Regents of the University of California, +/* + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -25,6 +25,7 @@ #include "face/null-face.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include "transport-test-common.hpp" namespace nfd { @@ -34,7 +35,7 @@ namespace tests { using namespace nfd::tests; BOOST_AUTO_TEST_SUITE(Face) -BOOST_FIXTURE_TEST_SUITE(TestNullFace, BaseFixture) +BOOST_FIXTURE_TEST_SUITE(TestNullFace, GlobalIoFixture) using nfd::Face; diff --git a/tests/daemon/face/tcp-transport-fixture.hpp b/tests/daemon/face/tcp-transport-fixture.hpp index 65a4d247..631abe1f 100644 --- a/tests/daemon/face/tcp-transport-fixture.hpp +++ b/tests/daemon/face/tcp-transport-fixture.hpp @@ -29,8 +29,9 @@ #include "face/tcp-transport.hpp" #include "face/face.hpp" -#include "dummy-receive-link-service.hpp" +#include "tests/test-common.hpp" #include "tests/daemon/limited-io.hpp" +#include "dummy-receive-link-service.hpp" namespace nfd { namespace face { @@ -40,7 +41,7 @@ using namespace nfd::tests; namespace ip = boost::asio::ip; using ip::tcp; -class TcpTransportFixture : public BaseFixture +class TcpTransportFixture : public GlobalIoFixture { protected: TcpTransportFixture() diff --git a/tests/daemon/face/transport.t.cpp b/tests/daemon/face/transport.t.cpp index d06195e9..d586c201 100644 --- a/tests/daemon/face/transport.t.cpp +++ b/tests/daemon/face/transport.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -25,8 +25,10 @@ #include "face/transport.hpp" #include "face/face.hpp" -#include "dummy-transport.hpp" + +#include "tests/daemon/global-io-fixture.hpp" #include "dummy-receive-link-service.hpp" +#include "dummy-transport.hpp" #include "transport-test-common.hpp" #include @@ -209,7 +211,7 @@ BOOST_AUTO_TEST_CASE(NoExpirationTime) BOOST_CHECK_EQUAL(transport->getExpirationTime(), time::steady_clock::TimePoint::max()); } -class DummyTransportFixture : public nfd::tests::BaseFixture +class DummyTransportFixture : public nfd::tests::GlobalIoFixture { protected: DummyTransportFixture() diff --git a/tests/daemon/face/unicast-udp-transport-fixture.hpp b/tests/daemon/face/unicast-udp-transport-fixture.hpp index b269a710..08acd46d 100644 --- a/tests/daemon/face/unicast-udp-transport-fixture.hpp +++ b/tests/daemon/face/unicast-udp-transport-fixture.hpp @@ -29,8 +29,9 @@ #include "face/unicast-udp-transport.hpp" #include "face/face.hpp" -#include "dummy-receive-link-service.hpp" +#include "tests/test-common.hpp" #include "tests/daemon/limited-io.hpp" +#include "dummy-receive-link-service.hpp" namespace nfd { namespace face { @@ -40,7 +41,7 @@ using namespace nfd::tests; namespace ip = boost::asio::ip; using ip::udp; -class UnicastUdpTransportFixture : public BaseFixture +class UnicastUdpTransportFixture : public GlobalIoFixture { protected: UnicastUdpTransportFixture() diff --git a/tests/daemon/face/unix-stream-transport-fixture.hpp b/tests/daemon/face/unix-stream-transport-fixture.hpp index d131a00d..582db482 100644 --- a/tests/daemon/face/unix-stream-transport-fixture.hpp +++ b/tests/daemon/face/unix-stream-transport-fixture.hpp @@ -29,8 +29,9 @@ #include "face/unix-stream-transport.hpp" #include "face/face.hpp" -#include "dummy-receive-link-service.hpp" +#include "tests/test-common.hpp" #include "tests/daemon/limited-io.hpp" +#include "dummy-receive-link-service.hpp" #include @@ -76,7 +77,7 @@ public: } }; -class UnixStreamTransportFixture : public BaseFixture +class UnixStreamTransportFixture : public GlobalIoFixture { protected: UnixStreamTransportFixture() diff --git a/tests/daemon/face/websocket-transport-fixture.hpp b/tests/daemon/face/websocket-transport-fixture.hpp index 38ab81ce..8b8ee427 100644 --- a/tests/daemon/face/websocket-transport-fixture.hpp +++ b/tests/daemon/face/websocket-transport-fixture.hpp @@ -29,8 +29,9 @@ #include "face/websocket-transport.hpp" #include "face/face.hpp" -#include "dummy-receive-link-service.hpp" +#include "tests/test-common.hpp" #include "tests/daemon/limited-io.hpp" +#include "dummy-receive-link-service.hpp" namespace nfd { namespace face { @@ -41,7 +42,7 @@ namespace ip = boost::asio::ip; /** \brief a fixture that accepts a single WebSocket connection from a client */ -class WebSocketTransportFixture : public BaseFixture +class WebSocketTransportFixture : public GlobalIoFixture { protected: WebSocketTransportFixture() diff --git a/tests/daemon/fw/access-strategy.t.cpp b/tests/daemon/fw/access-strategy.t.cpp index 2f825bec..d950fc22 100644 --- a/tests/daemon/fw/access-strategy.t.cpp +++ b/tests/daemon/fw/access-strategy.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2016, Regents of the University of California, +/* + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -25,7 +25,6 @@ #include "fw/access-strategy.hpp" -#include "tests/test-common.hpp" #include "strategy-tester.hpp" #include "topology-tester.hpp" @@ -52,7 +51,7 @@ NFD_REGISTER_STRATEGY(AccessStrategyTester); // code style rule 3.25. This is necessary because some lines ends with '\' which // would cause "multi-line comment" compiler warning if '//' comments are used. -class TwoLaptopsFixture : public UnitTestTimeFixture +class TwoLaptopsFixture : public GlobalIoTimeFixture { protected: TwoLaptopsFixture() diff --git a/tests/daemon/fw/ad-hoc-forwarding.t.cpp b/tests/daemon/fw/ad-hoc-forwarding.t.cpp index 7e81893a..5ef50cfe 100644 --- a/tests/daemon/fw/ad-hoc-forwarding.t.cpp +++ b/tests/daemon/fw/ad-hoc-forwarding.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2017, Regents of the University of California, +/* + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -33,8 +33,9 @@ #include "fw/best-route-strategy2.hpp" #include "fw/multicast-strategy.hpp" -#include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include "topology-tester.hpp" + #include namespace nfd { @@ -44,7 +45,7 @@ namespace tests { using namespace nfd::tests; template -class AdHocForwardingFixture : public UnitTestTimeFixture +class AdHocForwardingFixture : public GlobalIoTimeFixture { protected: AdHocForwardingFixture() @@ -84,7 +85,7 @@ protected: }; BOOST_AUTO_TEST_SUITE(Fw) -BOOST_FIXTURE_TEST_SUITE(TestAdHocForwarding, BaseFixture) +BOOST_AUTO_TEST_SUITE(TestAdHocForwarding) using Strategies = boost::mpl::vector< AsfStrategy, diff --git a/tests/daemon/fw/algorithm.t.cpp b/tests/daemon/fw/algorithm.t.cpp index 1e482c56..cb32efc8 100644 --- a/tests/daemon/fw/algorithm.t.cpp +++ b/tests/daemon/fw/algorithm.t.cpp @@ -26,6 +26,7 @@ #include "fw/algorithm.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include "tests/daemon/face/dummy-face.hpp" namespace nfd { @@ -35,9 +36,9 @@ namespace tests { using namespace nfd::tests; BOOST_AUTO_TEST_SUITE(Fw) -BOOST_FIXTURE_TEST_SUITE(TestAlgorithm, BaseFixture) +BOOST_FIXTURE_TEST_SUITE(TestAlgorithm, GlobalIoFixture) -class ScopeControlFixture : public BaseFixture +class ScopeControlFixture : public GlobalIoFixture { protected: ScopeControlFixture() @@ -169,7 +170,7 @@ BOOST_AUTO_TEST_CASE(Nonce) BOOST_CHECK_EQUAL(findDuplicateNonce(entry5, 19004, *face2), DUPLICATE_NONCE_NONE); } -BOOST_FIXTURE_TEST_CASE(HasPendingOutRecords, UnitTestTimeFixture) +BOOST_FIXTURE_TEST_CASE(HasPendingOutRecords, GlobalIoTimeFixture) { auto face1 = make_shared(); auto face2 = make_shared(); @@ -204,7 +205,7 @@ BOOST_FIXTURE_TEST_CASE(HasPendingOutRecords, UnitTestTimeFixture) BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), false); } -BOOST_FIXTURE_TEST_CASE(GetLastOutgoing, UnitTestTimeFixture) +BOOST_FIXTURE_TEST_CASE(GetLastOutgoing, GlobalIoTimeFixture) { auto face1 = make_shared(); auto face2 = make_shared(); diff --git a/tests/daemon/fw/asf-measurements.t.cpp b/tests/daemon/fw/asf-measurements.t.cpp index 71491b7d..a5fee3f6 100644 --- a/tests/daemon/fw/asf-measurements.t.cpp +++ b/tests/daemon/fw/asf-measurements.t.cpp @@ -26,8 +26,9 @@ #include "fw/asf-measurements.hpp" #include "daemon/global.hpp" -#include "tests/daemon/face/dummy-face.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" +#include "tests/daemon/face/dummy-face.hpp" namespace nfd { namespace fw { @@ -41,7 +42,7 @@ BOOST_AUTO_TEST_SUITE(TestAsfMeasurements) BOOST_AUTO_TEST_SUITE(TestRttStats) -BOOST_FIXTURE_TEST_CASE(Basic, BaseFixture) +BOOST_FIXTURE_TEST_CASE(Basic, GlobalIoFixture) { RttStats stats; @@ -82,7 +83,7 @@ BOOST_AUTO_TEST_SUITE_END() // TestRttStats BOOST_AUTO_TEST_SUITE(TestFaceInfo) -BOOST_FIXTURE_TEST_CASE(Basic, UnitTestTimeFixture) +BOOST_FIXTURE_TEST_CASE(Basic, GlobalIoTimeFixture) { FaceInfo info; diff --git a/tests/daemon/fw/asf-strategy.t.cpp b/tests/daemon/fw/asf-strategy.t.cpp index 7e3de91c..d363880f 100644 --- a/tests/daemon/fw/asf-strategy.t.cpp +++ b/tests/daemon/fw/asf-strategy.t.cpp @@ -25,7 +25,6 @@ #include "fw/asf-strategy.hpp" -#include "tests/test-common.hpp" #include "strategy-tester.hpp" #include "topology-tester.hpp" @@ -41,9 +40,9 @@ typedef StrategyTester AsfStrategyTester; NFD_REGISTER_STRATEGY(AsfStrategyTester); BOOST_AUTO_TEST_SUITE(Fw) -BOOST_FIXTURE_TEST_SUITE(TestAsfStrategy, UnitTestTimeFixture) +BOOST_FIXTURE_TEST_SUITE(TestAsfStrategy, GlobalIoTimeFixture) -class AsfGridFixture : public UnitTestTimeFixture +class AsfGridFixture : public GlobalIoTimeFixture { protected: AsfGridFixture(Name parameters = AsfStrategy::getStrategyName()) diff --git a/tests/daemon/fw/best-route-strategy2.t.cpp b/tests/daemon/fw/best-route-strategy2.t.cpp index 83f99032..4101464a 100644 --- a/tests/daemon/fw/best-route-strategy2.t.cpp +++ b/tests/daemon/fw/best-route-strategy2.t.cpp @@ -41,7 +41,7 @@ NFD_REGISTER_STRATEGY(BestRouteStrategy2Tester); BOOST_AUTO_TEST_SUITE(Fw) -class BestRouteStrategy2Fixture : public UnitTestTimeFixture +class BestRouteStrategy2Fixture : public GlobalIoTimeFixture { protected: BestRouteStrategy2Fixture() diff --git a/tests/daemon/fw/face-table.t.cpp b/tests/daemon/fw/face-table.t.cpp index 839018ab..fc2e7ee6 100644 --- a/tests/daemon/fw/face-table.t.cpp +++ b/tests/daemon/fw/face-table.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2016, Regents of the University of California, +/* + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -26,13 +26,14 @@ #include "fw/face-table.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include "tests/daemon/face/dummy-face.hpp" namespace nfd { namespace tests { BOOST_AUTO_TEST_SUITE(Fw) -BOOST_FIXTURE_TEST_SUITE(TestFaceTable, BaseFixture) +BOOST_FIXTURE_TEST_SUITE(TestFaceTable, GlobalIoFixture) BOOST_AUTO_TEST_CASE(AddRemove) { diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp index 60c8ea4f..8e3bae3c 100644 --- a/tests/daemon/fw/forwarder.t.cpp +++ b/tests/daemon/fw/forwarder.t.cpp @@ -27,6 +27,7 @@ #include "daemon/global.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include "tests/daemon/face/dummy-face.hpp" #include "choose-strategy.hpp" #include "dummy-strategy.hpp" @@ -37,7 +38,7 @@ namespace nfd { namespace tests { BOOST_AUTO_TEST_SUITE(Fw) -BOOST_FIXTURE_TEST_SUITE(TestForwarder, UnitTestTimeFixture) +BOOST_FIXTURE_TEST_SUITE(TestForwarder, GlobalIoTimeFixture) BOOST_AUTO_TEST_CASE(SimpleExchange) { @@ -534,7 +535,7 @@ BOOST_AUTO_TEST_CASE(InterestLoopNack) BOOST_CHECK(face3->sentNacks.empty()); } -BOOST_FIXTURE_TEST_CASE(InterestLoopWithShortLifetime, UnitTestTimeFixture) // Bug 1953 +BOOST_AUTO_TEST_CASE(InterestLoopWithShortLifetime) // Bug 1953 { Forwarder forwarder; auto face1 = make_shared(); @@ -592,8 +593,8 @@ BOOST_AUTO_TEST_CASE(PitLeak) // Bug 3484 BOOST_CHECK_EQUAL(pit.size(), 0); } -BOOST_AUTO_TEST_SUITE_END() -BOOST_AUTO_TEST_SUITE_END() +BOOST_AUTO_TEST_SUITE_END() // TestForwarder +BOOST_AUTO_TEST_SUITE_END() // Fw } // namespace tests } // namespace nfd diff --git a/tests/daemon/fw/forwarding-hint.t.cpp b/tests/daemon/fw/forwarding-hint.t.cpp index 7d0d37de..e37c267c 100644 --- a/tests/daemon/fw/forwarding-hint.t.cpp +++ b/tests/daemon/fw/forwarding-hint.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2017, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -25,6 +25,7 @@ #include "fw/best-route-strategy2.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include "topology-tester.hpp" namespace nfd { @@ -52,7 +53,7 @@ BOOST_AUTO_TEST_SUITE(TestForwardingHint) * /net/ndnsim * (serverQ) */ -class NdnsimTeliaUclaTopologyFixture : public UnitTestTimeFixture +class NdnsimTeliaUclaTopologyFixture : public GlobalIoTimeFixture { public: NdnsimTeliaUclaTopologyFixture() diff --git a/tests/daemon/fw/multicast-strategy.t.cpp b/tests/daemon/fw/multicast-strategy.t.cpp index e3ed88b5..a6d9be62 100644 --- a/tests/daemon/fw/multicast-strategy.t.cpp +++ b/tests/daemon/fw/multicast-strategy.t.cpp @@ -26,8 +26,8 @@ #include "fw/multicast-strategy.hpp" #include "daemon/global.hpp" -#include "tests/daemon/face/dummy-face.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/face/dummy-face.hpp" #include "strategy-tester.hpp" namespace nfd { @@ -39,7 +39,7 @@ using namespace nfd::tests; typedef StrategyTester MulticastStrategyTester; NFD_REGISTER_STRATEGY(MulticastStrategyTester); -class MulticastStrategyFixture : public UnitTestTimeFixture +class MulticastStrategyFixture : public GlobalIoTimeFixture { protected: MulticastStrategyFixture() diff --git a/tests/daemon/fw/ncc-strategy.t.cpp b/tests/daemon/fw/ncc-strategy.t.cpp index 40442513..86238af7 100644 --- a/tests/daemon/fw/ncc-strategy.t.cpp +++ b/tests/daemon/fw/ncc-strategy.t.cpp @@ -39,7 +39,7 @@ typedef StrategyTester NccStrategyTester; NFD_REGISTER_STRATEGY(NccStrategyTester); BOOST_AUTO_TEST_SUITE(Fw) -BOOST_FIXTURE_TEST_SUITE(TestNccStrategy, UnitTestTimeFixture) +BOOST_FIXTURE_TEST_SUITE(TestNccStrategy, GlobalIoTimeFixture) BOOST_AUTO_TEST_CASE(FavorRespondingUpstream) { diff --git a/tests/daemon/fw/pit-expiry.t.cpp b/tests/daemon/fw/pit-expiry.t.cpp index 1e0b599d..5467c4ae 100644 --- a/tests/daemon/fw/pit-expiry.t.cpp +++ b/tests/daemon/fw/pit-expiry.t.cpp @@ -23,11 +23,11 @@ * NFD, e.g., in COPYING.md file. If not, see . */ -#include "dummy-strategy.hpp" -#include "choose-strategy.hpp" -#include "tests/daemon/face/dummy-face.hpp" - #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" +#include "tests/daemon/face/dummy-face.hpp" +#include "choose-strategy.hpp" +#include "dummy-strategy.hpp" #include @@ -38,7 +38,7 @@ namespace tests { using namespace nfd::tests; BOOST_AUTO_TEST_SUITE(Fw) -BOOST_FIXTURE_TEST_SUITE(TestPitExpiry, UnitTestTimeFixture) +BOOST_FIXTURE_TEST_SUITE(TestPitExpiry, GlobalIoTimeFixture) class PitExpiryTestStrategy : public DummyStrategy { diff --git a/tests/daemon/fw/retx-suppression.t.cpp b/tests/daemon/fw/retx-suppression.t.cpp index c96ac67c..a0aab025 100644 --- a/tests/daemon/fw/retx-suppression.t.cpp +++ b/tests/daemon/fw/retx-suppression.t.cpp @@ -28,6 +28,7 @@ #include "fw/retx-suppression-exponential.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include "tests/daemon/face/dummy-face.hpp" namespace nfd { @@ -37,7 +38,7 @@ namespace tests { using namespace nfd::tests; BOOST_AUTO_TEST_SUITE(Fw) -BOOST_FIXTURE_TEST_SUITE(TestRetxSuppression, UnitTestTimeFixture) +BOOST_FIXTURE_TEST_SUITE(TestRetxSuppression, GlobalIoTimeFixture) BOOST_AUTO_TEST_CASE(Fixed) { diff --git a/tests/daemon/fw/strategy-nack-return.t.cpp b/tests/daemon/fw/strategy-nack-return.t.cpp index 3d614520..2708710a 100644 --- a/tests/daemon/fw/strategy-nack-return.t.cpp +++ b/tests/daemon/fw/strategy-nack-return.t.cpp @@ -47,7 +47,7 @@ using namespace nfd::tests; BOOST_AUTO_TEST_SUITE(Fw) template -class StrategyNackReturnFixture : public UnitTestTimeFixture +class StrategyNackReturnFixture : public GlobalIoTimeFixture { public: StrategyNackReturnFixture() @@ -189,7 +189,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(Timeout, // #3033 note-7 BOOST_FIXTURE_TEST_CASE_TEMPLATE(LiveDeadlock, - S, Strategies, UnitTestTimeFixture) + S, Strategies, GlobalIoTimeFixture) { /* * /----------\ diff --git a/tests/daemon/fw/strategy-no-route.t.cpp b/tests/daemon/fw/strategy-no-route.t.cpp index 6e8aa8a7..daf3f2a3 100644 --- a/tests/daemon/fw/strategy-no-route.t.cpp +++ b/tests/daemon/fw/strategy-no-route.t.cpp @@ -34,9 +34,10 @@ #include "fw/best-route-strategy2.hpp" #include "fw/multicast-strategy.hpp" +#include "tests/test-common.hpp" +#include "tests/daemon/face/dummy-face.hpp" #include "choose-strategy.hpp" #include "strategy-tester.hpp" -#include "tests/daemon/face/dummy-face.hpp" #include #include @@ -48,7 +49,7 @@ namespace tests { using namespace nfd::tests; template -class StrategyNoRouteFixture : public UnitTestTimeFixture +class StrategyNoRouteFixture : public GlobalIoTimeFixture { public: StrategyNoRouteFixture() @@ -76,7 +77,7 @@ public: }; BOOST_AUTO_TEST_SUITE(Fw) -BOOST_FIXTURE_TEST_SUITE(TestStrategyNoRoute, BaseFixture) +BOOST_AUTO_TEST_SUITE(TestStrategyNoRoute) template class Test diff --git a/tests/daemon/fw/strategy-scope-control.t.cpp b/tests/daemon/fw/strategy-scope-control.t.cpp index c97e8abd..29808347 100644 --- a/tests/daemon/fw/strategy-scope-control.t.cpp +++ b/tests/daemon/fw/strategy-scope-control.t.cpp @@ -35,9 +35,10 @@ #include "fw/multicast-strategy.hpp" #include "fw/ncc-strategy.hpp" +#include "tests/test-common.hpp" +#include "tests/daemon/face/dummy-face.hpp" #include "choose-strategy.hpp" #include "strategy-tester.hpp" -#include "tests/daemon/face/dummy-face.hpp" #include #include @@ -49,7 +50,7 @@ namespace tests { using namespace nfd::tests; template -class StrategyScopeControlFixture : public UnitTestTimeFixture +class StrategyScopeControlFixture : public GlobalIoTimeFixture { public: StrategyScopeControlFixture() diff --git a/tests/daemon/fw/strategy.t.cpp b/tests/daemon/fw/strategy.t.cpp index 11f3f38e..41b0f8df 100644 --- a/tests/daemon/fw/strategy.t.cpp +++ b/tests/daemon/fw/strategy.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2017, Regents of the University of California, +/* + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -24,14 +24,16 @@ */ #include "fw/strategy.hpp" -#include "dummy-strategy.hpp" + +#include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include "tests/daemon/face/dummy-face.hpp" +#include "dummy-strategy.hpp" + #include #include #include -#include "tests/test-common.hpp" - namespace nfd { namespace fw { namespace tests { @@ -39,7 +41,7 @@ namespace tests { using namespace nfd::tests; BOOST_AUTO_TEST_SUITE(Fw) -BOOST_FIXTURE_TEST_SUITE(TestStrategy, BaseFixture) +BOOST_FIXTURE_TEST_SUITE(TestStrategy, GlobalIoFixture) // Strategy registry is tested in table/strategy-choice.t.cpp and strategy-instantiation.t.cpp diff --git a/tests/daemon/fw/unsolicited-data-policy.t.cpp b/tests/daemon/fw/unsolicited-data-policy.t.cpp index e6b73adb..11eafe1c 100644 --- a/tests/daemon/fw/unsolicited-data-policy.t.cpp +++ b/tests/daemon/fw/unsolicited-data-policy.t.cpp @@ -25,9 +25,11 @@ #include "fw/unsolicited-data-policy.hpp" #include "fw/forwarder.hpp" -#include "tests/daemon/face/dummy-face.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" +#include "tests/daemon/face/dummy-face.hpp" + #include #include @@ -37,7 +39,7 @@ namespace tests { using namespace nfd::tests; -class UnsolicitedDataPolicyFixture : public UnitTestTimeFixture +class UnsolicitedDataPolicyFixture : public GlobalIoTimeFixture { protected: UnsolicitedDataPolicyFixture() diff --git a/tests/daemon/global-io-fixture.cpp b/tests/daemon/global-io-fixture.cpp new file mode 100644 index 00000000..4888e802 --- /dev/null +++ b/tests/daemon/global-io-fixture.cpp @@ -0,0 +1,48 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2014-2019, Regents of the University of California, + * Arizona Board of Regents, + * Colorado State University, + * University Pierre & Marie Curie, Sorbonne University, + * Washington University in St. Louis, + * Beijing Institute of Technology, + * The University of Memphis. + * + * This file is part of NFD (Named Data Networking Forwarding Daemon). + * See AUTHORS.md for complete list of NFD authors and contributors. + * + * NFD is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * NFD, e.g., in COPYING.md file. If not, see . + */ + +#include "tests/daemon/global-io-fixture.hpp" +#include "daemon/global.hpp" + +namespace nfd { +namespace tests { + +GlobalIoFixture::GlobalIoFixture() + : g_io(getGlobalIoService()) +{ +} + +GlobalIoFixture::~GlobalIoFixture() +{ + resetGlobalIoService(); +} + +GlobalIoTimeFixture::GlobalIoTimeFixture() + : ClockFixture(g_io) +{ +} + +} // namespace tests +} // namespace nfd diff --git a/tests/test-case.t.cpp.sample b/tests/daemon/global-io-fixture.hpp similarity index 55% rename from tests/test-case.t.cpp.sample rename to tests/daemon/global-io-fixture.hpp index bfc8219d..6dbc8917 100644 --- a/tests/test-case.t.cpp.sample +++ b/tests/daemon/global-io-fixture.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -23,44 +23,41 @@ * NFD, e.g., in COPYING.md file. If not, see . */ -// #include "unit-under-test.hpp" -// The unit being tested MUST be included first, to ensure the header compiles on its own. -// For further information about test naming conventions, see -// https://redmine.named-data.net/projects/nfd/wiki/UnitTesting +#ifndef NFD_TESTS_DAEMON_GLOBAL_IO_FIXTURE_HPP +#define NFD_TESTS_DAEMON_GLOBAL_IO_FIXTURE_HPP -#include "tests/test-common.hpp" +#include "tests/clock-fixture.hpp" -// Unit tests SHOULD go inside nfd::tests namespace. namespace nfd { namespace tests { -// Test suite SHOULD use BaseFixture or a subclass of it. -BOOST_FIXTURE_TEST_SUITE(TestSkeleton, BaseFixture) - -BOOST_AUTO_TEST_CASE(Test1) +/** \brief A fixture providing proper setup and teardown of the global io_service. + * + * Every daemon fixture or test case should inherit from this fixture, + * to have per test case io_service initialization and cleanup. + */ +class GlobalIoFixture { - int i = 0; +protected: + GlobalIoFixture(); - // For reference of available Boost.Test macros, see - // https://www.boost.org/doc/libs/1_58_0/libs/test/doc/html/utf/testing-tools/reference.html + ~GlobalIoFixture(); - BOOST_CHECK_EQUAL(i, 0); - BOOST_CHECK_GT(++i, 0); -} - -// Custom fixture SHOULD derive from BaseFixture. -class Test2Fixture : protected BaseFixture -{ +protected: + /** \brief Reference to the global io_service instance. + */ + boost::asio::io_service& g_io; }; -BOOST_FIXTURE_TEST_CASE(Test2, Test2Fixture) +/** \brief GlobalIoFixture that also overrides steady clock and system clock. + */ +class GlobalIoTimeFixture : public GlobalIoFixture, public ClockFixture { - // g_io is a shorthand of getGlobalIoService(). - // resetGlobalIoService() is automatically called after each test case. - g_io.run(); -} - -BOOST_AUTO_TEST_SUITE_END() +protected: + GlobalIoTimeFixture(); +}; } // namespace tests } // namespace nfd + +#endif // NFD_TESTS_DAEMON_GLOBAL_IO_FIXTURE_HPP diff --git a/tests/daemon/global.t.cpp b/tests/daemon/global.t.cpp index bdde1ba5..bb24218b 100644 --- a/tests/daemon/global.t.cpp +++ b/tests/daemon/global.t.cpp @@ -26,6 +26,7 @@ #include "daemon/global.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include "tests/daemon/rib-io-fixture.hpp" #include @@ -33,7 +34,7 @@ namespace nfd { namespace tests { -BOOST_FIXTURE_TEST_SUITE(TestGlobal, BaseFixture) +BOOST_FIXTURE_TEST_SUITE(TestGlobal, GlobalIoFixture) BOOST_AUTO_TEST_CASE(ThreadLocalIoService) { diff --git a/tests/daemon/limited-io.cpp b/tests/daemon/limited-io.cpp index 2779b246..c54a2903 100644 --- a/tests/daemon/limited-io.cpp +++ b/tests/daemon/limited-io.cpp @@ -23,8 +23,8 @@ * NFD, e.g., in COPYING.md file. If not, see . */ -#include "limited-io.hpp" -#include "core/logger.hpp" +#include "tests/daemon/limited-io.hpp" +#include "tests/test-common.hpp" #include "daemon/global.hpp" #include @@ -32,18 +32,16 @@ namespace nfd { namespace tests { -NFD_LOG_INIT(tests.LimitedIo); - const int LimitedIo::UNLIMITED_OPS = std::numeric_limits::max(); const time::nanoseconds LimitedIo::UNLIMITED_TIME = time::nanoseconds::min(); -LimitedIo::LimitedIo(UnitTestTimeFixture* uttf) - : m_uttf(uttf) +LimitedIo::LimitedIo(GlobalIoTimeFixture* fixture) + : m_fixture(fixture) { } LimitedIo::StopReason -LimitedIo::run(int nOpsLimit, const time::nanoseconds& timeLimit, const time::nanoseconds& tick) +LimitedIo::run(int nOpsLimit, time::nanoseconds timeLimit, time::nanoseconds tick) { BOOST_ASSERT(!m_isRunning); @@ -60,18 +58,18 @@ LimitedIo::run(int nOpsLimit, const time::nanoseconds& timeLimit, const time::na } try { - if (m_uttf == nullptr) { + if (m_fixture == nullptr) { getGlobalIoService().run(); } else { // timeLimit is enforced by afterTimeout - m_uttf->advanceClocks(tick, time::nanoseconds::max()); + m_fixture->advanceClocks(tick, time::nanoseconds::max()); } } catch (const StopException&) { } - catch (const std::exception& ex) { - NFD_LOG_ERROR("LimitedIo::run: " << boost::diagnostic_information(ex)); + catch (...) { + BOOST_WARN_MESSAGE(false, boost::current_exception_diagnostic_information()); m_reason = EXCEPTION; m_lastException = std::current_exception(); } @@ -96,7 +94,7 @@ LimitedIo::afterOp() if (m_nOpsRemaining <= 0) { m_reason = EXCEED_OPS; getGlobalIoService().stop(); - if (m_uttf != nullptr) { + if (m_fixture != nullptr) { NDN_THROW(StopException()); } } @@ -107,7 +105,7 @@ LimitedIo::afterTimeout() { m_reason = EXCEED_TIME; getGlobalIoService().stop(); - if (m_uttf != nullptr) { + if (m_fixture != nullptr) { NDN_THROW(StopException()); } } diff --git a/tests/daemon/limited-io.hpp b/tests/daemon/limited-io.hpp index 7e7ecc4c..a34d20ef 100644 --- a/tests/daemon/limited-io.hpp +++ b/tests/daemon/limited-io.hpp @@ -26,14 +26,14 @@ #ifndef NFD_TESTS_DAEMON_LIMITED_IO_HPP #define NFD_TESTS_DAEMON_LIMITED_IO_HPP -#include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include namespace nfd { namespace tests { -/** \brief provides IO operations limit and/or time limit for unit testing +/** \brief Provides IO operations limit and/or time limit for unit testing. * * \warning LimitedIo is incompatible with RibIoFixture */ @@ -41,7 +41,7 @@ class LimitedIo : noncopyable { public: explicit - LimitedIo(UnitTestTimeFixture* uttf = nullptr); + LimitedIo(GlobalIoTimeFixture* fixture = nullptr); /// indicates why run() returns enum StopReason { @@ -58,12 +58,11 @@ public: /** \brief g_io.run() with operation count and/or time limit * \param nOpsLimit operation count limit, pass UNLIMITED_OPS for no limit * \param timeLimit time limit, pass UNLIMITED_TIME for no limit - * \param tick if this LimitedIo is constructed with UnitTestTimeFixture, + * \param tick if this LimitedIo is constructed with GlobalIoTimeFixture, * this is passed to .advanceClocks(), otherwise ignored */ StopReason - run(int nOpsLimit, const time::nanoseconds& timeLimit, - const time::nanoseconds& tick = time::milliseconds(1)); + run(int nOpsLimit, time::nanoseconds timeLimit, time::nanoseconds tick = 1_ms); /// count an operation void @@ -74,7 +73,7 @@ public: * equivalent to .run(UNLIMITED_OPS, d) */ void - defer(const time::nanoseconds& d) + defer(time::nanoseconds d) { this->run(UNLIMITED_OPS, d); } @@ -100,7 +99,7 @@ public: static const time::nanoseconds UNLIMITED_TIME; private: - UnitTestTimeFixture* m_uttf; + GlobalIoTimeFixture* m_fixture; StopReason m_reason; int m_nOpsRemaining = 0; scheduler::EventId m_timeout; diff --git a/tests/daemon/mgmt/face-manager-create-face.t.cpp b/tests/daemon/mgmt/face-manager-create-face.t.cpp index ac42dc94..7c0fe6f1 100644 --- a/tests/daemon/mgmt/face-manager-create-face.t.cpp +++ b/tests/daemon/mgmt/face-manager-create-face.t.cpp @@ -36,7 +36,7 @@ namespace tests { BOOST_AUTO_TEST_SUITE(Mgmt) BOOST_AUTO_TEST_SUITE(TestFaceManager) -BOOST_FIXTURE_TEST_SUITE(CreateFace, BaseFixture) +BOOST_FIXTURE_TEST_SUITE(CreateFace, GlobalIoFixture) class TcpFaceOnDemand { diff --git a/tests/daemon/mgmt/general-config-section.t.cpp b/tests/daemon/mgmt/general-config-section.t.cpp index 98b9458c..1f7188a9 100644 --- a/tests/daemon/mgmt/general-config-section.t.cpp +++ b/tests/daemon/mgmt/general-config-section.t.cpp @@ -28,6 +28,7 @@ #include "core/privilege-helper.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include @@ -37,7 +38,7 @@ namespace tests { using namespace nfd::tests; -class GeneralConfigSectionFixture : public BaseFixture +class GeneralConfigSectionFixture : public GlobalIoFixture { public: GeneralConfigSectionFixture() diff --git a/tests/daemon/mgmt/manager-common-fixture.hpp b/tests/daemon/mgmt/manager-common-fixture.hpp index a12d671e..b5bae0d7 100644 --- a/tests/daemon/mgmt/manager-common-fixture.hpp +++ b/tests/daemon/mgmt/manager-common-fixture.hpp @@ -29,7 +29,9 @@ #include "mgmt/manager-base.hpp" #include "fw/forwarder.hpp" +#include "tests/test-common.hpp" #include "tests/key-chain-fixture.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include #include @@ -39,7 +41,7 @@ namespace tests { /** \brief A fixture that provides a CommandInterestSigner. */ -class CommandInterestSignerFixture : public UnitTestTimeFixture, public KeyChainFixture +class CommandInterestSignerFixture : public GlobalIoTimeFixture, public KeyChainFixture { protected: CommandInterestSignerFixture(); diff --git a/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp b/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp index 6310ced2..2afa8fda 100644 --- a/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp +++ b/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp @@ -26,7 +26,9 @@ #include "mgmt/rib-manager.hpp" #include "rib/fib-updater.hpp" +#include "tests/test-common.hpp" #include "tests/key-chain-fixture.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include @@ -35,7 +37,7 @@ namespace tests { using rib::Route; -class RibManagerSlAnnounceFixture : public UnitTestTimeFixture, public KeyChainFixture +class RibManagerSlAnnounceFixture : public GlobalIoTimeFixture, public KeyChainFixture { public: using SlAnnounceResult = RibManager::SlAnnounceResult; diff --git a/tests/daemon/mgmt/tables-config-section.t.cpp b/tests/daemon/mgmt/tables-config-section.t.cpp index a52b688f..cfcc3baa 100644 --- a/tests/daemon/mgmt/tables-config-section.t.cpp +++ b/tests/daemon/mgmt/tables-config-section.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -30,12 +30,13 @@ #include "tests/test-common.hpp" #include "tests/check-typeid.hpp" -#include "../fw/dummy-strategy.hpp" +#include "tests/daemon/global-io-fixture.hpp" +#include "tests/daemon/fw/dummy-strategy.hpp" namespace nfd { namespace tests { -class TablesConfigSectionFixture : protected BaseFixture +class TablesConfigSectionFixture : public GlobalIoFixture { protected: TablesConfigSectionFixture() diff --git a/tests/daemon/rib-io-fixture.cpp b/tests/daemon/rib-io-fixture.cpp index 98563a97..768c5cc2 100644 --- a/tests/daemon/rib-io-fixture.cpp +++ b/tests/daemon/rib-io-fixture.cpp @@ -24,6 +24,7 @@ */ #include "tests/daemon/rib-io-fixture.hpp" +#include "tests/test-common.hpp" #include "daemon/global.hpp" #include @@ -121,6 +122,11 @@ RibIoFixture::poll() } while (nHandlersRun > 0); } +RibIoTimeFixture::RibIoTimeFixture() + : ClockFixture(g_io) +{ +} + void RibIoTimeFixture::pollAfterClockTick() { diff --git a/tests/daemon/rib-io-fixture.hpp b/tests/daemon/rib-io-fixture.hpp index 67b803c8..5fcefb63 100644 --- a/tests/daemon/rib-io-fixture.hpp +++ b/tests/daemon/rib-io-fixture.hpp @@ -26,7 +26,7 @@ #ifndef NFD_TESTS_DAEMON_RIB_IO_FIXTURE_HPP #define NFD_TESTS_DAEMON_RIB_IO_FIXTURE_HPP -#include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include #include @@ -37,7 +37,7 @@ namespace tests { /** \brief A base test fixture that provides both main and RIB io_service. */ -class RibIoFixture : public virtual BaseFixture +class RibIoFixture : public GlobalIoFixture { protected: RibIoFixture(); @@ -79,8 +79,11 @@ private: /** \brief RibIoFixture that also overrides steady clock and system clock. */ -class RibIoTimeFixture : public RibIoFixture, public UnitTestTimeFixture +class RibIoTimeFixture : public RibIoFixture, public ClockFixture { +protected: + RibIoTimeFixture(); + private: void pollAfterClockTick() override; diff --git a/tests/daemon/rib/fib-updates-common.hpp b/tests/daemon/rib/fib-updates-common.hpp index 7a123d31..77348be2 100644 --- a/tests/daemon/rib/fib-updates-common.hpp +++ b/tests/daemon/rib/fib-updates-common.hpp @@ -29,6 +29,7 @@ #include "rib/fib-updater.hpp" #include "tests/key-chain-fixture.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include "tests/daemon/rib/create-route.hpp" #include @@ -60,7 +61,7 @@ compareNameFaceIdCostAction(const FibUpdate& lhs, const FibUpdate& rhs) return false; } -class FibUpdatesFixture : public nfd::tests::BaseFixture, public nfd::tests::KeyChainFixture +class FibUpdatesFixture : public nfd::tests::GlobalIoFixture, public nfd::tests::KeyChainFixture { public: FibUpdatesFixture() diff --git a/tests/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.t.cpp b/tests/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.t.cpp index 6925de17..6b67702a 100644 --- a/tests/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.t.cpp +++ b/tests/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -26,6 +26,7 @@ #include "rib/readvertise/client-to-nlsr-readvertise-policy.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" namespace nfd { namespace rib { @@ -34,7 +35,7 @@ namespace tests { using namespace nfd::tests; BOOST_AUTO_TEST_SUITE(Readvertise) -BOOST_FIXTURE_TEST_SUITE(TestClientToNlsrReadvertisePolicy, BaseFixture) +BOOST_FIXTURE_TEST_SUITE(TestClientToNlsrReadvertisePolicy, GlobalIoFixture) BOOST_AUTO_TEST_CASE(ReadvertiseClientRoute) { diff --git a/tests/daemon/rib/readvertise/host-to-gateway-readvertise-policy.t.cpp b/tests/daemon/rib/readvertise/host-to-gateway-readvertise-policy.t.cpp index aaff73e7..94120c00 100644 --- a/tests/daemon/rib/readvertise/host-to-gateway-readvertise-policy.t.cpp +++ b/tests/daemon/rib/readvertise/host-to-gateway-readvertise-policy.t.cpp @@ -25,7 +25,9 @@ #include "rib/readvertise/host-to-gateway-readvertise-policy.hpp" +#include "tests/test-common.hpp" #include "tests/key-chain-fixture.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include @@ -35,7 +37,7 @@ namespace tests { using namespace nfd::tests; -class HostToGatewayReadvertisePolicyFixture : public BaseFixture, public KeyChainFixture +class HostToGatewayReadvertisePolicyFixture : public GlobalIoFixture, public KeyChainFixture { public: static RibRouteRef diff --git a/tests/daemon/rib/readvertise/nfd-rib-readvertise-destination.t.cpp b/tests/daemon/rib/readvertise/nfd-rib-readvertise-destination.t.cpp index 6787769f..690a53b9 100644 --- a/tests/daemon/rib/readvertise/nfd-rib-readvertise-destination.t.cpp +++ b/tests/daemon/rib/readvertise/nfd-rib-readvertise-destination.t.cpp @@ -25,8 +25,9 @@ #include "rib/readvertise/nfd-rib-readvertise-destination.hpp" -#include "tests/key-chain-fixture.hpp" #include "tests/test-common.hpp" +#include "tests/key-chain-fixture.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include #include @@ -37,7 +38,7 @@ namespace tests { using namespace nfd::tests; -class NfdRibReadvertiseDestinationFixture : public UnitTestTimeFixture, public KeyChainFixture +class NfdRibReadvertiseDestinationFixture : public GlobalIoTimeFixture, public KeyChainFixture { public: NfdRibReadvertiseDestinationFixture() diff --git a/tests/daemon/rib/readvertise/readvertise.t.cpp b/tests/daemon/rib/readvertise/readvertise.t.cpp index 15cc1052..090bd5a1 100644 --- a/tests/daemon/rib/readvertise/readvertise.t.cpp +++ b/tests/daemon/rib/readvertise/readvertise.t.cpp @@ -25,7 +25,9 @@ #include "rib/readvertise/readvertise.hpp" +#include "tests/test-common.hpp" #include "tests/key-chain-fixture.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include @@ -111,7 +113,7 @@ public: std::vector withdrawHistory; }; -class ReadvertiseFixture : public UnitTestTimeFixture, public KeyChainFixture +class ReadvertiseFixture : public GlobalIoTimeFixture, public KeyChainFixture { public: ReadvertiseFixture() diff --git a/tests/daemon/rib/rib-entry.t.cpp b/tests/daemon/rib/rib-entry.t.cpp index a5c9f3c8..70b053a9 100644 --- a/tests/daemon/rib/rib-entry.t.cpp +++ b/tests/daemon/rib/rib-entry.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -24,7 +24,9 @@ */ #include "rib/rib-entry.hpp" + #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" namespace nfd { namespace rib { @@ -32,7 +34,7 @@ namespace tests { using namespace nfd::tests; -BOOST_FIXTURE_TEST_SUITE(TestRibEntry, BaseFixture) +BOOST_FIXTURE_TEST_SUITE(TestRibEntry, GlobalIoFixture) BOOST_AUTO_TEST_CASE(Basic) { @@ -74,7 +76,7 @@ BOOST_AUTO_TEST_CASE(Basic) BOOST_CHECK(entry.findRoute(route2) != entry.getRoutes().end()); } -BOOST_FIXTURE_TEST_SUITE(GetAnnouncement, UnitTestTimeFixture) +BOOST_FIXTURE_TEST_SUITE(GetAnnouncement, GlobalIoTimeFixture) static Route makeSimpleRoute(uint64_t faceId) diff --git a/tests/daemon/rib/rib-update.t.cpp b/tests/daemon/rib/rib-update.t.cpp index 22577f0d..a4feca13 100644 --- a/tests/daemon/rib/rib-update.t.cpp +++ b/tests/daemon/rib/rib-update.t.cpp @@ -27,13 +27,14 @@ #include "rib/rib-update-batch.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include "tests/daemon/rib/create-route.hpp" namespace nfd { namespace rib { namespace tests { -BOOST_FIXTURE_TEST_SUITE(TestRibUpdate, nfd::tests::BaseFixture) +BOOST_FIXTURE_TEST_SUITE(TestRibUpdate, nfd::tests::GlobalIoFixture) BOOST_AUTO_TEST_CASE(BatchBasic) { diff --git a/tests/daemon/rib/rib.t.cpp b/tests/daemon/rib/rib.t.cpp index 26a47b38..a1b83631 100644 --- a/tests/daemon/rib/rib.t.cpp +++ b/tests/daemon/rib/rib.t.cpp @@ -26,13 +26,14 @@ #include "rib/rib.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include "tests/daemon/rib/create-route.hpp" namespace nfd { namespace rib { namespace tests { -BOOST_FIXTURE_TEST_SUITE(TestRib, nfd::tests::BaseFixture) +BOOST_FIXTURE_TEST_SUITE(TestRib, nfd::tests::GlobalIoFixture) BOOST_AUTO_TEST_CASE(Parent) { diff --git a/tests/daemon/rib/route.t.cpp b/tests/daemon/rib/route.t.cpp index b1390b84..b6e0ddbb 100644 --- a/tests/daemon/rib/route.t.cpp +++ b/tests/daemon/rib/route.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -26,6 +26,7 @@ #include "rib/route.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" namespace nfd { namespace rib { @@ -33,9 +34,9 @@ namespace tests { using namespace nfd::tests; -BOOST_FIXTURE_TEST_SUITE(TestRoute, BaseFixture) +BOOST_FIXTURE_TEST_SUITE(TestRoute, GlobalIoTimeFixture) -BOOST_FIXTURE_TEST_SUITE(CreateFromAnnouncement, UnitTestTimeFixture) +BOOST_AUTO_TEST_SUITE(CreateFromAnnouncement) BOOST_AUTO_TEST_CASE(NoValidity) { @@ -124,7 +125,7 @@ BOOST_AUTO_TEST_CASE(Equality) BOOST_CHECK_EQUAL(a, b); } -BOOST_FIXTURE_TEST_CASE(EqualityAnn, UnitTestTimeFixture) +BOOST_AUTO_TEST_CASE(EqualityAnn) { auto ann1 = makePrefixAnn("/ann", 1_h); auto ann2 = makePrefixAnn("/ann", 2_h); @@ -133,7 +134,7 @@ BOOST_FIXTURE_TEST_CASE(EqualityAnn, UnitTestTimeFixture) BOOST_CHECK_NE(Route(ann1, 7001), Route(ann2, 7001)); } -BOOST_FIXTURE_TEST_CASE(Output, UnitTestTimeFixture) +BOOST_AUTO_TEST_CASE(Output) { Route r; BOOST_CHECK_EQUAL(boost::lexical_cast(r), diff --git a/tests/daemon/table/cleanup.t.cpp b/tests/daemon/table/cleanup.t.cpp index c6bd7729..25405a6b 100644 --- a/tests/daemon/table/cleanup.t.cpp +++ b/tests/daemon/table/cleanup.t.cpp @@ -27,15 +27,14 @@ #include "fw/forwarder.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include "tests/daemon/face/dummy-face.hpp" namespace nfd { namespace tests { -using namespace nfd::tests; - BOOST_AUTO_TEST_SUITE(Table) -BOOST_FIXTURE_TEST_SUITE(TestCleanup, BaseFixture) +BOOST_FIXTURE_TEST_SUITE(TestCleanup, GlobalIoFixture) BOOST_AUTO_TEST_SUITE(FaceRemoval) diff --git a/tests/daemon/table/cs-policy-lru.t.cpp b/tests/daemon/table/cs-policy-lru.t.cpp index 74665106..bc28639a 100644 --- a/tests/daemon/table/cs-policy-lru.t.cpp +++ b/tests/daemon/table/cs-policy-lru.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2017, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -27,6 +27,7 @@ #include "table/cs.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" namespace nfd { namespace cs { @@ -43,7 +44,7 @@ BOOST_AUTO_TEST_CASE(Registration) BOOST_CHECK_EQUAL(policyNames.count("lru"), 1); } -BOOST_FIXTURE_TEST_CASE(EvictOne, UnitTestTimeFixture) +BOOST_FIXTURE_TEST_CASE(EvictOne, GlobalIoTimeFixture) { Cs cs(3); cs.setPolicy(make_unique()); diff --git a/tests/daemon/table/cs-policy-priority-fifo.t.cpp b/tests/daemon/table/cs-policy-priority-fifo.t.cpp index b68729a7..cd71b5b2 100644 --- a/tests/daemon/table/cs-policy-priority-fifo.t.cpp +++ b/tests/daemon/table/cs-policy-priority-fifo.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2017, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -27,6 +27,7 @@ #include "table/cs.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" namespace nfd { namespace cs { @@ -43,7 +44,7 @@ BOOST_AUTO_TEST_CASE(Registration) BOOST_CHECK_EQUAL(policyNames.count("priority_fifo"), 1); } -BOOST_FIXTURE_TEST_CASE(EvictOne, UnitTestTimeFixture) +BOOST_FIXTURE_TEST_CASE(EvictOne, GlobalIoTimeFixture) { Cs cs(3); cs.setPolicy(make_unique()); @@ -96,7 +97,7 @@ BOOST_FIXTURE_TEST_CASE(EvictOne, UnitTestTimeFixture) bind([] { BOOST_CHECK(true); })); } -BOOST_FIXTURE_TEST_CASE(Refresh, UnitTestTimeFixture) +BOOST_FIXTURE_TEST_CASE(Refresh, GlobalIoTimeFixture) { Cs cs(3); cs.setPolicy(make_unique()); diff --git a/tests/daemon/table/cs.t.cpp b/tests/daemon/table/cs.t.cpp index a8363de1..bcfd3a58 100644 --- a/tests/daemon/table/cs.t.cpp +++ b/tests/daemon/table/cs.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -26,6 +26,7 @@ #include "table/cs.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" #include @@ -33,18 +34,18 @@ #include #include -#define CHECK_CS_FIND(expected) find([&] (uint32_t found) { BOOST_CHECK_EQUAL(expected, found); }); - namespace nfd { namespace cs { namespace tests { using namespace nfd::tests; -BOOST_AUTO_TEST_SUITE(Table) -BOOST_FIXTURE_TEST_SUITE(TestCs, BaseFixture) +#define CHECK_CS_FIND(expected) find([&] (uint32_t found) { BOOST_CHECK_EQUAL(expected, found); }); -class FindFixture : public UnitTestTimeFixture +BOOST_AUTO_TEST_SUITE(Table) +BOOST_FIXTURE_TEST_SUITE(TestCs, GlobalIoFixture) + +class FindFixture : public GlobalIoTimeFixture { protected: Name diff --git a/tests/daemon/table/dead-nonce-list.t.cpp b/tests/daemon/table/dead-nonce-list.t.cpp index 1df1070f..ea7866c9 100644 --- a/tests/daemon/table/dead-nonce-list.t.cpp +++ b/tests/daemon/table/dead-nonce-list.t.cpp @@ -27,12 +27,13 @@ #include "daemon/global.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" namespace nfd { namespace tests { BOOST_AUTO_TEST_SUITE(Table) -BOOST_FIXTURE_TEST_SUITE(TestDeadNonceList, BaseFixture) +BOOST_FIXTURE_TEST_SUITE(TestDeadNonceList, GlobalIoFixture) BOOST_AUTO_TEST_CASE(Basic) { @@ -58,7 +59,7 @@ BOOST_AUTO_TEST_CASE(MinLifetime) } /// A Fixture that periodically inserts Nonces -class PeriodicalInsertionFixture : public UnitTestTimeFixture +class PeriodicalInsertionFixture : public GlobalIoTimeFixture { protected: PeriodicalInsertionFixture() @@ -108,6 +109,7 @@ protected: time::nanoseconds timeUnit; scheduler::ScopedEventId addNonceEvent; }; + const time::nanoseconds PeriodicalInsertionFixture::LIFETIME = time::milliseconds(200); BOOST_FIXTURE_TEST_CASE(Lifetime, PeriodicalInsertionFixture) diff --git a/tests/daemon/table/fib.t.cpp b/tests/daemon/table/fib.t.cpp index 0a6ccffd..6e83a95e 100644 --- a/tests/daemon/table/fib.t.cpp +++ b/tests/daemon/table/fib.t.cpp @@ -26,9 +26,10 @@ #include "table/fib.hpp" #include "table/pit.hpp" #include "table/measurements.hpp" -#include "tests/daemon/face/dummy-face.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" +#include "tests/daemon/face/dummy-face.hpp" namespace nfd { namespace fib { @@ -37,7 +38,7 @@ namespace tests { using namespace nfd::tests; BOOST_AUTO_TEST_SUITE(Table) -BOOST_FIXTURE_TEST_SUITE(TestFib, BaseFixture) +BOOST_FIXTURE_TEST_SUITE(TestFib, GlobalIoFixture) BOOST_AUTO_TEST_CASE(FibEntry) { diff --git a/tests/daemon/table/measurements-accessor.t.cpp b/tests/daemon/table/measurements-accessor.t.cpp index 86a005ad..aeed38f5 100644 --- a/tests/daemon/table/measurements-accessor.t.cpp +++ b/tests/daemon/table/measurements-accessor.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2016, Regents of the University of California, +/* + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -27,8 +27,9 @@ #include "fw/strategy.hpp" #include "tests/test-common.hpp" -#include "../fw/dummy-strategy.hpp" -#include "../fw/choose-strategy.hpp" +#include "tests/daemon/global-io-fixture.hpp" +#include "tests/daemon/fw/dummy-strategy.hpp" +#include "tests/daemon/fw/choose-strategy.hpp" namespace nfd { namespace measurements { @@ -57,7 +58,7 @@ public: } }; -class MeasurementsAccessorFixture : public BaseFixture +class MeasurementsAccessorFixture : public GlobalIoFixture { protected: MeasurementsAccessorFixture() diff --git a/tests/daemon/table/measurements.t.cpp b/tests/daemon/table/measurements.t.cpp index a7e315de..915a0490 100644 --- a/tests/daemon/table/measurements.t.cpp +++ b/tests/daemon/table/measurements.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2017, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -28,6 +28,7 @@ #include "table/pit.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" namespace nfd { namespace measurements { @@ -37,7 +38,7 @@ using namespace nfd::tests; BOOST_AUTO_TEST_SUITE(Table) -class MeasurementsFixture : public UnitTestTimeFixture +class MeasurementsFixture : public GlobalIoTimeFixture { public: MeasurementsFixture() diff --git a/tests/daemon/table/name-tree.t.cpp b/tests/daemon/table/name-tree.t.cpp index 458d7e3d..4e325bc2 100644 --- a/tests/daemon/table/name-tree.t.cpp +++ b/tests/daemon/table/name-tree.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -26,6 +26,7 @@ #include "table/name-tree.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" namespace nfd { namespace name_tree { @@ -34,7 +35,7 @@ namespace tests { using namespace nfd::tests; BOOST_AUTO_TEST_SUITE(Table) -BOOST_FIXTURE_TEST_SUITE(TestNameTree, BaseFixture) +BOOST_FIXTURE_TEST_SUITE(TestNameTree, GlobalIoFixture) BOOST_AUTO_TEST_CASE(ComputeHash) { @@ -458,7 +459,7 @@ private: std::unordered_set m_names; }; -class EnumerationFixture : public BaseFixture +class EnumerationFixture : public GlobalIoFixture { protected: EnumerationFixture() diff --git a/tests/daemon/table/network-region-table.t.cpp b/tests/daemon/table/network-region-table.t.cpp index 68f1a038..11948bcb 100644 --- a/tests/daemon/table/network-region-table.t.cpp +++ b/tests/daemon/table/network-region-table.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2017, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -26,12 +26,13 @@ #include "table/network-region-table.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" namespace nfd { namespace tests { BOOST_AUTO_TEST_SUITE(Table) -BOOST_FIXTURE_TEST_SUITE(TestNetworkRegionTable, BaseFixture) +BOOST_FIXTURE_TEST_SUITE(TestNetworkRegionTable, GlobalIoFixture) BOOST_AUTO_TEST_CASE(InProducerRegion) { diff --git a/tests/daemon/table/pit-entry.t.cpp b/tests/daemon/table/pit-entry.t.cpp index d4234ad2..a155be20 100644 --- a/tests/daemon/table/pit-entry.t.cpp +++ b/tests/daemon/table/pit-entry.t.cpp @@ -24,9 +24,10 @@ */ #include "table/pit-entry.hpp" -#include "tests/daemon/face/dummy-face.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" +#include "tests/daemon/face/dummy-face.hpp" namespace nfd { namespace pit { @@ -35,7 +36,7 @@ namespace tests { using namespace nfd::tests; BOOST_AUTO_TEST_SUITE(Table) -BOOST_FIXTURE_TEST_SUITE(TestPitEntry, BaseFixture) +BOOST_FIXTURE_TEST_SUITE(TestPitEntry, GlobalIoFixture) BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(CanMatch, 1) BOOST_AUTO_TEST_CASE(CanMatch) diff --git a/tests/daemon/table/pit.t.cpp b/tests/daemon/table/pit.t.cpp index 511f2aa6..7c6d791e 100644 --- a/tests/daemon/table/pit.t.cpp +++ b/tests/daemon/table/pit.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -25,8 +25,9 @@ #include "table/pit.hpp" -#include "tests/daemon/face/dummy-face.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" +#include "tests/daemon/face/dummy-face.hpp" #include @@ -37,7 +38,7 @@ namespace tests { using namespace nfd::tests; BOOST_AUTO_TEST_SUITE(Table) -BOOST_FIXTURE_TEST_SUITE(TestPit, BaseFixture) +BOOST_FIXTURE_TEST_SUITE(TestPit, GlobalIoFixture) BOOST_AUTO_TEST_CASE(Find) { diff --git a/tests/daemon/table/strategy-choice.t.cpp b/tests/daemon/table/strategy-choice.t.cpp index 0173af49..339903e6 100644 --- a/tests/daemon/table/strategy-choice.t.cpp +++ b/tests/daemon/table/strategy-choice.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2017, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -26,14 +26,13 @@ #include "table/strategy-choice.hpp" #include "tests/test-common.hpp" -#include "../fw/dummy-strategy.hpp" +#include "tests/daemon/global-io-fixture.hpp" +#include "tests/daemon/fw/dummy-strategy.hpp" namespace nfd { namespace tests { -using fw::Strategy; - -class StrategyChoiceFixture : public BaseFixture +class StrategyChoiceFixture : public GlobalIoFixture { protected: StrategyChoiceFixture() @@ -66,7 +65,7 @@ protected: bool isStrategyType(const Name& prefix) { - Strategy& effectiveStrategy = sc.findEffectiveStrategy(prefix); + auto& effectiveStrategy = sc.findEffectiveStrategy(prefix); return dynamic_cast(&effectiveStrategy) != nullptr; } diff --git a/tests/daemon/table/strategy-info-host.t.cpp b/tests/daemon/table/strategy-info-host.t.cpp index 0a3dc2ad..2a3a33e0 100644 --- a/tests/daemon/table/strategy-info-host.t.cpp +++ b/tests/daemon/table/strategy-info-host.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2016, Regents of the University of California, +/* + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -26,6 +26,7 @@ #include "table/strategy-info-host.hpp" #include "tests/test-common.hpp" +#include "tests/daemon/global-io-fixture.hpp" namespace nfd { namespace tests { @@ -78,7 +79,7 @@ public: }; BOOST_AUTO_TEST_SUITE(Table) -BOOST_FIXTURE_TEST_SUITE(TestStrategyInfoHost, BaseFixture) +BOOST_FIXTURE_TEST_SUITE(TestStrategyInfoHost, GlobalIoFixture) BOOST_AUTO_TEST_CASE(Basic) { diff --git a/tests/key-chain-fixture.hpp b/tests/key-chain-fixture.hpp index 810dab86..18ba4fca 100644 --- a/tests/key-chain-fixture.hpp +++ b/tests/key-chain-fixture.hpp @@ -26,7 +26,7 @@ #ifndef NFD_TESTS_KEY_CHAIN_FIXTURE_HPP #define NFD_TESTS_KEY_CHAIN_FIXTURE_HPP -#include "tests/test-common.hpp" +#include "core/common.hpp" #include diff --git a/tests/other/wscript b/tests/other/wscript index da57688f..3393a158 100644 --- a/tests/other/wscript +++ b/tests/other/wscript @@ -37,7 +37,7 @@ def build(bld): bld.program(name=module, target='../../%s' % module, source=bld.path.ant_glob('%s*.cpp' % module), - use='daemon-objects unit-tests-base other-tests-%s-main' % module, + use='daemon-objects tests-common other-tests-%s-main' % module, defines=['UNIT_TEST_CONFIG_PATH="%s"' % bld.bldnode.make_node('tmp-files')], install_path=None) diff --git a/tests/test-common.cpp b/tests/test-common.cpp index 236007eb..534d961e 100644 --- a/tests/test-common.cpp +++ b/tests/test-common.cpp @@ -24,23 +24,12 @@ */ #include "tests/test-common.hpp" -#include "daemon/global.hpp" #include namespace nfd { namespace tests { -BaseFixture::BaseFixture() - : g_io(getGlobalIoService()) -{ -} - -BaseFixture::~BaseFixture() -{ - resetGlobalIoService(); -} - shared_ptr makeInterest(const Name& name, uint32_t nonce) { diff --git a/tests/test-common.hpp b/tests/test-common.hpp index 775c0326..63b1a99f 100644 --- a/tests/test-common.hpp +++ b/tests/test-common.hpp @@ -26,9 +26,8 @@ #ifndef NFD_TESTS_TEST_COMMON_HPP #define NFD_TESTS_TEST_COMMON_HPP -#include "boost-test.hpp" - -#include "tests/clock-fixture.hpp" +#include "core/common.hpp" +#include "tests/boost-test.hpp" #include @@ -48,36 +47,6 @@ namespace nfd { namespace tests { -/** \brief base test fixture - * - * Every test case should be based on this fixture, - * to have per test case io_service initialization. - */ -class BaseFixture -{ -protected: - BaseFixture(); - - virtual - ~BaseFixture(); - -protected: - /** \brief reference to global io_service - */ - boost::asio::io_service& g_io; -}; - -/** \brief a base test fixture that overrides steady clock and system clock - */ -class UnitTestTimeFixture : public virtual BaseFixture, public ClockFixture -{ -protected: - UnitTestTimeFixture() - : ClockFixture(g_io) - { - } -}; - /** \brief create an Interest * \param name Interest name * \param nonce if non-zero, set Nonce to this value diff --git a/tests/tools/ndn-autoconfig-server/program.t.cpp b/tests/tools/ndn-autoconfig-server/program.t.cpp index b8209b02..4e78bef7 100644 --- a/tests/tools/ndn-autoconfig-server/program.t.cpp +++ b/tests/tools/ndn-autoconfig-server/program.t.cpp @@ -25,6 +25,7 @@ #include "ndn-autoconfig-server/program.hpp" +#include "tests/test-common.hpp" #include "tests/key-chain-fixture.hpp" #include diff --git a/tests/tools/ndn-autoconfig/multicast-discovery.t.cpp b/tests/tools/ndn-autoconfig/multicast-discovery.t.cpp index 8905d580..0e08a36d 100644 --- a/tests/tools/ndn-autoconfig/multicast-discovery.t.cpp +++ b/tests/tools/ndn-autoconfig/multicast-discovery.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2017, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -25,7 +25,8 @@ #include "ndn-autoconfig/multicast-discovery.hpp" -#include "../mock-nfd-mgmt-fixture.hpp" +#include "tests/tools/mock-nfd-mgmt-fixture.hpp" + #include #include diff --git a/tests/tools/ndn-autoconfig/procedure.t.cpp b/tests/tools/ndn-autoconfig/procedure.t.cpp index ec7cf319..760f8b07 100644 --- a/tests/tools/ndn-autoconfig/procedure.t.cpp +++ b/tests/tools/ndn-autoconfig/procedure.t.cpp @@ -25,7 +25,7 @@ #include "ndn-autoconfig/procedure.hpp" -#include "../mock-nfd-mgmt-fixture.hpp" +#include "tests/tools/mock-nfd-mgmt-fixture.hpp" #include diff --git a/tests/tools/nfdc/command-definition.t.cpp b/tests/tools/nfdc/command-definition.t.cpp index 374e36de..777a5540 100644 --- a/tests/tools/nfdc/command-definition.t.cpp +++ b/tests/tools/nfdc/command-definition.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -32,10 +32,8 @@ namespace tools { namespace nfdc { namespace tests { -using namespace nfd::tests; - BOOST_AUTO_TEST_SUITE(Nfdc) -BOOST_FIXTURE_TEST_SUITE(TestCommandDefinition, BaseFixture) +BOOST_AUTO_TEST_SUITE(TestCommandDefinition) BOOST_AUTO_TEST_SUITE(Arguments) diff --git a/tests/tools/nfdc/command-parser.t.cpp b/tests/tools/nfdc/command-parser.t.cpp index 3eef29dc..26c97fb8 100644 --- a/tests/tools/nfdc/command-parser.t.cpp +++ b/tests/tools/nfdc/command-parser.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -32,10 +32,8 @@ namespace tools { namespace nfdc { namespace tests { -using namespace nfd::tests; - BOOST_AUTO_TEST_SUITE(Nfdc) -BOOST_FIXTURE_TEST_SUITE(TestCommandParser, BaseFixture) +BOOST_AUTO_TEST_SUITE(TestCommandParser) BOOST_AUTO_TEST_CASE(PrintAvailableIn) { diff --git a/tests/tools/nfdc/help.t.cpp b/tests/tools/nfdc/help.t.cpp index ab530042..8d4a65d0 100644 --- a/tests/tools/nfdc/help.t.cpp +++ b/tests/tools/nfdc/help.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -32,10 +32,8 @@ namespace tools { namespace nfdc { namespace tests { -using namespace nfd::tests; - BOOST_AUTO_TEST_SUITE(Nfdc) -BOOST_FIXTURE_TEST_SUITE(TestHelp, BaseFixture) +BOOST_AUTO_TEST_SUITE(TestHelp) BOOST_AUTO_TEST_CASE(Basic) { diff --git a/tests/tools/nfdc/mock-nfd-mgmt-fixture.hpp b/tests/tools/nfdc/mock-nfd-mgmt-fixture.hpp index 9841de83..5242c9b9 100644 --- a/tests/tools/nfdc/mock-nfd-mgmt-fixture.hpp +++ b/tests/tools/nfdc/mock-nfd-mgmt-fixture.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2017, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -26,7 +26,7 @@ #ifndef NFD_TESTS_TOOLS_NFDC_MOCK_NFD_MGMT_FIXTURE_HPP #define NFD_TESTS_TOOLS_NFDC_MOCK_NFD_MGMT_FIXTURE_HPP -#include "../mock-nfd-mgmt-fixture.hpp" +#include "tests/tools/mock-nfd-mgmt-fixture.hpp" namespace nfd { namespace tools { diff --git a/tests/wscript b/tests/wscript index 9c17ad36..ef008706 100644 --- a/tests/wscript +++ b/tests/wscript @@ -32,7 +32,7 @@ def build(bld): # common test objects bld.objects( - target='unit-tests-base', + target='tests-common', features='pch', source=bld.path.ant_glob('*.cpp', excl='main.cpp'), use='core-objects', @@ -62,17 +62,17 @@ def build(bld): src += node.ant_glob('face/unix*.cpp') if bld.env.HAVE_WEBSOCKET: src += node.ant_glob('face/websocket*.cpp') - if module == 'core' or module == 'tools': - src += ['../daemon/global.cpp'] if module == 'rib': - src += ['daemon/limited-io.cpp', 'daemon/rib-io-fixture.cpp'] + src += ['daemon/global-io-fixture.cpp', + 'daemon/limited-io.cpp', + 'daemon/rib-io-fixture.cpp'] objmod = 'daemon' if module == 'rib' else module # unit-tests binary for the module bld.program(name='unit-tests-%s' % module, target='../unit-tests-%s' % module, source=src, - use='%s-objects unit-tests-base unit-tests-%s-main' % (objmod, module), + use='%s-objects tests-common unit-tests-%s-main' % (objmod, module), defines=[config_path], install_path=None)