tests: sync common testing infrastructure with ndn-cxx
Upgrade waf to version 2.0.21
Change-Id: I30615cc49416088e9c5e4d602fd11360c0ed9328
diff --git a/tests/unit/daemon/db-mgr.cpp b/tests/unit/daemon/db-mgr.t.cpp
similarity index 96%
rename from tests/unit/daemon/db-mgr.cpp
rename to tests/unit/daemon/db-mgr.t.cpp
index ffa38b8..0b69330 100644
--- a/tests/unit/daemon/db-mgr.cpp
+++ b/tests/unit/daemon/db-mgr.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-2020, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -18,9 +18,12 @@
*/
#include "daemon/db-mgr.hpp"
-#include "test-common.hpp"
+#include "logger.hpp"
+
+#include "boost-test.hpp"
#include <algorithm>
+#include <boost/filesystem.hpp>
namespace ndn {
namespace ndns {
@@ -30,7 +33,7 @@
BOOST_AUTO_TEST_SUITE(DbMgr)
-static const boost::filesystem::path TEST_DATABASE2 = TEST_CONFIG_PATH "/" "test-ndns.db";
+const auto TEST_DATABASE2 = boost::filesystem::path(UNIT_TESTS_TMPDIR) / "test-ndns.db";
class DbMgrFixture
{
@@ -43,16 +46,14 @@
~DbMgrFixture()
{
session.close();
- boost::filesystem::remove(TEST_DATABASE2);
NDNS_LOG_INFO("remove database " << TEST_DATABASE2);
+ boost::filesystem::remove(TEST_DATABASE2);
}
public:
ndns::DbMgr session;
};
-
-
BOOST_FIXTURE_TEST_CASE(Zones, DbMgrFixture)
{
Zone zone1;
diff --git a/tests/unit/daemon/name-server.cpp b/tests/unit/daemon/name-server.t.cpp
similarity index 98%
rename from tests/unit/daemon/name-server.cpp
rename to tests/unit/daemon/name-server.t.cpp
index cf31a8f..4ad5a11 100644
--- a/tests/unit/daemon/name-server.cpp
+++ b/tests/unit/daemon/name-server.t.cpp
@@ -18,13 +18,16 @@
*/
#include "daemon/name-server.hpp"
-#include "daemon/db-mgr.hpp"
-#include "clients/response.hpp"
-#include "clients/query.hpp"
-#include "test-common.hpp"
+#include "clients/query.hpp"
+#include "clients/response.hpp"
+#include "daemon/db-mgr.hpp"
+#include "logger.hpp"
+
+#include "boost-test.hpp"
#include "unit/database-test-data.hpp"
+#include <ndn-cxx/util/dummy-client-face.hpp>
#include <ndn-cxx/util/regex.hpp>
namespace ndn {
diff --git a/tests/unit/daemon/rrset-factory.cpp b/tests/unit/daemon/rrset-factory.t.cpp
similarity index 89%
rename from tests/unit/daemon/rrset-factory.cpp
rename to tests/unit/daemon/rrset-factory.t.cpp
index 39c9286..6f2eb69 100644
--- a/tests/unit/daemon/rrset-factory.cpp
+++ b/tests/unit/daemon/rrset-factory.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-2020, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -18,11 +18,13 @@
*/
#include "daemon/rrset-factory.hpp"
-
-#include "test-common.hpp"
#include "mgmt/management-tool.hpp"
+#include "boost-test.hpp"
+#include "key-chain-fixture.hpp"
+
#include <boost/lexical_cast.hpp>
+
#include <ndn-cxx/security/verification-helpers.hpp>
namespace ndn {
@@ -31,15 +33,16 @@
NDNS_LOG_INIT(RrsetFactoryTest);
-class RrsetFactoryFixture : public IdentityManagementFixture
+const auto TEST_DATABASE2 = boost::filesystem::path(UNIT_TESTS_TMPDIR) / "test-ndns.db";
+const auto TEST_CERT = boost::filesystem::path(UNIT_TESTS_TMPDIR) / "anchors" / "root.cert";
+
+class RrsetFactoryFixture : public KeyChainFixture
{
public:
RrsetFactoryFixture()
- : TEST_DATABASE2(TEST_CONFIG_PATH "/" "test-ndns.db"),
- TEST_IDENTITY_NAME("/rrest/factory"),
- TEST_CERT(TEST_CONFIG_PATH "/" "anchors/root.cert"),
- m_session(TEST_DATABASE2.string()),
- m_zoneName(TEST_IDENTITY_NAME)
+ : TEST_IDENTITY_NAME("/rrest/factory")
+ , m_session(TEST_DATABASE2.string())
+ , m_zoneName(TEST_IDENTITY_NAME)
{
Zone zone1;
zone1.setName(m_zoneName);
@@ -48,12 +51,12 @@
Name identityName = Name(TEST_IDENTITY_NAME).append("NDNS");
- m_identity = this->addIdentity(identityName);
+ m_identity = m_keyChain.createIdentity(identityName);
m_cert = m_identity.getDefaultKey().getDefaultCertificate();
m_certName = m_cert.getName();
- saveIdentityCertificate(m_identity, TEST_CERT.string());
+ saveIdentityCert(m_identity, TEST_CERT.string());
- NDNS_LOG_INFO("save test root cert " << m_certName << " to: " << TEST_CERT.string());
+ NDNS_LOG_INFO("save test root cert " << m_certName << " to: " << TEST_CERT);
BOOST_CHECK_GT(m_certName.size(), 0);
NDNS_LOG_TRACE("test certName: " << m_certName);
}
@@ -61,15 +64,13 @@
~RrsetFactoryFixture()
{
m_session.close();
- boost::filesystem::remove(TEST_DATABASE2);
NDNS_LOG_INFO("remove database " << TEST_DATABASE2);
+ boost::filesystem::remove(TEST_DATABASE2);
boost::filesystem::remove(TEST_CERT);
}
public:
- const boost::filesystem::path TEST_DATABASE2;
const Name TEST_IDENTITY_NAME;
- const boost::filesystem::path TEST_CERT;
ndns::DbMgr m_session;
Name m_zoneName;
Name m_certName;
diff --git a/tests/unit/daemon/rrset.cpp b/tests/unit/daemon/rrset.t.cpp
similarity index 99%
rename from tests/unit/daemon/rrset.cpp
rename to tests/unit/daemon/rrset.t.cpp
index f9e2704..eb9f035 100644
--- a/tests/unit/daemon/rrset.cpp
+++ b/tests/unit/daemon/rrset.t.cpp
@@ -19,7 +19,7 @@
#include "daemon/rrset.hpp"
-#include "test-common.hpp"
+#include "boost-test.hpp"
#if BOOST_VERSION >= 105900
#include <boost/test/tools/output_test_stream.hpp>
diff --git a/tests/unit/daemon/zone.cpp b/tests/unit/daemon/zone.t.cpp
similarity index 98%
rename from tests/unit/daemon/zone.cpp
rename to tests/unit/daemon/zone.t.cpp
index 09bc781..ed57285 100644
--- a/tests/unit/daemon/zone.cpp
+++ b/tests/unit/daemon/zone.t.cpp
@@ -19,7 +19,7 @@
#include "daemon/zone.hpp"
-#include "test-common.hpp"
+#include "boost-test.hpp"
#if BOOST_VERSION >= 105900
#include <boost/test/tools/output_test_stream.hpp>