11 Commits

Author SHA1 Message Date
Davide Pesavento 9fa8ac31dc ci: add build testing against named-data PPA
Change-Id: Ifaed697f9b2b51bd561e735a6b399c8d54e71071
2023-11-25 21:48:07 -05:00
Davide Pesavento d45f888b9a Switch to Face::getIoContext()
Change-Id: I6c5242ead4dc6d5d37c0fa77c3e68a55d60a87bc
2023-11-11 17:32:23 -05:00
Davide Pesavento 1af7949d1b build: require boost >= 1.71.0
Refs: #5276
Change-Id: I287a52dab0212d1ce0da77afb563554214cac68a
2023-09-22 15:45:21 -04:00
Davide Pesavento 9330c2ee49 build: more accurate Boost lib dependencies
See also named-data/ndn-cxx@5686c51b87

Change-Id: I33cfbf95ed267c6a549a934185bcb610c0c34a80
2023-09-14 21:38:02 -04:00
Davide Pesavento 9f100b3fb1 build: update waf to version 2.0.26
Change-Id: I0f901f1c05376194fcc2595e9d081ca5739471c2
2023-08-19 02:02:24 -04:00
Davide Pesavento 97741e796d build: sync default build flags with ndn-cxx
Change-Id: I0610ade8e117eeedb53d40de1658444ac3e9f561
2023-08-12 16:36:07 -04:00
Davide Pesavento 48dbab6de8 tests: follow DummyClientFace namespace change
Change-Id: Ia2ca95d8621e264747b299d1ecd5405bca0dd5af
2023-08-12 16:06:52 -04:00
Davide Pesavento ebc0275572 tests: fix compilation with latest ndn-cxx
Change-Id: I32579dd584efee508c862b3d5f2f1bdad7487bab
2023-05-09 15:37:05 -04:00
Davide Pesavento ed77870ccc build: align minimum build requirements with ndn-cxx
Change-Id: I3aac15aa09e9dbd8ad666fe91e4a536a152ee0df
2023-04-26 15:31:31 -04:00
Davide Pesavento 2ff10561bd build: switch source archive to xz compression
Mention gerrit in the README

Change-Id: I468cedde1a15f760aef00ac2995dd5f73728b89e
2023-02-19 20:14:06 -05:00
Davide Pesavento 85601037ef ci: adopt reusable workflows from named-data/actions
Change-Id: I4219458d27723ee7c408a665f7b31a1ca557b1e0
2023-02-14 13:38:03 -05:00
22 changed files with 208 additions and 252 deletions
+9 -58
View File
@@ -1,65 +1,16 @@
name: CI
on:
push:
paths-ignore:
- 'docs/**'
- '*.md'
- '.mailmap'
workflow_dispatch:
permissions:
contents: read
permissions: {}
jobs:
linux:
name: ${{ matrix.compiler }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
compiler: [g++-7, g++-8, g++-9, g++-10,
clang++-7, clang++-8, clang++-9, clang++-10, clang++-11, clang++-12]
include:
- os: ubuntu-22.04
compiler: g++-11
- os: ubuntu-22.04
compiler: g++-12
- os: ubuntu-22.04
compiler: clang++-13
- os: ubuntu-22.04
compiler: clang++-14
env:
CXX: ${{ matrix.compiler }}
steps:
- name: Install C++ compiler
run: |
sudo apt-get -qy install ${CXX/clang++/clang}
${CXX} --version
- name: Checkout
uses: actions/checkout@v3
- name: Build and test
run: ./.jenkins
macos:
name: Xcode ${{ matrix.xcode }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-11]
xcode: ['12.4', '12.5', '13.2']
include:
- os: macos-12
xcode: '13.4'
- os: macos-12
xcode: '14.2'
steps:
- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode }}
- name: Checkout
uses: actions/checkout@v3
- name: Build and test
run: ./.jenkins
Ubuntu:
uses: named-data/actions/.github/workflows/jenkins-script-ubuntu.yml@v1
macOS:
uses: named-data/actions/.github/workflows/jenkins-script-macos.yml@v1
PPA:
uses: named-data/actions/.github/workflows/ppa.yml@v1
with:
extra-deps: libboost-iostreams-dev
+3 -26
View File
@@ -1,33 +1,10 @@
name: Docs
on:
push:
paths-ignore:
- '*.md'
- '.mailmap'
workflow_dispatch:
permissions:
contents: read
permissions: {}
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
env:
JOB_NAME: Docs
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: |
find .jenkins.d/ -type f -name '[1-9]*.sh' -exec chmod -x '{}' +
./.jenkins
- name: Build documentation
run: |
pybindir=$(python3 -c 'import sysconfig; print(sysconfig.get_path("scripts", "posix_user"))')
export PATH="${pybindir}${PATH:+:}${PATH}"
./waf --color=yes configure
./waf --color=yes docs
html:
uses: named-data/actions/.github/workflows/docs-html.yml@v1
+3
View File
@@ -32,6 +32,9 @@ if [[ $JOB_NAME == *"code-coverage" ]]; then
export DISABLE_HEADERS_CHECK=yes
fi
# https://reproducible-builds.org/docs/source-date-epoch/
export SOURCE_DATE_EPOCH=$(git log -1 --format=%ct)
for file in .jenkins.d/*; do
[[ -f $file && -x $file ]] || continue
+82 -64
View File
@@ -3,10 +3,12 @@
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 (-Og)')
def configure(conf):
conf.start_msg('Checking C++ compiler version')
@@ -18,19 +20,22 @@ def configure(conf):
if cxx == 'gcc':
if ccver < (7, 4, 0):
errmsg = ('The version of gcc you are using is too old.\n'
'The minimum supported gcc version is 7.4.')
'The minimum supported gcc version is 9.3.')
elif ccver < (9, 3, 0):
warnmsg = ('Using a version of gcc older than 9.3 is not '
'officially supported and may result in build failures.')
conf.flags = GccFlags()
elif cxx == 'clang':
if Utils.unversioned_sys_platform() == 'darwin':
if ccver < (10, 0, 0):
errmsg = ('The version of Xcode you are using is too old.\n'
'The minimum supported Xcode version is 11.3.')
elif ccver < (11, 0, 0):
warnmsg = ('Using a version of Xcode older than 11.3 is not '
'The minimum supported Xcode version is 12.4.')
elif ccver < (12, 0, 0):
warnmsg = ('Using a version of Xcode older than 12.4 is not '
'officially supported and may result in build failures.')
elif ccver < (6, 0, 0):
elif ccver < (7, 0, 0):
errmsg = ('The version of clang you are using is too old.\n'
'The minimum supported clang version is 6.0.')
'The minimum supported clang version is 7.0.')
conf.flags = ClangFlags()
else:
warnmsg = f'{cxx} compiler is unsupported'
@@ -45,7 +50,7 @@ def configure(conf):
else:
conf.end_msg(ccverstr)
conf.areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
conf.areCustomCxxflagsPresent = len(conf.env.CXXFLAGS) > 0
# General flags are always applied (e.g., selecting C++ language standard)
generalFlags = conf.flags.getGeneralFlags(conf)
@@ -53,6 +58,7 @@ def configure(conf):
conf.add_supported_linkflags(generalFlags['LINKFLAGS'])
conf.env.DEFINES += generalFlags['DEFINES']
@Configure.conf
def check_compiler_flags(conf):
# Debug or optimized CXXFLAGS and LINKFLAGS are applied only if the
@@ -75,10 +81,11 @@ def check_compiler_flags(conf):
conf.env.DEFINES += extraFlags['DEFINES']
@Configure.conf
def add_supported_cxxflags(self, cxxflags):
"""
Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable
Check which cxxflags are supported by the active compiler and add them to env.CXXFLAGS variable.
"""
if len(cxxflags) == 0:
return
@@ -94,10 +101,11 @@ def add_supported_cxxflags(self, cxxflags):
self.end_msg(' '.join(supportedFlags))
self.env.prepend_value('CXXFLAGS', supportedFlags)
@Configure.conf
def add_supported_linkflags(self, linkflags):
"""
Check which linkflags are supported by compiler and add them to env.LINKFLAGS variable
Check which linkflags are supported by the active compiler and add them to env.LINKFLAGS variable.
"""
if len(linkflags) == 0:
return
@@ -114,13 +122,17 @@ def add_supported_linkflags(self, linkflags):
self.env.prepend_value('LINKFLAGS', supportedFlags)
class CompilerFlags(object):
class CompilerFlags:
def getCompilerVersion(self, conf):
return tuple(int(i) for i in conf.env.CC_VERSION)
def getGeneralFlags(self, conf):
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are always needed"""
return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': []}
return {
'CXXFLAGS': [],
'LINKFLAGS': [],
'DEFINES': ['BOOST_ASIO_NO_DEPRECATED', 'BOOST_FILESYSTEM_NO_DEPRECATED'],
}
def getDebugFlags(self, conf):
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in debug mode"""
@@ -130,94 +142,100 @@ class CompilerFlags(object):
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in optimized mode"""
return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': ['NDEBUG']}
class GccBasicFlags(CompilerFlags):
class GccClangCommonFlags(CompilerFlags):
"""
This class defines basic flags that work for both gcc and clang compilers
This class defines common flags that work for both gcc and clang compilers.
"""
def getGeneralFlags(self, conf):
flags = super(GccBasicFlags, self).getGeneralFlags(conf)
flags = super().getGeneralFlags(conf)
flags['CXXFLAGS'] += ['-std=c++17']
if Utils.unversioned_sys_platform() != 'darwin':
flags['LINKFLAGS'] += ['-fuse-ld=lld']
return flags
__cxxFlags = [
'-fdiagnostics-color',
'-Wall',
'-Wextra',
'-Wpedantic',
'-Wenum-conversion',
'-Wextra-semi',
'-Wnon-virtual-dtor',
'-Wno-unused-parameter',
]
__linkFlags = ['-Wl,-O1']
def getDebugFlags(self, conf):
flags = super(GccBasicFlags, self).getDebugFlags(conf)
flags['CXXFLAGS'] += ['-Og',
'-g3',
'-Wall',
'-Wextra',
'-Wpedantic',
'-Werror',
'-Wcatch-value=2',
'-Wextra-semi',
'-Wnon-virtual-dtor',
'-Wno-error=deprecated-declarations', # Bug #3795
'-Wno-error=maybe-uninitialized', # Bug #1615
'-Wno-unused-parameter',
]
flags['LINKFLAGS'] += ['-Wl,-O1']
flags = super().getDebugFlags(conf)
flags['CXXFLAGS'] += ['-Og', '-g'] + self.__cxxFlags + [
'-Werror',
'-Wno-error=deprecated-declarations', # Bug #3795
'-Wno-error=maybe-uninitialized', # Bug #1615
]
flags['LINKFLAGS'] += self.__linkFlags
return flags
def getOptimizedFlags(self, conf):
flags = super(GccBasicFlags, self).getOptimizedFlags(conf)
flags['CXXFLAGS'] += ['-O2',
'-g',
'-Wall',
'-Wextra',
'-Wpedantic',
'-Wcatch-value=2',
'-Wextra-semi',
'-Wnon-virtual-dtor',
'-Wno-unused-parameter',
]
flags['LINKFLAGS'] += ['-Wl,-O1']
flags = super().getOptimizedFlags(conf)
flags['CXXFLAGS'] += ['-O2', '-g1'] + self.__cxxFlags
flags['LINKFLAGS'] += self.__linkFlags
return flags
class GccFlags(GccBasicFlags):
class GccFlags(GccClangCommonFlags):
__cxxFlags = [
'-Wcatch-value=2',
'-Wcomma-subscript', # enabled by default in C++20
'-Wduplicated-branches',
'-Wduplicated-cond',
'-Wlogical-op',
'-Wredundant-tags',
'-Wvolatile', # enabled by default in C++20
]
def getDebugFlags(self, conf):
flags = super(GccFlags, self).getDebugFlags(conf)
flags['CXXFLAGS'] += ['-fdiagnostics-color',
'-Wredundant-tags',
]
flags = super().getDebugFlags(conf)
flags['CXXFLAGS'] += self.__cxxFlags
if platform.machine() == 'armv7l':
flags['CXXFLAGS'] += ['-Wno-psabi'] # Bug #5106
return flags
def getOptimizedFlags(self, conf):
flags = super(GccFlags, self).getOptimizedFlags(conf)
flags['CXXFLAGS'] += ['-fdiagnostics-color',
'-Wredundant-tags',
]
flags = super().getOptimizedFlags(conf)
flags['CXXFLAGS'] += self.__cxxFlags
if platform.machine() == 'armv7l':
flags['CXXFLAGS'] += ['-Wno-psabi'] # Bug #5106
return flags
class ClangFlags(GccBasicFlags):
class ClangFlags(GccClangCommonFlags):
def getGeneralFlags(self, conf):
flags = super(ClangFlags, self).getGeneralFlags(conf)
flags = super().getGeneralFlags(conf)
if Utils.unversioned_sys_platform() == 'darwin':
# Bug #4296
brewdir = '/opt/homebrew' if platform.machine() == 'arm64' else '/usr/local'
flags['CXXFLAGS'] += [['-isystem', f'{brewdir}/include'], # for Homebrew
['-isystem', '/opt/local/include']] # for MacPorts
flags['CXXFLAGS'] += [
['-isystem', f'{brewdir}/include'], # for Homebrew
['-isystem', '/opt/local/include'], # for MacPorts
]
elif Utils.unversioned_sys_platform() == 'freebsd':
# Bug #4790
flags['CXXFLAGS'] += [['-isystem', '/usr/local/include']]
return flags
__cxxFlags = [
'-Wundefined-func-template',
'-Wno-unused-local-typedef', # Bugs #2657 and #3209
]
def getDebugFlags(self, conf):
flags = super(ClangFlags, self).getDebugFlags(conf)
flags['CXXFLAGS'] += ['-fcolor-diagnostics',
'-Wundefined-func-template',
'-Wno-unused-local-typedef', # Bugs #2657 and #3209
]
flags = super().getDebugFlags(conf)
flags['CXXFLAGS'] += self.__cxxFlags
return flags
def getOptimizedFlags(self, conf):
flags = super(ClangFlags, self).getOptimizedFlags(conf)
flags['CXXFLAGS'] += ['-fcolor-diagnostics',
'-Wundefined-func-template',
'-Wno-unused-local-typedef', # Bugs #2657 and #3209
]
flags = super().getOptimizedFlags(conf)
flags['CXXFLAGS'] += self.__cxxFlags
return flags
+1 -1
View File
@@ -2,7 +2,7 @@
The following lists maintainers, primary developers, and all much-appreciated contributors to ChronoSync in alphabetical order.
The specific contributions of individual authors can be obtained from the git history of the [official ChronoSync repository](https://github.com/named-data/ChronoSync).
If you would like to become a contributor to the official repository, please follow the recommendations in <https://github.com/named-data/.github/blob/master/CONTRIBUTING.md>.
If you would like to become a contributor to the official repository, please follow the recommendations in <https://github.com/named-data/.github/blob/main/CONTRIBUTING.md>.
* ***(Maintainer)*** Alexander Afanasyev <https://users.cs.fiu.edu/~afanasyev>
* Chaoyi Bian <https://github.com/bcy>
+12 -13
View File
@@ -5,7 +5,7 @@
![Language](https://img.shields.io/badge/C%2B%2B-17-blue)
![Latest version](https://img.shields.io/github/v/tag/named-data/ChronoSync?label=Latest%20version)
> DEPRECATION NOTICE: ChronoSync's design is outdated. We recommend using more recent sync protocols, such as [PSync](https://named-data.net/doc/PSync/current/) or [StateVectorSync](https://named-data.github.io/StateVectorSync/).
> DEPRECATION NOTICE: ChronoSync's design is outdated. We recommend using more recent sync protocols, such as [PSync](https://github.com/named-data/PSync) or [StateVectorSync](https://named-data.github.io/StateVectorSync/).
In supporting many distributed applications, such as group text messaging, file sharing,
and joint editing, a basic requirement is the efficient and robust synchronization of
@@ -26,21 +26,21 @@ ChronoSync uses the [ndn-cxx](https://github.com/named-data/ndn-cxx) library.
### Prerequisites
* [ndn-cxx and its dependencies](https://named-data.net/doc/ndn-cxx/current/INSTALL.html)
* [ndn-cxx and its dependencies](https://docs.named-data.net/ndn-cxx/current/INSTALL.html)
### Build
To build ChronoSync from the source:
To build ChronoSync from source:
./waf configure
./waf
sudo ./waf install
To build on memory constrained platform, please use `./waf -j1` instead of `./waf`. The
command will disable parallel compilation.
To build on memory constrained systems, please use `./waf -j1` instead of `./waf`. This
will disable parallel compilation.
If configured with tests (`./waf configure --with-tests`), the above commands will also
generate unit tests that can be run with `./build/unit-tests`.
build a suite of unit tests that can be run with `./build/unit-tests`.
## Reporting bugs
@@ -49,13 +49,12 @@ Please submit any bug reports or feature requests to the
## Contributing
We greatly appreciate contributions to the ChronoSync code base, provided that they are
licensed under the GPL 3.0+ or a compatible license (see below).
If you are new to the NDN software community, please read the
[Contributor's Guide](https://github.com/named-data/.github/blob/master/CONTRIBUTING.md)
to get started.
Contributions to ChronoSync are greatly appreciated and can be made through our
[Gerrit code review site](https://gerrit.named-data.net/).
If you are new to the NDN software community, please read our [Contributor's Guide](
https://github.com/named-data/.github/blob/main/CONTRIBUTING.md) to get started.
## License
ChronoSync is an open source project licensed under the GPL version 3.
See [`COPYING.md`](COPYING.md) for more information.
ChronoSync is free software distributed under the GNU General Public License version 3.
See [`COPYING.md`](COPYING.md) for details.
+1 -1
View File
@@ -10,7 +10,7 @@ import sys
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = 'ChronoSync: A Synchronization Protocol for NDN'
copyright = 'Copyright © 2012-2022 Regents of the University of California.'
copyright = 'Copyright © 2012-2023 Regents of the University of California.'
author = 'Named Data Networking Project'
# The short X.Y version.
+5 -5
View File
@@ -140,7 +140,7 @@ INLINE_INHERITED_MEMB = YES
# shortest path that makes the file name unique will be used
# The default value is: YES.
FULL_PATH_NAMES = NO
FULL_PATH_NAMES = YES
# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
# Stripping is only done if one of the specified strings matches the left-hand
@@ -161,7 +161,7 @@ STRIP_FROM_PATH =
# specify the list of include paths that are normally passed to the compiler
# using the -I flag.
STRIP_FROM_INC_PATH =
STRIP_FROM_INC_PATH = ..
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
# less readable) file names. This can be useful is your file systems doesn't
@@ -437,7 +437,7 @@ EXTRACT_PACKAGE = NO
# included in the documentation.
# The default value is: NO.
EXTRACT_STATIC = YES
EXTRACT_STATIC = NO
# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
# locally in source files will be included in the documentation. If set to NO,
@@ -445,7 +445,7 @@ EXTRACT_STATIC = YES
# for Java sources.
# The default value is: YES.
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_CLASSES = NO
# This flag is only useful for Objective-C code. If set to YES, local methods,
# which are defined in the implementation section but not in the interface are
@@ -1178,7 +1178,7 @@ HTML_COLORSTYLE_GAMMA = 91
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_TIMESTAMP = YES
HTML_TIMESTAMP = NO
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
# documentation will contain sections that can be hidden and shown after the
+2 -1
View File
@@ -23,4 +23,5 @@ License
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.
version 3 of the License, or (at your option) any later version. See `COPYING.md
<https://github.com/named-data/ChronoSync/blob/master/COPYING.md>`__ for details.
+2 -2
View File
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012-2019 University of California, Los Angeles
* Copyright (c) 2012-2023 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -26,7 +26,7 @@
namespace chronosync {
InterestTable::InterestTable(boost::asio::io_service& io)
InterestTable::InterestTable(boost::asio::io_context& io)
: m_scheduler(io)
{
}
+4 -4
View File
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012-2021 University of California, Los Angeles
* Copyright (c) 2012-2023 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -27,12 +27,12 @@
#include "interest-container.hpp"
#include <boost/asio/io_service.hpp>
#include <boost/asio/io_context.hpp>
namespace chronosync {
/**
* @brief A table to keep unsatisfied Sync Interest
* @brief A table to keep unsatisfied Sync Interests.
*/
class InterestTable : noncopyable
{
@@ -47,7 +47,7 @@ public:
using const_iterator = InterestContainer::const_iterator;
explicit
InterestTable(boost::asio::io_service& io);
InterestTable(boost::asio::io_context& io);
~InterestTable();
+3 -3
View File
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012-2022 University of California, Los Angeles
* Copyright (c) 2012-2023 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -101,11 +101,11 @@ Logic::Logic(ndn::Face& face,
, m_syncPrefix(syncPrefix)
, m_syncReset(Name(syncPrefix).append("reset"))
, m_defaultUserPrefix(defaultUserPrefix)
, m_interestTable(m_face.getIoService())
, m_interestTable(m_face.getIoContext())
, m_isInReset(false)
, m_needPeriodReset(resetTimer > time::nanoseconds::zero())
, m_onUpdate(onUpdate)
, m_scheduler(m_face.getIoService())
, m_scheduler(m_face.getIoContext())
, m_rng(ndn::random::getRandomNumberEngine())
, m_rangeUniformRandom(100, 500)
, m_reexpressionJitter(100, 500)
+2 -2
View File
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012-2022 University of California, Los Angeles
* Copyright (c) 2012-2023 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -53,7 +53,7 @@ IdentityManagementFixture::addIdentity(const Name& identity, const ndn::KeyParam
bool
IdentityManagementFixture::saveIdentityCertificate(const Name& identity, const std::string& filename, bool wantAdd)
{
ndn::security::v2::Certificate cert;
ndn::security::Certificate cert;
try {
cert = m_keyChain.getPib().getIdentity(identity).getDefaultKey().getDefaultCertificate();
}
+7 -6
View File
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012-2022 University of California, Los Angeles
* Copyright (c) 2012-2023 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -22,7 +22,7 @@
#include <ndn-cxx/util/time-unit-test-clock.hpp>
#include <boost/asio.hpp>
#include <boost/asio/io_context.hpp>
namespace ndn::tests {
@@ -42,14 +42,15 @@ public:
}
void
advanceClocks(const time::nanoseconds& tick, size_t nTicks = 1)
advanceClocks(time::nanoseconds tick, size_t nTicks = 1)
{
for (size_t i = 0; i < nTicks; ++i) {
steadyClock->advance(tick);
systemClock->advance(tick);
if (io.stopped())
io.reset();
if (io.stopped()) {
io.restart();
}
io.poll();
}
}
@@ -57,7 +58,7 @@ public:
public:
shared_ptr<time::UnitTestSteadyClock> steadyClock;
shared_ptr<time::UnitTestSystemClock> systemClock;
boost::asio::io_service io;
boost::asio::io_context io;
};
} // namespace ndn::tests
+11 -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-2023 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -19,12 +19,13 @@
#include "dummy-forwarder.hpp"
#include <boost/asio/io_service.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/post.hpp>
namespace ndn {
namespace chronosync {
DummyForwarder::DummyForwarder(boost::asio::io_service& io, KeyChain& keyChain)
DummyForwarder::DummyForwarder(boost::asio::io_context& io, KeyChain& keyChain)
: m_io(io)
, m_keyChain(keyChain)
{
@@ -33,25 +34,26 @@ DummyForwarder::DummyForwarder(boost::asio::io_service& io, KeyChain& keyChain)
Face&
DummyForwarder::addFace()
{
auto face = std::make_shared<util::DummyClientFace>(m_io, m_keyChain,
util::DummyClientFace::Options{true, true});
util::DummyClientFace* self = &*face; // to prevent memory leak
auto face = std::make_shared<DummyClientFace>(m_io, m_keyChain, DummyClientFace::Options{true, true});
DummyClientFace* self = &*face; // to prevent memory leak
face->onSendInterest.connect([this, self] (const Interest& interest) {
Interest i(interest);
for (auto& otherFace : m_faces) {
if (self == &*otherFace) {
continue;
}
m_io.post([=] { otherFace->receive(i); });
boost::asio::post(m_io, [=] { otherFace->receive(i); });
}
});
face->onSendData.connect([this, self] (const Data& data) {
Data d(data);
for (auto& otherFace : m_faces) {
if (self == &*otherFace) {
continue;
}
m_io.post([=] { otherFace->receive(d); });
boost::asio::post(m_io, [=] { otherFace->receive(d); });
}
});
@@ -61,7 +63,7 @@ DummyForwarder::addFace()
if (self == &*otherFace) {
continue;
}
m_io.post([=] { otherFace->receive(n); });
boost::asio::post(m_io, [=] { otherFace->receive(n); });
}
});
+6 -6
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-2023 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -17,11 +17,11 @@
* ChronoSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
#include <ndn-cxx/interest.hpp>
#include <ndn-cxx/data.hpp>
#include <ndn-cxx/interest.hpp>
#include <ndn-cxx/lp/nack.hpp>
#include <ndn-cxx/util/dummy-client-face.hpp>
#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/util/dummy-client-face.hpp>
#ifndef NDN_CHRONOSYNC_UNIT_TESTS_DUMMY_FORWARDER_HPP
#define NDN_CHRONOSYNC_UNIT_TESTS_DUMMY_FORWARDER_HPP
@@ -38,7 +38,7 @@ namespace chronosync {
class DummyForwarder
{
public:
DummyForwarder(boost::asio::io_service& io, KeyChain& keyChain);
DummyForwarder(boost::asio::io_context& io, KeyChain& keyChain);
Face&
addFace();
@@ -53,9 +53,9 @@ public:
removeFaces();
private:
boost::asio::io_service& m_io;
boost::asio::io_context& m_io;
KeyChain& m_keyChain;
std::vector<shared_ptr<util::DummyClientFace>> m_faces;
std::vector<std::shared_ptr<DummyClientFace>> m_faces;
};
} // namespace chronosync
+5 -5
View File
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012-2022 University of California, Los Angeles
* Copyright (c) 2012-2023 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -100,7 +100,7 @@ BOOST_AUTO_TEST_CASE(Constructor)
{
Name syncPrefix("/ndn/broadcast/sync");
Name userPrefix("/user");
ndn::util::DummyClientFace face(io, {true, true});
ndn::DummyClientFace face(io, {true, true});
BOOST_REQUIRE_NO_THROW(Logic(face, syncPrefix, userPrefix, bind(onUpdate, _1)));
}
@@ -363,14 +363,14 @@ BOOST_AUTO_TEST_CASE(CancelOutstandingEvents)
systemClock->advance(ndn::time::hours(1));
BOOST_CHECK_EQUAL(io.poll(), 0); // no delayed handlers are expected
BOOST_CHECK_EQUAL(io.stopped(), true); // io_service expected to be stopped
BOOST_CHECK_EQUAL(io.stopped(), true); // io_context expected to be stopped
}
BOOST_FIXTURE_TEST_CASE(TrimState, ndn::tests::IdentityManagementTimeFixture)
{
Name syncPrefix("/ndn/broadcast/sync");
Name userPrefix("/user");
ndn::util::DummyClientFace face;
ndn::DummyClientFace face;
Logic logic(face, syncPrefix, userPrefix, bind(onUpdate, _1));
State state;
@@ -397,7 +397,7 @@ BOOST_FIXTURE_TEST_CASE(VeryLargeState, ndn::tests::IdentityManagementTimeFixtur
addIdentity("/bla");
Name syncPrefix("/ndn/broadcast/sync");
Name userPrefix("/user");
ndn::util::DummyClientFace face;
ndn::DummyClientFace face;
Logic logic(face, syncPrefix, userPrefix, bind(onUpdate, _1));
State state;
+2 -2
View File
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012-2022 University of California, Los Angeles
* Copyright (c) 2012-2023 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -72,7 +72,7 @@ public:
Name syncPrefix;
Name userPrefix[3];
boost::asio::io_service io;
boost::asio::io_context io;
shared_ptr<ndn::Face> face;
ndn::Scheduler scheduler;
shared_ptr<Handler> handler;
+6 -7
View File
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012-2022 University of California, Los Angeles
* Copyright (c) 2012-2023 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -28,7 +28,6 @@ namespace chronosync {
namespace test {
using std::string;
using ndn::util::DummyClientFace;
/**
* @brief Emulate an app that use the Socket class
@@ -41,7 +40,7 @@ class SocketTestApp : noncopyable
public:
SocketTestApp(const Name& syncPrefix,
const Name& userPrefix,
DummyClientFace& face,
ndn::DummyClientFace& face,
bool isNum)
: sum(0)
, socket(syncPrefix,
@@ -155,9 +154,9 @@ public:
userPrefix[1] = Name("/user1");
userPrefix[2] = Name("/user2");
faces[0].reset(new DummyClientFace(io, {true, true}));
faces[1].reset(new DummyClientFace(io, {true, true}));
faces[2].reset(new DummyClientFace(io, {true, true}));
faces[0].reset(new ndn::DummyClientFace(io, {true, true}));
faces[1].reset(new ndn::DummyClientFace(io, {true, true}));
faces[2].reset(new ndn::DummyClientFace(io, {true, true}));
for (int i = 0; i < 3; i++) {
readInterestOffset[i] = 0;
@@ -239,7 +238,7 @@ public:
Name userPrefix[3];
Name sessionName[3];
std::unique_ptr<DummyClientFace> faces[3];
std::unique_ptr<ndn::DummyClientFace> faces[3];
shared_ptr<SocketTestApp> app[3];
size_t readInterestOffset[3];
+7 -6
View File
@@ -3,9 +3,10 @@
top = '..'
def build(bld):
bld.program(target='../unit-tests',
name='unit-tests',
source=bld.path.ant_glob('**/*.cpp'),
use='ChronoSync',
includes='..',
install_path=None)
bld.program(
target=f'{top}/unit-tests',
name='unit-tests',
source=bld.path.ant_glob('**/*.cpp'),
use='BOOST_TESTS ChronoSync',
includes=top,
install_path=None)
Vendored
+7 -7
View File
File diff suppressed because one or more lines are too long
+28 -24
View File
@@ -1,7 +1,8 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
from waflib import Context, Logs, Utils
import os, subprocess
import os
import subprocess
from waflib import Context, Logs
VERSION = '0.5.5'
APPNAME = 'ChronoSync'
@@ -36,11 +37,14 @@ def configure(conf):
conf.check_cfg(package='libndn-cxx', args=['libndn-cxx >= 0.8.1', '--cflags', '--libs'],
uselib_store='NDN_CXX', pkg_config_path=pkg_config_path)
boost_libs = ['system', 'iostreams']
if conf.env.WITH_TESTS:
boost_libs.append('unit_test_framework')
conf.check_boost(lib='iostreams', mt=True)
if conf.env.BOOST_VERSION_NUMBER < 107100:
conf.fatal('The minimum supported version of Boost is 1.71.0.\n'
'Please upgrade your distribution or manually install a newer version of Boost.\n'
'For more information, see https://redmine.named-data.net/projects/nfd/wiki/Boost')
conf.check_boost(lib=boost_libs, mt=True)
if conf.env.WITH_TESTS:
conf.check_boost(lib='filesystem unit_test_framework', mt=True, uselib_store='BOOST_TESTS')
conf.check_compiler_flags()
@@ -61,27 +65,25 @@ def configure(conf):
conf.write_config_header('src/detail/config.hpp', define_prefix='CHRONOSYNC_')
def build(bld):
bld.shlib(target='ChronoSync',
vnum=VERSION,
cnum=VERSION,
source=bld.path.ant_glob('src/**/*.cpp'),
use='NDN_CXX BOOST',
includes='src/detail',
export_includes='src src/detail')
bld.shlib(
target='ChronoSync',
vnum=VERSION,
cnum=VERSION,
source=bld.path.ant_glob('src/**/*.cpp'),
use='BOOST NDN_CXX',
includes='src/detail',
export_includes='src src/detail')
if bld.env.WITH_TESTS:
bld.recurse('tests')
# Install header files
srcdir = bld.path.find_dir('src')
bld.install_files('${INCLUDEDIR}/ChronoSync',
srcdir.ant_glob('**/*.hpp'),
cwd=srcdir,
relative_trick=True)
bld.install_files('${INCLUDEDIR}/ChronoSync',
'src/detail/config.hpp',
cwd=bld.path.get_bld().find_dir('src'),
relative_trick=True)
bld.install_files('${INCLUDEDIR}/ChronoSync/detail', 'src/detail/config.hpp')
bld(features='subst',
source='ChronoSync.pc.in',
@@ -140,16 +142,16 @@ def version(ctx):
# first, try to get a version string from git
gotVersionFromGit = False
try:
cmd = ['git', 'describe', '--always', '--match', '%s*' % GIT_TAG_PREFIX]
out = subprocess.check_output(cmd, universal_newlines=True).strip()
cmd = ['git', 'describe', '--always', '--match', f'{GIT_TAG_PREFIX}*']
out = subprocess.run(cmd, capture_output=True, check=True, text=True).stdout.strip()
if out:
gotVersionFromGit = True
if out.startswith(GIT_TAG_PREFIX):
Context.g_module.VERSION = out.lstrip(GIT_TAG_PREFIX)
else:
# no tags matched
Context.g_module.VERSION = '%s-commit-%s' % (VERSION_BASE, out)
except (OSError, subprocess.CalledProcessError):
Context.g_module.VERSION = f'{VERSION_BASE}-commit-{out}'
except (OSError, subprocess.SubprocessError):
pass
versionFile = ctx.path.find_node('VERSION.info')
@@ -167,17 +169,19 @@ def version(ctx):
# already up-to-date
return
except EnvironmentError as e:
Logs.warn('%s exists but is not readable (%s)' % (versionFile, e.strerror))
Logs.warn(f'{versionFile} exists but is not readable ({e.strerror})')
else:
versionFile = ctx.path.make_node('VERSION.info')
try:
versionFile.write(Context.g_module.VERSION)
except EnvironmentError as e:
Logs.warn('%s is not writable (%s)' % (versionFile, e.strerror))
Logs.warn(f'{versionFile} is not writable ({e.strerror})')
def dist(ctx):
ctx.algo = 'tar.xz'
version(ctx)
def distcheck(ctx):
ctx.algo = 'tar.xz'
version(ctx)