2 Commits

Author SHA1 Message Date
Davide Pesavento bb55addec0 ci: compile-check installed headers
Script copied from ndn-cxx with minor modifications

Change-Id: Ib2e82e97161078d653f965c769de149cc28c60dd
2021-02-10 13:50:23 -05:00
Davide Pesavento eeca59e0c3 Centralize/deduplicate some constants
Change-Id: I80c542abbf6d4978261c0f7e839bef2fb1fa3a91
2021-01-15 16:06:06 -05:00
7 changed files with 67 additions and 21 deletions
+8
View File
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -ex
PROJ=PSync
sudo rm -fr /usr/local/include/"$PROJ"
sudo rm -f /usr/local/lib{,64}/lib"$PROJ"*
sudo rm -f /usr/local/lib{,64}/pkgconfig/"$PROJ".pc
+45
View File
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
# It's intentional not to use `set -x`, because this script explicitly prints useful information
# and should not run in trace mode.
# It's intentional not to use `set -e`, because this script wants to check all headers
# (similar to running all test cases), instead of failing at the first error.
PROJ=PSync
if [[ -n $DISABLE_HEADERS_CHECK ]]; then
echo 'Skipping headers check.'
exit 0
fi
if has CentOS-8 $NODE_LABELS; then
export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig
fi
CXX=${CXX:-g++}
STD=-std=c++14
CXXFLAGS="-O2 -Wall -Wno-unneeded-internal-declaration -Wno-unused-const-variable $(pkg-config --cflags libndn-cxx $PROJ)"
INCLUDEDIR="$(pkg-config --variable=includedir $PROJ)"/$PROJ
echo "Using: $CXX $STD $CXXFLAGS"
NCHECKED=0
NERRORS=0
while IFS= read -r -d '' H; do
echo "Checking header ${H#${INCLUDEDIR}/}"
"$CXX" -xc++ $STD $CXXFLAGS -c -o /dev/null "$H"
[[ $? -eq 0 ]] || ((NERRORS++))
((NCHECKED++))
done < <(find "$INCLUDEDIR" -name '*.hpp' -type f -print0 2>/dev/null)
if [[ $NCHECKED -eq 0 ]]; then
echo "No headers found. Is $PROJ installed?"
exit 1
else
echo "$NCHECKED headers checked."
fi
if [[ $NERRORS -gt 0 ]]; then
echo "$NERRORS headers could not be compiled."
exit 1
fi
+9 -1
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2020, The University of Memphis
* Copyright (c) 2014-2021, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -23,6 +23,7 @@
#include "PSync/detail/config.hpp"
#include <ndn-cxx/name.hpp>
#include <ndn-cxx/util/time.hpp>
#include <cstddef>
#include <cstdint>
@@ -32,6 +33,13 @@
namespace psync {
using namespace ndn::time_literals;
const ndn::time::milliseconds HELLO_INTEREST_LIFETIME = 1_s;
const ndn::time::milliseconds HELLO_REPLY_FRESHNESS = 1_s;
const ndn::time::milliseconds SYNC_INTEREST_LIFETIME = 1_s;
const ndn::time::milliseconds SYNC_REPLY_FRESHNESS = 1_s;
enum class CompressionScheme {
NONE,
ZLIB,
+1 -7
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2020, The University of Memphis
* Copyright (c) 2014-2021, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -28,19 +28,13 @@
#include <ndn-cxx/util/random.hpp>
#include <ndn-cxx/util/scheduler.hpp>
#include <ndn-cxx/util/segment-fetcher.hpp>
#include <ndn-cxx/util/time.hpp>
#include <map>
namespace psync {
using namespace ndn::time_literals;
using ReceiveHelloCallback = std::function<void(const std::map<ndn::Name, uint64_t>&)>;
const ndn::time::milliseconds HELLO_INTEREST_LIFETIME = 1_s;
const ndn::time::milliseconds SYNC_INTEREST_LIFETIME = 1_s;
/**
* @brief Consumer logic to subscribe to producer's data
*
+2 -4
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2020, The University of Memphis
* Copyright (c) 2014-2021, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -29,8 +29,6 @@
namespace psync {
const ndn::time::milliseconds SYNC_INTEREST_LIFTIME = 1_s;
/**
* @brief Full sync logic to synchronize with other nodes
* where all nodes wants to get all names prefixes synced.
@@ -63,7 +61,7 @@ public:
const ndn::Name& syncPrefix,
const ndn::Name& userPrefix,
const UpdateCallback& onUpdateCallBack,
ndn::time::milliseconds syncInterestLifetime = SYNC_INTEREST_LIFTIME,
ndn::time::milliseconds syncInterestLifetime = SYNC_INTEREST_LIFETIME,
ndn::time::milliseconds syncReplyFreshness = SYNC_REPLY_FRESHNESS,
CompressionScheme ibltCompression = CompressionScheme::DEFAULT,
CompressionScheme contentCompression = CompressionScheme::DEFAULT);
+1 -4
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2020, The University of Memphis
* Copyright (c) 2014-2021, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -28,12 +28,9 @@
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/util/scheduler.hpp>
#include <ndn-cxx/util/time.hpp>
namespace psync {
const ndn::time::milliseconds HELLO_REPLY_FRESHNESS = 1_s;
/**
* @brief Partial sync logic to publish data names
*
+1 -5
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2020, The University of Memphis
* Copyright (c) 2014-2021, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -30,7 +30,6 @@
#include <ndn-cxx/security/validator-config.hpp>
#include <ndn-cxx/util/random.hpp>
#include <ndn-cxx/util/scheduler.hpp>
#include <ndn-cxx/util/time.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/unordered_set_of.hpp>
@@ -40,9 +39,6 @@
namespace psync {
namespace bm = boost::bimaps;
using namespace ndn::time_literals;
const ndn::time::milliseconds SYNC_REPLY_FRESHNESS = 1_s;
/**
* @brief Base class for PartialProducer and FullProducer