tests: remove reliance of other tests on WITH_TESTS
refs #3609
Change-Id: I8fa858d207cd060cfcda7c86af56dac4afb48fe1
diff --git a/.jenkins.d/10-build.sh b/.jenkins.d/10-build.sh
index c4dc88d..255c7dd 100755
--- a/.jenkins.d/10-build.sh
+++ b/.jenkins.d/10-build.sh
@@ -21,8 +21,8 @@
# Cleanup
sudo env "PATH=$PATH" ./waf --color=yes distclean
- # Configure/build in optimized mode without tests
- ./waf --color=yes configure
+ # Configure/build in optimized mode without tests, but with "other tests"
+ ./waf --color=yes configure --with-other-tests
./waf --color=yes build -j${WAF_JOBS:-1}
# Cleanup
diff --git a/tests/other/benchmark-helpers.hpp b/tests/other/benchmark-helpers.hpp
new file mode 100644
index 0000000..6dc7cf4
--- /dev/null
+++ b/tests/other/benchmark-helpers.hpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2014-2017, 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NFD_TESTS_OTHER_BENCHMARK_HELPERS_HPP
+#define NFD_TESTS_OTHER_BENCHMARK_HELPERS_HPP
+
+// suppress warnings from Boost.Test
+#pragma GCC system_header
+#pragma clang system_header
+
+#include <boost/test/unit_test.hpp>
+#include <boost/test/output_test_stream.hpp>
+
+#endif // NFD_TESTS_OTHER_BENCHMARK_HELPERS_HPP
diff --git a/tests/other/cs-benchmark.cpp b/tests/other/cs-benchmark.cpp
index c28921b..e9226ef 100644
--- a/tests/other/cs-benchmark.cpp
+++ b/tests/other/cs-benchmark.cpp
@@ -23,8 +23,10 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "benchmark-helpers.hpp"
#include "table/cs.hpp"
-#include "tests/test-common.hpp"
+
+#include <ndn-cxx/security/signature-sha256-with-rsa.hpp>
#include <iostream>
@@ -35,7 +37,7 @@
namespace nfd {
namespace tests {
-class CsBenchmarkFixture : public BaseFixture
+class CsBenchmarkFixture
{
protected:
CsBenchmarkFixture()
@@ -65,6 +67,17 @@
return time::duration_cast<time::microseconds>(t2 - t1);
}
+ static shared_ptr<Data>
+ makeData(const Name& name)
+ {
+ auto data = make_shared<Data>(name);
+ ndn::SignatureSha256WithRsa fakeSignature;
+ fakeSignature.setValue(ndn::encoding::makeEmptyBlock(tlv::SignatureValue));
+ data->setSignature(fakeSignature);
+ data->wireEncode();
+ return data;
+ }
+
void
find(const Interest& interest)
{
@@ -102,7 +115,7 @@
std::vector<shared_ptr<Interest>> workload(count);
for (size_t i = 0; i < count; ++i) {
Name name = genName(i);
- workload[i] = makeInterest(name);
+ workload[i] = make_shared<Interest>(name);
}
return workload;
}
diff --git a/tests/other/pit-fib-benchmark.cpp b/tests/other/pit-fib-benchmark.cpp
index d027c92..58c49ed 100644
--- a/tests/other/pit-fib-benchmark.cpp
+++ b/tests/other/pit-fib-benchmark.cpp
@@ -23,9 +23,9 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "benchmark-helpers.hpp"
#include "table/fib.hpp"
#include "table/pit.hpp"
-#include "tests/test-common.hpp"
#include <iostream>
@@ -36,7 +36,7 @@
namespace nfd {
namespace tests {
-class PitFibBenchmarkFixture : public BaseFixture
+class PitFibBenchmarkFixture
{
protected:
PitFibBenchmarkFixture()
diff --git a/wscript b/wscript
index ffa6052..d310abd 100644
--- a/wscript
+++ b/wscript
@@ -109,14 +109,17 @@
conf.check_cxx(header_name='valgrind/valgrind.h', define_name='HAVE_VALGRIND', mandatory=False)
- boost_libs = 'system chrono program_options thread log log_setup'
if conf.options.with_tests:
conf.env['WITH_TESTS'] = 1
conf.define('WITH_TESTS', 1)
- boost_libs += ' unit_test_framework'
if conf.options.with_other_tests:
conf.env['WITH_OTHER_TESTS'] = 1
+ conf.define('WITH_OTHER_TESTS', 1)
+
+ boost_libs = 'system chrono program_options thread log log_setup'
+ if conf.options.with_tests or conf.options.with_other_tests:
+ boost_libs += ' unit_test_framework'
conf.check_boost(lib=boost_libs, mt=True)
if conf.env.BOOST_VERSION_NUMBER < 105400: