build: rename HAVE_TESTS to WITH_TESTS
And rename a few waf targets for clarity and consistency
Change-Id: I7efad48a4edcbc311dba7981791249a4e0cc5678
diff --git a/ndn-cxx/detail/common.hpp b/ndn-cxx/detail/common.hpp
index abc6bf0..9655d3b 100644
--- a/ndn-cxx/detail/common.hpp
+++ b/ndn-cxx/detail/common.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2023 Regents of the University of California.
+ * Copyright (c) 2013-2024 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,10 +19,11 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-/** \file
- * \brief Common includes and macros used throughout the library.
- * \warning This file is an implementation detail of the ndn-cxx library.
- * Aliases imported in this file MUST NOT be used outside of ndn-cxx.
+/**
+ * \file
+ * \brief Common includes and macros used throughout the library.
+ * \warning This file is an implementation detail of the ndn-cxx library.
+ * Aliases imported in this file MUST NOT be used outside of ndn-cxx.
*/
#ifndef NDN_CXX_DETAIL_COMMON_HPP
@@ -37,7 +38,7 @@
// ndn-cxx specific macros declared in this and other headers must have NDN_CXX_ prefix
// to avoid conflicts with other projects that include ndn-cxx headers.
-#ifdef NDN_CXX_HAVE_TESTS
+#ifdef NDN_CXX_WITH_TESTS
#define NDN_CXX_VIRTUAL_WITH_TESTS virtual
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED public
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE public
diff --git a/ndn-cxx/security/key-chain.cpp b/ndn-cxx/security/key-chain.cpp
index 5c23d0d..f2bedc3 100644
--- a/ndn-cxx/security/key-chain.cpp
+++ b/ndn-cxx/security/key-chain.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2023 Regents of the University of California.
+ * Copyright (c) 2013-2024 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -547,7 +547,7 @@
return s_defaultTpmLocator;
}
-#ifdef NDN_CXX_HAVE_TESTS
+#ifdef NDN_CXX_WITH_TESTS
void
KeyChain::resetDefaultLocators()
{
diff --git a/ndn-cxx/security/key-chain.hpp b/ndn-cxx/security/key-chain.hpp
index 93787be..1a8111a 100644
--- a/ndn-cxx/security/key-chain.hpp
+++ b/ndn-cxx/security/key-chain.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2023 Regents of the University of California.
+ * Copyright (c) 2013-2024 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -452,7 +452,7 @@
static const Locator&
getDefaultTpmLocator();
-#ifdef NDN_CXX_HAVE_TESTS
+#ifdef NDN_CXX_WITH_TESTS
static void
resetDefaultLocators();
#endif
diff --git a/ndn-cxx/security/pib/impl/pib-sqlite3.cpp b/ndn-cxx/security/pib/impl/pib-sqlite3.cpp
index 938eada..c910d1b 100644
--- a/ndn-cxx/security/pib/impl/pib-sqlite3.cpp
+++ b/ndn-cxx/security/pib/impl/pib-sqlite3.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2023 Regents of the University of California.
+ * Copyright (c) 2013-2024 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -193,11 +193,11 @@
if (!location.empty()) {
dbDir = boost::filesystem::path(location);
}
-#ifdef NDN_CXX_HAVE_TESTS
+#ifdef NDN_CXX_WITH_TESTS
else if (getenv("TEST_HOME") != nullptr) {
dbDir = boost::filesystem::path(getenv("TEST_HOME")) / ".ndn";
}
-#endif // NDN_CXX_HAVE_TESTS
+#endif
else if (getenv("HOME") != nullptr) {
dbDir = boost::filesystem::path(getenv("HOME")) / ".ndn";
}
diff --git a/ndn-cxx/security/tpm/impl/back-end-file.cpp b/ndn-cxx/security/tpm/impl/back-end-file.cpp
index fd4c3a7..1666296 100644
--- a/ndn-cxx/security/tpm/impl/back-end-file.cpp
+++ b/ndn-cxx/security/tpm/impl/back-end-file.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2023 Regents of the University of California.
+ * Copyright (c) 2013-2024 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -54,11 +54,11 @@
if (!dir.empty()) {
m_keystorePath = fs::path(dir);
}
-#ifdef NDN_CXX_HAVE_TESTS
+#ifdef NDN_CXX_WITH_TESTS
else if (std::getenv("TEST_HOME") != nullptr) {
m_keystorePath = fs::path(std::getenv("TEST_HOME")) / ".ndn";
}
-#endif // NDN_CXX_HAVE_TESTS
+#endif
else if (std::getenv("HOME") != nullptr) {
m_keystorePath = fs::path(std::getenv("HOME")) / ".ndn";
}
diff --git a/ndn-cxx/util/config-file.cpp b/ndn-cxx/util/config-file.cpp
index 14d852b..53afb05 100644
--- a/ndn-cxx/util/config-file.cpp
+++ b/ndn-cxx/util/config-file.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2024 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -45,7 +45,7 @@
{
using namespace boost::filesystem;
-#ifdef NDN_CXX_HAVE_TESTS
+#ifdef NDN_CXX_WITH_TESTS
if (std::getenv("TEST_HOME")) {
path testHome(std::getenv("TEST_HOME"));
testHome /= ".ndn/client.conf";
@@ -53,7 +53,7 @@
return absolute(testHome);
}
}
-#endif // NDN_CXX_HAVE_TESTS
+#endif
if (std::getenv("HOME")) {
path home(std::getenv("HOME"));
@@ -69,7 +69,7 @@
if (exists(sysconfdir)) {
return absolute(sysconfdir);
}
-#endif // NDN_CXX_SYSCONFDIR
+#endif
path etc("/etc/ndn/client.conf");
if (exists(etc)) {
diff --git a/ndn-cxx/util/logging.cpp b/ndn-cxx/util/logging.cpp
index 0dbdf81..ca44117 100644
--- a/ndn-cxx/util/logging.cpp
+++ b/ndn-cxx/util/logging.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2023 Regents of the University of California.
+ * Copyright (c) 2013-2024 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -165,7 +165,7 @@
return it != m_enabledLevel.end() ? it->second : INITIAL_DEFAULT_LEVEL;
}
-#ifdef NDN_CXX_HAVE_TESTS
+#ifdef NDN_CXX_WITH_TESTS
bool
Logging::removeLogger(Logger& logger)
{
@@ -179,7 +179,7 @@
}
return false;
}
-#endif // NDN_CXX_HAVE_TESTS
+#endif // NDN_CXX_WITH_TESTS
void
Logging::setLevelImpl(const std::string& prefix, LogLevel level)
@@ -236,14 +236,14 @@
}
}
-#ifdef NDN_CXX_HAVE_TESTS
+#ifdef NDN_CXX_WITH_TESTS
void
Logging::resetLevels()
{
this->setLevelImpl("*", INITIAL_DEFAULT_LEVEL);
m_enabledLevel.clear();
}
-#endif // NDN_CXX_HAVE_TESTS
+#endif // NDN_CXX_WITH_TESTS
void
Logging::setDestination(std::ostream& os, bool wantAutoFlush)
@@ -305,7 +305,7 @@
}
}
-#ifdef NDN_CXX_HAVE_TESTS
+#ifdef NDN_CXX_WITH_TESTS
boost::shared_ptr<boost::log::sinks::sink>
Logging::getDestination() const
{
@@ -326,7 +326,7 @@
{
return m_enabledLevel;
}
-#endif // NDN_CXX_HAVE_TESTS
+#endif // NDN_CXX_WITH_TESTS
void
Logging::flushImpl()
diff --git a/ndn-cxx/util/logging.hpp b/ndn-cxx/util/logging.hpp
index 169096a..48928f6 100644
--- a/ndn-cxx/util/logging.hpp
+++ b/ndn-cxx/util/logging.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2023 Regents of the University of California.
+ * Copyright (c) 2013-2024 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -163,7 +163,7 @@
static Logging&
get();
-#ifdef NDN_CXX_HAVE_TESTS
+#ifdef NDN_CXX_WITH_TESTS
bool
removeLogger(Logger& logger);
@@ -178,7 +178,7 @@
const std::unordered_map<std::string, LogLevel>&
getLevels() const;
-#endif // NDN_CXX_HAVE_TESTS
+#endif // NDN_CXX_WITH_TESTS
private:
friend Logger;
diff --git a/tests/benchmarks/encoding-bench.cpp b/tests/benchmarks/encoding.cpp
similarity index 100%
rename from tests/benchmarks/encoding-bench.cpp
rename to tests/benchmarks/encoding.cpp
diff --git a/tests/benchmarks/scheduler-bench.cpp b/tests/benchmarks/scheduler.cpp
similarity index 100%
rename from tests/benchmarks/scheduler-bench.cpp
rename to tests/benchmarks/scheduler.cpp
diff --git a/tests/benchmarks/wscript b/tests/benchmarks/wscript
index 3c1e532..87a3f53 100644
--- a/tests/benchmarks/wscript
+++ b/tests/benchmarks/wscript
@@ -3,10 +3,11 @@
top = '../..'
def build(bld):
- for test in bld.path.ant_glob('*.cpp'):
- name = test.change_ext('').path_from(bld.path.get_bld())
- bld.program(name=f'test-{name}',
- target=name,
- source=[test],
- use='BOOST_TESTS ndn-cxx',
- install_path=None)
+ for file in bld.path.ant_glob('*.cpp'):
+ name = file.change_ext('').path_from(bld.path.get_bld())
+ bld.program(
+ name=f'bench-{name}',
+ target=name,
+ source=[file],
+ use='BOOST_TESTS ndn-cxx',
+ install_path=None)
diff --git a/tests/integration/wscript b/tests/integration/wscript
index 02ca4f0..a38c111 100644
--- a/tests/integration/wscript
+++ b/tests/integration/wscript
@@ -3,10 +3,11 @@
top = '../..'
def build(bld):
- for test in bld.path.ant_glob('*.cpp'):
- name = test.change_ext('').path_from(bld.path.get_bld())
- bld.program(name=f'test-{name}',
- target=name,
- source=[test],
- use='tests-common',
- install_path=None)
+ for file in bld.path.ant_glob('*.cpp'):
+ name = file.change_ext('').path_from(bld.path.get_bld())
+ bld.program(
+ name=f'integ-test-{name}',
+ target=name,
+ source=[file],
+ use='tests-common',
+ install_path=None)
diff --git a/tools/ndnsec/wscript b/tools/ndnsec/wscript
index 1b1f40b..5fc7dbd 100644
--- a/tools/ndnsec/wscript
+++ b/tools/ndnsec/wscript
@@ -3,7 +3,7 @@
top = '../..'
def build(bld):
- bld.objects(target='tools-ndnsec-objects',
+ bld.objects(target='ndnsec-objects',
source=bld.path.ant_glob('*.cpp', excl=['main.cpp']),
features='pch',
headers='ndnsec-pch.hpp',
@@ -12,7 +12,7 @@
bld.program(name='ndnsec',
target=f'{top}/bin/ndnsec',
source=['main.cpp'],
- use='tools-ndnsec-objects')
+ use='ndnsec-objects')
# create convenience symlinks
for cmd in ('list', 'get-default', 'set-default', 'delete',
diff --git a/tools/wscript b/tools/wscript
index 93cabd7..4e89967 100644
--- a/tools/wscript
+++ b/tools/wscript
@@ -16,7 +16,7 @@
# Sub-directory tools:
# tools/foo/**/*.cpp are compiled and linked into build/bin/foo.
# tools/foo/main.cpp must exist and must contain the main() function.
- # All other objects are collected into 'tools-foo-objects' and can be unit-tested.
+ # All other objects are collected into 'foo-objects' and can be unit-tested.
for subdir in bld.path.ant_glob('*', dir=True, src=False):
name = subdir.path_from(bld.path)
subWscript = subdir.find_node('wscript')
@@ -33,7 +33,7 @@
srcFiles = subdir.ant_glob('**/*.cpp', excl=['main.cpp'])
srcObjects = ''
if srcFiles:
- srcObjects = f'tools-{name}-objects'
+ srcObjects = f'{name}-objects'
bld.objects(target=srcObjects,
source=srcFiles,
use='ndn-cxx')
diff --git a/wscript b/wscript
index 2d75f2d..0e35b2c 100644
--- a/wscript
+++ b/wscript
@@ -142,7 +142,7 @@
conf.check_boost(lib=boost_libs, mt=True)
- if any((conf.env.WITH_BENCHMARKS, conf.env.WITH_INTEGRATION_TESTS, conf.env.WITH_UNIT_TESTS)):
+ if conf.env.WITH_BENCHMARKS or conf.env.WITH_INTEGRATION_TESTS or conf.env.WITH_UNIT_TESTS:
conf.check_boost(lib='unit_test_framework', mt=True, uselib_store='BOOST_TESTS')
if conf.env.WITH_TOOLS:
@@ -161,7 +161,7 @@
conf.env.prepend_value('STLIBPATH', ['.'])
conf.define_cond('HAVE_STACKTRACE', conf.env.HAVE_STACKTRACE)
- conf.define_cond('HAVE_TESTS', conf.env.WITH_INTEGRATION_TESTS or conf.env.WITH_UNIT_TESTS)
+ conf.define_cond('WITH_TESTS', conf.env.WITH_INTEGRATION_TESTS or conf.env.WITH_UNIT_TESTS)
conf.define_cond('WITH_OSX_KEYCHAIN', conf.env.HAVE_OSX_FRAMEWORKS and conf.options.with_osx_keychain)
conf.define_cond('DISABLE_SQLITE3_FS_LOCKING', not conf.options.with_sqlite_locking)
conf.define('SYSCONFDIR', conf.env.SYSCONFDIR)