build: align minimum build dependencies with ndn-cxx

* Recommend gcc >= 7.4.0
 * Require clang >= 4.0, or Xcode >= 9.0 on macOS
 * Silence an ABI-related diagnostic message from gcc on armv7
 * Update Travis CI job matrix

Refs: #5087, #5106
Change-Id: I71aef00147a7ad93b537904bb309745fed77f509
This commit is contained in:
Davide Pesavento
2020-07-15 21:17:04 -04:00
parent cc6f67cec9
commit 5f408ae7f5
11 changed files with 85 additions and 405 deletions
+1 -1
View File
@@ -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
+1 -5
View File
@@ -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
+3 -21
View File
@@ -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
+6
View File
@@ -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
+34 -23
View File
@@ -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
+1 -2
View File
@@ -57,9 +57,8 @@
#include <boost/algorithm/string.hpp>
#include <boost/asio.hpp>
#include <boost/assert.hpp>
#include <boost/foreach.hpp>
#include <boost/core/noncopyable.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/noncopyable.hpp>
namespace chronosync {
+4 -6
View File
@@ -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<DiffState>();
@@ -502,7 +502,7 @@ Logic::processSyncData(const Name& name, ConstBufferPtr digest, const Block& syn
reply.wireDecode(syncReply);
std::vector<MissingDataInfo> v;
BOOST_FOREACH(ConstLeafPtr leaf, reply.getLeaves().get<ordered>()) {
for (const auto& leaf : reply.getLeaves().get<ordered>()) {
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});
}
}
+22 -27
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-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 <boost/range/adaptor/reversed.hpp>
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<ordered>())
{
BOOST_ASSERT(leaf != 0);
m_digest.update(leaf->getDigest()->data(), leaf->getDigest()->size());
}
for (const auto& leaf : m_leaves.get<ordered>()) {
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<T>& block) const
{
size_t totalLength = 0;
BOOST_REVERSE_FOREACH (ConstLeafPtr leaf, m_leaves.get<ordered>())
{
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<ordered>() | 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++;
-214
View File
@@ -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 <boost/version.hpp>
#if BOOST_VERSION >= 105900
#include <boost/test/unit_test_parameters.hpp>
#else
#include <boost/test/detail/unit_test_parameters.hpp>
#endif // BOOST_VERSION >= 105900
#include <boost/test/unit_test_log_formatter.hpp>
#include <boost/test/output/compiler_log_formatter.hpp>
#include <boost/test/output/xml_log_formatter.hpp>
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<boost::unit_test::output::xml_log_formatter>(),
* std::make_shared<std::ofstream>("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<output_format>(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<compiler_log_formatter>(), nullptr});
break;
#if BOOST_VERSION >= 105900
case OF_XML:
#else
case XML:
#endif // BOOST_VERSION >= 105900
m_loggers.push_back({std::make_shared<xml_log_formatter>(), nullptr});
break;
}
}
void
add(std::shared_ptr<unit_test_log_formatter> formatter, std::shared_ptr<std::ostream> 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<unit_test_log_formatter> logger;
std::shared_ptr<std::ostream> os;
};
std::vector<LoggerInfo> m_loggers;
};
} // namespace output
} // namespace unit_test
} // namespace boost
#endif // NDN_TESTS_BOOST_MULTI_LOG_FORMATTER_HPP
+8 -102
View File
@@ -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 <http://www.gnu.org/licenses/>.
* ChronoSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
#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 "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 <boost/program_options/options_description.hpp>
#include <boost/program_options/variables_map.hpp>
#include <boost/program_options/parsers.hpp>
#include <fstream>
#include <iostream>
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<std::string>(&logger), "Type of second log formatter: HRF or XML")
("log_sink2", po::value<std::string>(&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<ut::unit_test_log_formatter> formatter;
if (logger == "XML") {
formatter = std::make_shared<ut::output::xml_log_formatter>();
}
else if (logger == "HRF") {
formatter = std::make_shared<ut::output::compiler_log_formatter>();
}
else {
std::cerr << "ERROR: only HRF or XML log formatter can be specified" << std::endl;
return false;
}
std::shared_ptr<std::ostream> output;
if (outputFile == "-") {
output = std::shared_ptr<std::ostream>(&std::cout, std::bind([]{}));
}
else {
output = std::make_shared<std::ofstream>(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
+5 -4
View File
@@ -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'])