build: various updates
* Upgrade waf to 2.0.14
* Sync default compiler flags with ndn-cxx
* Simplify compilation of unit-tests
Change-Id: I94865d405240c181dd4cfdd1cb730b756ad5166a
diff --git a/tests/boost-test.hpp b/tests/boost-test.hpp
index 7756923..cbf897d 100644
--- a/tests/boost-test.hpp
+++ b/tests/boost-test.hpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2014 University of California, Los Angeles
+ * Copyright (c) 2012-2019 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -24,8 +24,7 @@
#pragma GCC system_header
#pragma clang system_header
+#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
-#include <boost/concept_check.hpp>
-#include <boost/test/output_test_stream.hpp>
#endif // CHRONOSYNC_TESTS_BOOST_TEST_HPP
diff --git a/tests/main.cpp b/tests/main.cpp
index b37eb19..70d0433 100644
--- a/tests/main.cpp
+++ b/tests/main.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,19 +24,18 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#define BOOST_TEST_DYN_LINK
-#define BOOST_TEST_ALTERNATIVE_INIT_API
+#define BOOST_TEST_MODULE ChronoSync
#include <boost/version.hpp>
#if BOOST_VERSION >= 106200
// Boost.Test v3.3 (Boost 1.62) natively supports multi-logger output
-#include "boost-test.hpp"
+#include "tests/boost-test.hpp"
#else
+#define BOOST_TEST_ALTERNATIVE_INIT_API
#define BOOST_TEST_NO_MAIN
-#include "boost-test.hpp"
-
-#include "boost-multi-log-formatter.hpp"
+#include "tests/boost-test.hpp"
+#include "tests/boost-multi-log-formatter.hpp"
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/variables_map.hpp>
diff --git a/tests/unit-tests/bzip2-helper.t.cpp b/tests/unit-tests/bzip2-helper.t.cpp
index 330f66b..93cc8e5 100644
--- a/tests/unit-tests/bzip2-helper.t.cpp
+++ b/tests/unit-tests/bzip2-helper.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2018 University of California, Los Angeles
+ * Copyright (c) 2012-2019 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -19,13 +19,11 @@
#include "bzip2-helper.hpp"
-#include "boost-test.hpp"
+#include "tests/boost-test.hpp"
namespace chronosync {
namespace test {
-using std::tuple;
-
BOOST_AUTO_TEST_SUITE(TestBzip2Helper)
BOOST_AUTO_TEST_CASE(Basic)
diff --git a/tests/unit-tests/test-diff-state.cpp b/tests/unit-tests/test-diff-state.cpp
index a4b740f..f71378a 100644
--- a/tests/unit-tests/test-diff-state.cpp
+++ b/tests/unit-tests/test-diff-state.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2014 University of California, Los Angeles
+ * Copyright (c) 2012-2019 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -19,7 +19,8 @@
#include "diff-state.hpp"
#include "diff-state-container.hpp"
-#include "boost-test.hpp"
+
+#include "tests/boost-test.hpp"
namespace chronosync {
namespace test {
diff --git a/tests/unit-tests/test-empty.cpp b/tests/unit-tests/test-empty.cpp
deleted file mode 100644
index e4abe0c..0000000
--- a/tests/unit-tests/test-empty.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2012-2014 University of California, Los Angeles
- *
- * This file is part of ChronoSync, synchronization library for distributed realtime
- * applications for NDN.
- *
- * ChronoSync 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.
- *
- * ChronoSync 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
- * ChronoSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "boost-test.hpp"
-
-BOOST_AUTO_TEST_CASE(EmptyTest)
-{
-
-}
diff --git a/tests/unit-tests/test-interest-table.cpp b/tests/unit-tests/test-interest-table.cpp
index be0f289..9e98c0b 100644
--- a/tests/unit-tests/test-interest-table.cpp
+++ b/tests/unit-tests/test-interest-table.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2017 University of California, Los Angeles
+ * Copyright (c) 2012-2019 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -18,8 +18,9 @@
*/
#include "interest-table.hpp"
-#include "boost-test.hpp"
-#include "../unit-test-time-fixture.hpp"
+
+#include "tests/boost-test.hpp"
+#include "tests/unit-test-time-fixture.hpp"
#include <unistd.h>
diff --git a/tests/unit-tests/test-leaf.cpp b/tests/unit-tests/test-leaf.cpp
index 94ee50c..71ea8f1 100644
--- a/tests/unit-tests/test-leaf.cpp
+++ b/tests/unit-tests/test-leaf.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2017 University of California, Los Angeles
+ * Copyright (c) 2012-2019 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -18,9 +18,10 @@
*/
#include "leaf.hpp"
-#include "boost-test.hpp"
#include "leaf-container.hpp"
+#include "tests/boost-test.hpp"
+
#include <ndn-cxx/encoding/buffer-stream.hpp>
#include <ndn-cxx/util/string-helper.hpp>
diff --git a/tests/unit-tests/test-logic.cpp b/tests/unit-tests/test-logic.cpp
index dafc00b..50dbd11 100644
--- a/tests/unit-tests/test-logic.cpp
+++ b/tests/unit-tests/test-logic.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2018 University of California, Los Angeles
+ * Copyright (c) 2012-2019 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -20,17 +20,15 @@
#include "logic.hpp"
#include "bzip2-helper.hpp"
-#include "boost-test.hpp"
-#include "../identity-management-fixture.hpp"
-
-#include "dummy-forwarder.hpp"
+#include "tests/boost-test.hpp"
+#include "tests/identity-management-fixture.hpp"
+#include "tests/unit-tests/dummy-forwarder.hpp"
#include <ndn-cxx/util/random.hpp>
namespace chronosync {
namespace test {
-using std::vector;
using ndn::chronosync::DummyForwarder;
class Handler
@@ -47,7 +45,7 @@
}
void
- onUpdate(const vector<MissingDataInfo>& v)
+ onUpdate(const std::vector<MissingDataInfo>& v)
{
for (size_t i = 0; i < v.size(); i++) {
update(v[i].session, v[i].high, v[i].low);
@@ -99,8 +97,8 @@
BOOST_FIXTURE_TEST_SUITE(LogicTests, LogicFixture)
-void
-onUpdate(const vector<MissingDataInfo>& v)
+static void
+onUpdate(const std::vector<MissingDataInfo>& v)
{
}
@@ -443,6 +441,7 @@
setenv("CHRONOSYNC_MAX_PACKET_SIZE", oldSize->c_str(), 1);
}
}
+
private:
ndn::optional<std::string> oldSize;
};
diff --git a/tests/unit-tests/test-multiple-user.cpp b/tests/unit-tests/test-multiple-user.cpp
index 7effecc..db8ffcf 100644
--- a/tests/unit-tests/test-multiple-user.cpp
+++ b/tests/unit-tests/test-multiple-user.cpp
@@ -1,13 +1,29 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2012-2019 University of California, Los Angeles
+ *
+ * This file is part of ChronoSync, synchronization library for distributed realtime
+ * applications for NDN.
+ *
+ * ChronoSync 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.
+ *
+ * ChronoSync 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
+ * ChronoSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#include "logic.hpp"
-#include "boost-test.hpp"
+#include "tests/boost-test.hpp"
namespace chronosync {
namespace test {
-using std::vector;
-
-
class Handler
{
public:
@@ -22,9 +38,8 @@
}
void
- onUpdate(const vector<MissingDataInfo>& v)
+ onUpdate(const std::vector<MissingDataInfo>& v)
{
-
}
void
@@ -45,7 +60,6 @@
logic.removeUserNode(prefix);
}
-
Logic logic;
std::map<Name, SeqNo> map;
};
@@ -53,7 +67,6 @@
class MultiUserFixture
{
public:
-
MultiUserFixture()
: syncPrefix("/ndn/broadcast/sync")
, scheduler(io)
@@ -93,9 +106,8 @@
BOOST_CHECK_EQUAL(handler->logic.getSeqNo(), 2);
- BOOST_REQUIRE_THROW(handler->logic.getSeqNo(userPrefix[0]), Logic::Error);
- BOOST_REQUIRE_THROW(handler->logic.getSessionName(userPrefix[0]), Logic::Error);
-
+ BOOST_CHECK_THROW(handler->logic.getSeqNo(userPrefix[0]), Logic::Error);
+ BOOST_CHECK_THROW(handler->logic.getSessionName(userPrefix[0]), Logic::Error);
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/unit-tests/test-socket.cpp b/tests/unit-tests/test-socket.cpp
index 4c4984b..3b16939 100644
--- a/tests/unit-tests/test-socket.cpp
+++ b/tests/unit-tests/test-socket.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2018 University of California, Los Angeles
+ * Copyright (c) 2012-2019 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -19,8 +19,8 @@
#include "socket.hpp"
-#include "boost-test.hpp"
-#include "../unit-test-time-fixture.hpp"
+#include "tests/boost-test.hpp"
+#include "tests/unit-test-time-fixture.hpp"
#include <ndn-cxx/util/dummy-client-face.hpp>
@@ -28,8 +28,6 @@
namespace test {
using std::string;
-using std::vector;
-using std::map;
using ndn::util::DummyClientFace;
/**
@@ -99,7 +97,7 @@
}
void
- fetchAll(const vector<MissingDataInfo>& v)
+ fetchAll(const std::vector<MissingDataInfo>& v)
{
// std::cerr << "fetchAll" << std::endl;
for (size_t i = 0; i < v.size(); i++) {
@@ -112,7 +110,7 @@
}
void
- fetchNumbers(const vector<MissingDataInfo>& v)
+ fetchNumbers(const std::vector<MissingDataInfo>& v)
{
// std::cerr << "fetchNumbers" << std::endl;
for (size_t i = 0; i < v.size(); i++) {
@@ -128,7 +126,7 @@
toString()
{
string str = "\n";
- for (map<Name, string>::iterator it = data.begin(); it != data.end(); ++it) {
+ for (auto it = data.begin(); it != data.end(); ++it) {
str += "<";
str += it->first.toUri();
str += "|";
@@ -141,7 +139,7 @@
}
public:
- map<ndn::Name, string> data;
+ std::map<ndn::Name, string> data;
uint32_t sum;
Socket socket;
};
@@ -248,8 +246,6 @@
size_t readDataOffset[3];
};
-
-
BOOST_FIXTURE_TEST_SUITE(SocketTests, SocketFixture)
BOOST_AUTO_TEST_CASE(BasicData)
diff --git a/tests/unit-tests/test-state.cpp b/tests/unit-tests/test-state.cpp
index 9e7ce58..850f8da 100644
--- a/tests/unit-tests/test-state.cpp
+++ b/tests/unit-tests/test-state.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2017 University of California, Los Angeles
+ * Copyright (c) 2012-2019 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -19,13 +19,11 @@
#include "state.hpp"
-#include "boost-test.hpp"
+#include "tests/boost-test.hpp"
namespace chronosync {
namespace test {
-using std::tuple;
-
BOOST_AUTO_TEST_SUITE(StateTests)
BOOST_AUTO_TEST_CASE(Basic)
@@ -42,7 +40,7 @@
BOOST_CHECK_NO_THROW(state.reset());
BOOST_CHECK_EQUAL(state.getLeaves().size(), 0);
- tuple<bool, bool, SeqNo> result;
+ std::tuple<bool, bool, SeqNo> result;
result = state.update(info, 12);
BOOST_CHECK_EQUAL(std::get<0>(result), true);
BOOST_CHECK_EQUAL(std::get<1>(result), false);
diff --git a/tests/wscript b/tests/wscript
index a70ae8c..e92ab29 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -1,28 +1,10 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-from waflib import Utils
top = '..'
def build(bld):
- bld.objects(
- target='tests-main',
- source='main.cpp',
- use='ChronoSync',
- defines=['BOOST_TEST_MODULE=ChronoSync'])
-
- bld.program(
- target="../unit-tests",
- name='unit-tests',
- source=bld.path.ant_glob(['unit-tests/**/*.cpp', 'identity-management-fixture.cpp']),
- use='ChronoSync tests-main',
- includes=['.'],
- install_path=None)
-
- # TODO: Re-enable when there integration tests are implemented
- # bld.program(
- # target="../integrated-tests",
- # source=bld.path.ant_glob(['integrated-tests/**/*.cpp']),
- # use='ChronoSync tests-main',
- # includes=['.'],
- # install_path=None,
- # )
+ bld.program(target='../unit-tests',
+ name='unit-tests',
+ source=bld.path.ant_glob('**/*.cpp'),
+ use='ChronoSync',
+ install_path=None)