build: various updates

* Upgrade waf to 2.0.14
 * Sync default compiler flags with ndn-cxx
 * Simplify compilation of unit-tests

Change-Id: I94865d405240c181dd4cfdd1cb730b756ad5166a
This commit is contained in:
Davide Pesavento
2019-01-29 14:34:33 -05:00
parent 9a306fe0a9
commit fae9def359
16 changed files with 101 additions and 135 deletions
+2
View File
@@ -0,0 +1,2 @@
<aa@cs.fiu.edu> <alexander.afanasyev@ucla.edu>
<davidepesa@gmail.com> <davide.pesavento@lip6.fr>
+14 -8
View File
@@ -20,9 +20,9 @@ def configure(conf):
'The minimum supported gcc version is 5.3.0.')
conf.flags = GccFlags()
elif cxx == 'clang':
if ccver < (3, 5, 0):
if ccver < (3, 6, 0):
errmsg = ('The version of clang you are using is too old.\n'
'The minimum supported clang version is 3.5.0.')
'The minimum supported clang version is 3.6.0.')
conf.flags = ClangFlags()
else:
warnmsg = 'Note: %s compiler is unsupported' % cxx
@@ -129,6 +129,10 @@ class GccBasicFlags(CompilerFlags):
def getGeneralFlags(self, conf):
flags = super(GccBasicFlags, self).getGeneralFlags(conf)
flags['CXXFLAGS'] += ['-std=c++14']
if Utils.unversioned_sys_platform() == 'linux':
flags['LINKFLAGS'] += ['-fuse-ld=gold']
elif Utils.unversioned_sys_platform() == 'freebsd':
flags['LINKFLAGS'] += ['-fuse-ld=lld']
return flags
def getDebugFlags(self, conf):
@@ -145,7 +149,7 @@ class GccBasicFlags(CompilerFlags):
'-Wno-error=maybe-uninitialized', # Bug #1615
'-Wno-unused-parameter',
]
flags['LINKFLAGS'] += ['-fuse-ld=gold', '-Wl,-O1']
flags['LINKFLAGS'] += ['-Wl,-O1']
return flags
def getOptimizedFlags(self, conf):
@@ -158,7 +162,7 @@ class GccBasicFlags(CompilerFlags):
'-Wnon-virtual-dtor',
'-Wno-unused-parameter',
]
flags['LINKFLAGS'] += ['-fuse-ld=gold', '-Wl,-O1']
flags['LINKFLAGS'] += ['-Wl,-O1']
return flags
class GccFlags(GccBasicFlags):
@@ -179,6 +183,8 @@ class ClangFlags(GccBasicFlags):
# Bug #4296
flags['CXXFLAGS'] += [['-isystem', '/usr/local/include'], # for Homebrew
['-isystem', '/opt/local/include']] # for MacPorts
if Utils.unversioned_sys_platform() == 'freebsd':
flags['CXXFLAGS'] += [['-isystem', '/usr/local/include']] # Bug #4790
return flags
def getDebugFlags(self, conf):
@@ -186,15 +192,13 @@ class ClangFlags(GccBasicFlags):
flags['CXXFLAGS'] += ['-fcolor-diagnostics',
'-Wextra-semi',
'-Wundefined-func-template',
'-Wno-error=deprecated-register',
'-Wno-error=infinite-recursion', # Bug #3358
'-Wno-error=keyword-macro', # Bug #3235
'-Wno-error=unneeded-internal-declaration', # Bug #1588
'-Wno-unused-local-typedef', # Bugs #2657 and #3209
]
version = self.getCompilerVersion(conf)
if version < (3, 9, 0) or (Utils.unversioned_sys_platform() == 'darwin' and version < (8, 1, 0)):
flags['CXXFLAGS'] += ['-Wno-unknown-pragmas']
if version < (6, 0, 0):
flags['CXXFLAGS'] += ['-Wno-missing-braces'] # Bug #4721
return flags
def getOptimizedFlags(self, conf):
@@ -207,4 +211,6 @@ class ClangFlags(GccBasicFlags):
version = self.getCompilerVersion(conf)
if version < (3, 9, 0) or (Utils.unversioned_sys_platform() == 'darwin' and version < (8, 1, 0)):
flags['CXXFLAGS'] += ['-Wno-unknown-pragmas']
if version < (6, 0, 0):
flags['CXXFLAGS'] += ['-Wno-missing-braces'] # Bug #4721
return flags
+2 -3
View File
@@ -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
+7 -8
View File
@@ -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>
+2 -4
View File
@@ -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)
+3 -2
View File
@@ -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 {
-25
View File
@@ -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)
{
}
+4 -3
View File
@@ -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>
+3 -2
View File
@@ -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>
+8 -9
View File
@@ -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 @@ public:
}
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 @@ public:
BOOST_FIXTURE_TEST_SUITE(LogicTests, LogicFixture)
void
onUpdate(const vector<MissingDataInfo>& v)
static void
onUpdate(const std::vector<MissingDataInfo>& v)
{
}
@@ -443,6 +441,7 @@ public:
setenv("CHRONOSYNC_MAX_PACKET_SIZE", oldSize->c_str(), 1);
}
}
private:
ndn::optional<std::string> oldSize;
};
+23 -11
View File
@@ -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 @@ public:
}
void
onUpdate(const vector<MissingDataInfo>& v)
onUpdate(const std::vector<MissingDataInfo>& v)
{
}
void
@@ -45,7 +60,6 @@ public:
logic.removeUserNode(prefix);
}
Logic logic;
std::map<Name, SeqNo> map;
};
@@ -53,7 +67,6 @@ public:
class MultiUserFixture
{
public:
MultiUserFixture()
: syncPrefix("/ndn/broadcast/sync")
, scheduler(io)
@@ -93,9 +106,8 @@ BOOST_AUTO_TEST_CASE(ThreeUserNode)
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()
+7 -11
View File
@@ -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 chronosync {
namespace test {
using std::string;
using std::vector;
using std::map;
using ndn::util::DummyClientFace;
/**
@@ -99,7 +97,7 @@ public:
}
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 @@ public:
}
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 @@ public:
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:
}
public:
map<ndn::Name, string> data;
std::map<ndn::Name, string> data;
uint32_t sum;
Socket socket;
};
@@ -248,8 +246,6 @@ public:
size_t readDataOffset[3];
};
BOOST_FIXTURE_TEST_SUITE(SocketTests, SocketFixture)
BOOST_AUTO_TEST_CASE(BasicData)
+3 -5
View File
@@ -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_AUTO_TEST_CASE(Basic)
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);
+5 -23
View File
@@ -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)
Vendored
+6 -6
View File
File diff suppressed because one or more lines are too long
+12 -15
View File
@@ -14,7 +14,7 @@ def options(opt):
tooldir=['.waf-tools'])
opt.add_option('--with-tests', action='store_true', default=False,
dest='with_tests', help='''Build unit tests''')
help='Build unit tests')
def configure(conf):
conf.load(['compiler_c', 'compiler_cxx', 'gnu_dirs',
@@ -48,30 +48,27 @@ def configure(conf):
conf.write_config_header('config.hpp')
def build(bld):
bld.shlib(
target='ChronoSync',
vnum = VERSION,
cnum = VERSION,
source = bld.path.ant_glob(['src/**/*.cpp', 'src/**/*.proto']),
use = 'BOOST NDN_CXX',
includes = ['src', '.'],
export_includes=['src', '.'])
bld.shlib(target='ChronoSync',
vnum=VERSION,
cnum=VERSION,
source=bld.path.ant_glob('src/**/*.cpp'),
use='NDN_CXX BOOST',
includes='src .',
export_includes='src .')
# Unit tests
if bld.env["CHRONOSYNC_HAVE_TESTS"]:
if bld.env['CHRONOSYNC_HAVE_TESTS']:
bld.recurse('tests')
bld.install_files(
dest = '%s/ChronoSync' % bld.env['INCLUDEDIR'],
files = bld.path.ant_glob(['src/*.hpp', 'common.hpp']),
cwd = bld.path.find_dir("src"),
relative_trick = False,
)
cwd = bld.path.find_dir('src'),
relative_trick = False)
bld.install_files(
dest = '%s/ChronoSync' % bld.env['INCLUDEDIR'],
files = bld.path.get_bld().ant_glob(['src/*.hpp', 'common.hpp', 'config.hpp']),
cwd = bld.path.get_bld().find_dir("src"),
cwd = bld.path.get_bld().find_dir('src'),
relative_trick = False)
bld(features = 'subst',