diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh index b5671bc..c020871 100755 --- a/.jenkins.d/00-deps.sh +++ b/.jenkins.d/00-deps.sh @@ -25,6 +25,6 @@ if has OSX $NODE_LABELS; then elif has Ubuntu $NODE_LABELS; then sudo apt-get -qq update - sudo apt-get -qy install g++ pkg-config python3-minimal \ + sudo apt-get -qy install build-essential pkg-config python3-minimal \ libboost-all-dev libssl-dev libsqlite3-dev fi diff --git a/.jenkins.d/01-ndn-cxx.sh b/.jenkins.d/01-ndn-cxx.sh index 7bf1cfe..4e0e154 100755 --- a/.jenkins.d/01-ndn-cxx.sh +++ b/.jenkins.d/01-ndn-cxx.sh @@ -35,16 +35,12 @@ sudo rm -f /usr/local/lib{,64}/pkgconfig/libndn-cxx.pc pushd ndn-cxx >/dev/null -if has Linux $NODE_LABELS && [[ $CXX != clang* && -z $DISABLE_ASAN ]]; then - # https://stackoverflow.com/a/47022141 - ASAN="--with-sanitizer=address" -fi if has CentOS-8 $NODE_LABELS; then # https://bugzilla.redhat.com/show_bug.cgi?id=1721553 PCH="--without-pch" fi -./waf --color=yes configure --disable-static --enable-shared --without-osx-keychain $ASAN $PCH +./waf --color=yes configure --disable-static --enable-shared --without-osx-keychain $PCH ./waf --color=yes build -j$WAF_JOBS sudo_preserve_env PATH -- ./waf --color=yes install diff --git a/.jenkins.d/20-tests.sh b/.jenkins.d/20-tests.sh index d4b9652..9ea3853 100755 --- a/.jenkins.d/20-tests.sh +++ b/.jenkins.d/20-tests.sh @@ -3,28 +3,8 @@ set -ex # Prepare environment rm -rf ~/.ndn - -if has OSX $NODE_LABELS; then - security unlock-keychain -p named-data -fi - ndnsec-keygen "/tmp/jenkins/$NODE_NAME" | ndnsec-install-cert - -BOOST_VERSION=$(python3 -c "import sys; sys.path.append('build/c4che'); import _cache; print(_cache.BOOST_VERSION_NUMBER);") - -ut_log_args() { - if (( BOOST_VERSION >= 106200 )); then - echo --logger=HRF,test_suite,stdout:XML,all,build/xunit-${1:-report}.xml - else - if [[ -n $XUNIT ]]; then - echo --log_level=all $( (( BOOST_VERSION >= 106000 )) && echo -- ) \ - --log_format2=XML --log_sink2=build/xunit-${1:-report}.xml - else - echo --log_level=test_suite - fi - fi -} - # https://github.com/google/sanitizers/wiki/AddressSanitizerFlags ASAN_OPTIONS="color=always" ASAN_OPTIONS+=":check_initialization_order=1" @@ -37,6 +17,8 @@ export ASAN_OPTIONS export BOOST_TEST_BUILD_INFO=1 export BOOST_TEST_COLOR_OUTPUT=1 +export BOOST_TEST_DETECT_MEMORY_LEAK=0 +export BOOST_TEST_LOGGER=HRF,test_suite,stdout:XML,all,build/xunit-log.xml # Run unit tests -./build/unit-tests $(ut_log_args) +./build/unit-tests diff --git a/.travis.yml b/.travis.yml index 54ce733..2e7caab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,6 +38,12 @@ jobs: - os: osx osx_image: xcode11.3 env: # default compiler + - os: osx + osx_image: xcode11.6 + env: # default compiler + - os: osx + osx_image: xcode12 + env: # default compiler allow_failures: - arch: s390x # bug 5098 diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py index 9e045c3..f3be6e7 100644 --- a/.waf-tools/default-compiler-flags.py +++ b/.waf-tools/default-compiler-flags.py @@ -1,10 +1,11 @@ # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- +import platform from waflib import Configure, Logs, Utils def options(opt): opt.add_option('--debug', '--with-debug', action='store_true', default=False, - help='Compile in debugging mode with minimal optimizations (-O0 or -Og)') + help='Compile in debugging mode with minimal optimizations (-Og)') def configure(conf): conf.start_msg('Checking C++ compiler version') @@ -17,15 +18,21 @@ def configure(conf): if cxx == 'gcc': if ccver < (5, 3, 0): errmsg = ('The version of gcc you are using is too old.\n' - 'The minimum supported gcc version is 5.3.0.') + 'The minimum supported gcc version is 7.4.0.') + elif ccver < (7, 4, 0): + warnmsg = ('Using a version of gcc older than 7.4.0 is not ' + 'officially supported and may result in build failures.') conf.flags = GccFlags() elif cxx == 'clang': - if ccver < (3, 6, 0): + if Utils.unversioned_sys_platform() == 'darwin' and ccver < (9, 0, 0): + errmsg = ('The version of Xcode you are using is too old.\n' + 'The minimum supported Xcode version is 9.0.') + elif ccver < (4, 0, 0): errmsg = ('The version of clang you are using is too old.\n' - 'The minimum supported clang version is 3.6.0.') + 'The minimum supported clang version is 4.0.') conf.flags = ClangFlags() else: - warnmsg = 'Note: %s compiler is unsupported' % cxx + warnmsg = '%s compiler is unsupported' % cxx conf.flags = CompilerFlags() if errmsg: @@ -33,7 +40,7 @@ def configure(conf): conf.fatal(errmsg) elif warnmsg: conf.end_msg(ccverstr, color='YELLOW') - Logs.warn(warnmsg) + Logs.warn('WARNING: ' + warnmsg) else: conf.end_msg(ccverstr) @@ -137,13 +144,14 @@ class GccBasicFlags(CompilerFlags): def getDebugFlags(self, conf): flags = super(GccBasicFlags, self).getDebugFlags(conf) - flags['CXXFLAGS'] += ['-O0', - '-Og', # gcc >= 4.8, clang >= 4.0 + flags['CXXFLAGS'] += ['-Og', '-g3', '-pedantic', '-Wall', '-Wextra', '-Werror', + '-Wcatch-value=2', + '-Wextra-semi', '-Wnon-virtual-dtor', '-Wno-error=deprecated-declarations', # Bug #3795 '-Wno-error=maybe-uninitialized', # Bug #1615 @@ -159,6 +167,8 @@ class GccBasicFlags(CompilerFlags): '-pedantic', '-Wall', '-Wextra', + '-Wcatch-value=2', + '-Wextra-semi', '-Wnon-virtual-dtor', '-Wno-unused-parameter', ] @@ -168,49 +178,50 @@ class GccBasicFlags(CompilerFlags): class GccFlags(GccBasicFlags): def getDebugFlags(self, conf): flags = super(GccFlags, self).getDebugFlags(conf) - flags['CXXFLAGS'] += ['-fdiagnostics-color'] + flags['CXXFLAGS'] += ['-fdiagnostics-color', + '-Wredundant-tags', + ] + if platform.machine() == 'armv7l' and self.getCompilerVersion(conf) >= (7, 1, 0): + flags['CXXFLAGS'] += ['-Wno-psabi'] # Bug #5106 return flags def getOptimizedFlags(self, conf): flags = super(GccFlags, self).getOptimizedFlags(conf) - flags['CXXFLAGS'] += ['-fdiagnostics-color'] + flags['CXXFLAGS'] += ['-fdiagnostics-color', + '-Wredundant-tags', + ] + if platform.machine() == 'armv7l' and self.getCompilerVersion(conf) >= (7, 1, 0): + flags['CXXFLAGS'] += ['-Wno-psabi'] # Bug #5106 return flags class ClangFlags(GccBasicFlags): def getGeneralFlags(self, conf): flags = super(ClangFlags, self).getGeneralFlags(conf) - if Utils.unversioned_sys_platform() == 'darwin' and self.getCompilerVersion(conf) >= (9, 0, 0): + if Utils.unversioned_sys_platform() == 'darwin': # 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 + elif Utils.unversioned_sys_platform() == 'freebsd': + # Bug #4790 + flags['CXXFLAGS'] += [['-isystem', '/usr/local/include']] return flags def getDebugFlags(self, conf): flags = super(ClangFlags, self).getDebugFlags(conf) flags['CXXFLAGS'] += ['-fcolor-diagnostics', - '-Wextra-semi', '-Wundefined-func-template', '-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): + if self.getCompilerVersion(conf) < (6, 0, 0): flags['CXXFLAGS'] += ['-Wno-missing-braces'] # Bug #4721 return flags def getOptimizedFlags(self, conf): flags = super(ClangFlags, self).getOptimizedFlags(conf) flags['CXXFLAGS'] += ['-fcolor-diagnostics', - '-Wextra-semi', '-Wundefined-func-template', '-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): + if self.getCompilerVersion(conf) < (6, 0, 0): flags['CXXFLAGS'] += ['-Wno-missing-braces'] # Bug #4721 return flags diff --git a/common.hpp b/common.hpp index 2ec0acd..656740e 100644 --- a/common.hpp +++ b/common.hpp @@ -57,9 +57,8 @@ #include #include #include -#include +#include #include -#include namespace chronosync { diff --git a/src/logic.cpp b/src/logic.cpp index e0e6e02..2701aa5 100644 --- a/src/logic.cpp +++ b/src/logic.cpp @@ -482,14 +482,14 @@ Logic::processSyncInterest(const Interest& interest, bool isTimedProcessing/*=fa } void -Logic::processResetInterest(const Interest& interest) +Logic::processResetInterest(const Interest&) { _LOG_DEBUG_ID(">> Logic::processResetInterest"); reset(true); } void -Logic::processSyncData(const Name& name, ConstBufferPtr digest, const Block& syncReply) +Logic::processSyncData(const Name&, ConstBufferPtr digest, const Block& syncReply) { _LOG_DEBUG_ID(">> Logic::processSyncData"); DiffStatePtr commit = make_shared(); @@ -502,7 +502,7 @@ Logic::processSyncData(const Name& name, ConstBufferPtr digest, const Block& syn reply.wireDecode(syncReply); std::vector v; - BOOST_FOREACH(ConstLeafPtr leaf, reply.getLeaves().get()) { + for (const auto& leaf : reply.getLeaves().get()) { BOOST_ASSERT(leaf != nullptr); const Name& info = leaf->getSessionName(); @@ -514,10 +514,8 @@ Logic::processSyncData(const Name& name, ConstBufferPtr digest, const Block& syn std::tie(isInserted, isUpdated, oldSeq) = m_state.update(info, seq); if (isInserted || isUpdated) { commit->update(info, seq); - oldSeq++; - MissingDataInfo mdi = {info, oldSeq, seq}; - v.push_back(mdi); + v.push_back({info, oldSeq, seq}); } } diff --git a/src/state.cpp b/src/state.cpp index c6b3ead..533a451 100644 --- a/src/state.cpp +++ b/src/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-2020 University of California, Los Angeles * * This file is part of ChronoSync, synchronization library for distributed realtime * applications for NDN. @@ -24,6 +24,8 @@ #include "state.hpp" +#include + namespace chronosync { State::~State() = default; @@ -52,8 +54,7 @@ State::update(const Name& info, const SeqNo& seq) } SeqNo old = (*leaf)->getSeq(); - m_leaves.modify(leaf, - [=] (LeafPtr& leaf) { leaf->setSeq(seq); } ); + m_leaves.modify(leaf, [=] (LeafPtr& leaf) { leaf->setSeq(seq); } ); return make_tuple(false, true, old); } } @@ -63,16 +64,14 @@ State::getRootDigest() const { m_digest.reset(); - BOOST_FOREACH (ConstLeafPtr leaf, m_leaves.get()) - { - BOOST_ASSERT(leaf != 0); - m_digest.update(leaf->getDigest()->data(), leaf->getDigest()->size()); - } + for (const auto& leaf : m_leaves.get()) { + BOOST_ASSERT(leaf != nullptr); + m_digest.update(leaf->getDigest()->data(), leaf->getDigest()->size()); + } return m_digest.computeDigest(); } - void State::reset() { @@ -82,12 +81,10 @@ State::reset() State& State::operator+=(const State& state) { - BOOST_FOREACH (ConstLeafPtr leaf, state.getLeaves()) - { - BOOST_ASSERT(leaf != 0); - update(leaf->getSessionName(), leaf->getSeq()); - } - + for (const auto& leaf : state.getLeaves()) { + BOOST_ASSERT(leaf != nullptr); + update(leaf->getSessionName(), leaf->getSeq()); + } return *this; } @@ -97,15 +94,14 @@ State::wireEncode(encoding::EncodingImpl& block) const { size_t totalLength = 0; - BOOST_REVERSE_FOREACH (ConstLeafPtr leaf, m_leaves.get()) - { - size_t entryLength = 0; - entryLength += prependNonNegativeIntegerBlock(block, tlv::SeqNo, leaf->getSeq()); - entryLength += leaf->getSessionName().wireEncode(block); - entryLength += block.prependVarNumber(entryLength); - entryLength += block.prependVarNumber(tlv::StateLeaf); - totalLength += entryLength; - } + for (const auto& leaf : m_leaves.get() | boost::adaptors::reversed) { + size_t entryLength = 0; + entryLength += prependNonNegativeIntegerBlock(block, tlv::SeqNo, leaf->getSeq()); + entryLength += leaf->getSessionName().wireEncode(block); + entryLength += block.prependVarNumber(entryLength); + entryLength += block.prependVarNumber(tlv::StateLeaf); + totalLength += entryLength; + } totalLength += block.prependVarNumber(totalLength); totalLength += block.prependVarNumber(tlv::SyncReply); @@ -144,12 +140,11 @@ State::wireDecode(const Block& wire) wire.parse(); m_wire = wire; - for (Block::element_const_iterator it = wire.elements_begin(); - it != wire.elements_end(); it++) { + for (auto it = wire.elements_begin(); it != wire.elements_end(); it++) { if (it->type() == tlv::StateLeaf) { it->parse(); - Block::element_const_iterator val = it->elements_begin(); + auto val = it->elements_begin(); Name info(*val); val++; diff --git a/tests/boost-multi-log-formatter.hpp b/tests/boost-multi-log-formatter.hpp deleted file mode 100644 index ae37416..0000000 --- a/tests/boost-multi-log-formatter.hpp +++ /dev/null @@ -1,214 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2015 Regents of the University of California. - * - * Based on work by Martin Ba (http://stackoverflow.com/a/26718189) - * - * This file is distributed under the Boost Software License, Version 1.0. - * (See http://www.boost.org/LICENSE_1_0.txt) - */ - -#ifndef NDN_TESTS_BOOST_MULTI_LOG_FORMATTER_HPP -#define NDN_TESTS_BOOST_MULTI_LOG_FORMATTER_HPP - -#include - -#if BOOST_VERSION >= 105900 -#include -#else -#include -#endif // BOOST_VERSION >= 105900 - -#include -#include -#include - -namespace boost { -namespace unit_test { -namespace output { - -/** - * @brief Log formatter for Boost.Test that outputs the logging to multiple formatters - * - * The log formatter is designed to output to one or multiple formatters at the same time. For - * example, one HRF formatter can output to the standard output, while XML formatter output to - * the file. - * - * Usage: - * - * // Call in init_unit_test_suite: (this will override the --log_format parameter) - * auto formatter = new boost::unit_test::output::multi_log_formatter; // same as already configured logger - * - * // Prepare and add additional logger(s) - * formatter.add(std::make_shared(), - * std::make_shared("out.xml")); - * - * boost::unit_test::unit_test_log.set_formatter(formatter); - * - * @note Calling `boost::unit_test::unit_test_log.set_stream(...)` will change the stream for - * the original logger. - */ -class multi_log_formatter : public unit_test_log_formatter -{ -public: - /** - * @brief Create instance of the logger, based on the configured logger instance - */ - multi_log_formatter() - { - auto format = -#if BOOST_VERSION > 105900 - runtime_config::get(runtime_config::LOG_FORMAT); -#else - runtime_config::log_format(); -#endif // BOOST_VERSION > 105900 - - switch (format) { - default: -#if BOOST_VERSION >= 105900 - case OF_CLF: -#else - case CLF: -#endif // BOOST_VERSION >= 105900 - m_loggers.push_back({std::make_shared(), nullptr}); - break; -#if BOOST_VERSION >= 105900 - case OF_XML: -#else - case XML: -#endif // BOOST_VERSION >= 105900 - m_loggers.push_back({std::make_shared(), nullptr}); - break; - } - } - - void - add(std::shared_ptr formatter, std::shared_ptr os) - { - m_loggers.push_back({formatter, os}); - } - - // Formatter interface - void - log_start(std::ostream& os, counter_t test_cases_amount) - { - for (auto& l : m_loggers) - l.logger->log_start(l.os == nullptr ? os : *l.os, test_cases_amount); - } - - void - log_finish(std::ostream& os) - { - for (auto& l : m_loggers) - l.logger->log_finish(l.os == nullptr ? os : *l.os); - } - - void - log_build_info(std::ostream& os) - { - for (auto& l : m_loggers) - l.logger->log_build_info(l.os == nullptr ? os : *l.os); - } - - void - test_unit_start(std::ostream& os, const test_unit& tu) - { - for (auto& l : m_loggers) - l.logger->test_unit_start(l.os == nullptr ? os : *l.os, tu); - } - - void - test_unit_finish(std::ostream& os, const test_unit& tu, unsigned long elapsed) - { - for (auto& l : m_loggers) - l.logger->test_unit_finish(l.os == nullptr ? os : *l.os, tu, elapsed); - } - - void - test_unit_skipped(std::ostream& os, const test_unit& tu) - { - for (auto& l : m_loggers) - l.logger->test_unit_skipped(l.os == nullptr ? os : *l.os, tu); - } - -#if BOOST_VERSION >= 105900 - void - log_exception_start(std::ostream& os, const log_checkpoint_data& lcd, const execution_exception& ex) - { - for (auto& l : m_loggers) - l.logger->log_exception_start(l.os == nullptr ? os : *l.os, lcd, ex); - } - - void - log_exception_finish(std::ostream& os) - { - for (auto& l : m_loggers) - l.logger->log_exception_finish(l.os == nullptr ? os : *l.os); - } -#else - void - log_exception(std::ostream& os, const log_checkpoint_data& lcd, const execution_exception& ex) - { - for (auto& l : m_loggers) - l.logger->log_exception(l.os == nullptr ? os : *l.os, lcd, ex); - } -#endif // BOOST_VERSION >= 105900 - - void - log_entry_start(std::ostream& os, const log_entry_data& entry_data, log_entry_types let) - { - for (auto& l : m_loggers) - l.logger->log_entry_start(l.os == nullptr ? os : *l.os, entry_data, let); - } - - void - log_entry_value(std::ostream& os, const_string value) - { - for (auto& l : m_loggers) - l.logger->log_entry_value(l.os == nullptr ? os : *l.os, value); - } - - void - log_entry_finish(std::ostream& os) - { - for (auto& l : m_loggers) - l.logger->log_entry_finish(l.os == nullptr ? os : *l.os); - } - -#if BOOST_VERSION >= 105900 - void - entry_context_start(std::ostream& os, log_level level) - { - for (auto& l : m_loggers) - l.logger->entry_context_start(l.os == nullptr ? os : *l.os, level); - } - - void - log_entry_context(std::ostream& os, const_string value) - { - for (auto& l : m_loggers) - l.logger->log_entry_context(l.os == nullptr ? os : *l.os, value); - } - - void - entry_context_finish(std::ostream& os) - { - for (auto& l : m_loggers) - l.logger->entry_context_finish(l.os == nullptr ? os : *l.os); - } -#endif // BOOST_VERSION >= 105900 - -private: - struct LoggerInfo - { - std::shared_ptr logger; - std::shared_ptr os; - }; - std::vector m_loggers; -}; - -} // namespace output -} // namespace unit_test -} // namespace boost - -#endif // NDN_TESTS_BOOST_MULTI_LOG_FORMATTER_HPP diff --git a/tests/main.cpp b/tests/main.cpp index 70d0433..d6119af 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,115 +1,21 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2019, 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. + * Copyright (c) 2012-2020 University of California, Los Angeles * * This file is part of ChronoSync, synchronization library for distributed realtime - * applications for NDN, originally developed as part of NFD (Named Data Networking - * Forwarding Daemon). See AUTHORS.md for complete list of NFD authors and contributors. + * applications for NDN. * - * 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. + * 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. * - * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * 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 - * NFD, e.g., in COPYING.md file. If not, see . + * ChronoSync, e.g., in COPYING.md file. If not, see . */ #define BOOST_TEST_MODULE ChronoSync - -#include - -#if BOOST_VERSION >= 106200 -// Boost.Test v3.3 (Boost 1.62) natively supports multi-logger output #include "tests/boost-test.hpp" -#else -#define BOOST_TEST_ALTERNATIVE_INIT_API -#define BOOST_TEST_NO_MAIN -#include "tests/boost-test.hpp" -#include "tests/boost-multi-log-formatter.hpp" - -#include -#include -#include - -#include -#include - -static bool -init_tests() -{ - init_unit_test(); - - namespace po = boost::program_options; - namespace ut = boost::unit_test; - - po::options_description extraOptions; - std::string logger; - std::string outputFile = "-"; - extraOptions.add_options() - ("log_format2", po::value(&logger), "Type of second log formatter: HRF or XML") - ("log_sink2", po::value(&outputFile)->default_value(outputFile), "Second log sink, - for stdout") - ; - po::variables_map vm; - try { - po::store(po::command_line_parser(ut::framework::master_test_suite().argc, - ut::framework::master_test_suite().argv) - .options(extraOptions) - .run(), - vm); - po::notify(vm); - } - catch (const std::exception& e) { - std::cerr << "ERROR: " << e.what() << "\n" - << extraOptions << std::endl; - return false; - } - - if (vm.count("log_format2") == 0) { - // second logger is not configured - return true; - } - - std::shared_ptr formatter; - if (logger == "XML") { - formatter = std::make_shared(); - } - else if (logger == "HRF") { - formatter = std::make_shared(); - } - else { - std::cerr << "ERROR: only HRF or XML log formatter can be specified" << std::endl; - return false; - } - - std::shared_ptr output; - if (outputFile == "-") { - output = std::shared_ptr(&std::cout, std::bind([]{})); - } - else { - output = std::make_shared(outputFile.c_str()); - } - - auto multiFormatter = new ut::output::multi_log_formatter; - multiFormatter->add(formatter, output); - ut::unit_test_log.set_formatter(multiFormatter); - - return true; -} - -int -main(int argc, char* argv[]) -{ - return ::boost::unit_test::unit_test_main(&init_tests, argc, argv); -} - -#endif // BOOST_VERSION >= 106200 diff --git a/wscript b/wscript index 848dbf1..03a2995 100644 --- a/wscript +++ b/wscript @@ -8,9 +8,10 @@ APPNAME = 'ChronoSync' GIT_TAG_PREFIX = '' def options(opt): - opt.load(['compiler_c', 'compiler_cxx', 'gnu_dirs']) - opt.load(['default-compiler-flags', 'boost', 'doxygen', 'sphinx_build', - 'coverage', 'sanitizers'], + opt.load(['compiler_cxx', 'gnu_dirs']) + opt.load(['default-compiler-flags', + 'coverage', 'sanitizers', 'boost', + 'doxygen', 'sphinx_build'], tooldir=['.waf-tools']) optgrp = opt.add_option_group('ChronoSync Options') @@ -18,7 +19,7 @@ def options(opt): help='Build unit tests') def configure(conf): - conf.load(['compiler_c', 'compiler_cxx', 'gnu_dirs', + conf.load(['compiler_cxx', 'gnu_dirs', 'default-compiler-flags', 'boost', 'doxygen', 'sphinx_build'])