Permalink
Browse files

Merge pull request #1501 from peternewman/master-resync

Master resync
  • Loading branch information...
peternewman committed Oct 27, 2018
2 parents 5813fda + f034c40 commit b31846b81ab44496f5a9f909d818b23156f6cfe9
@@ -48,11 +48,15 @@ BLACKLIST
if [[ $TASK = 'lint' ]]; then
# run the lint tool only if it is the requested task
travis_fold start "autoreconf"
autoreconf -i;
travis_fold end "autoreconf"
./configure --enable-rdm-tests --enable-ja-rule --enable-e133;
# the following is a bit of a hack to build the files normally built during
# the build, so they are present for linting to run against
make builtfiles
travis_fold start "make_builtfiles"
make builtfiles;
travis_fold end "make_builtfiles"
# first check we've not got any generic NOLINTs
# count the number of generic NOLINTs
nolints=$(grep -IR NOLINT * | grep -v "NOLINT(" | wc -l)
@@ -83,22 +87,34 @@ if [[ $TASK = 'lint' ]]; then
fi;
elif [[ $TASK = 'check-licences' ]]; then
# check licences only if it is the requested task
travis_fold start "autoreconf"
autoreconf -i;
travis_fold end "autoreconf"
travis_fold start "configure"
./configure --enable-rdm-tests --enable-ja-rule --enable-e133;
travis_fold end "configure"
# the following is a bit of a hack to build the files normally built during
# the build, so they are present for licence checking to run against
make builtfiles
travis_fold start "make_builtfiles"
make builtfiles;
travis_fold end "make_builtfiles"
./scripts/enforce_licence.py
if [[ $? -ne 0 ]]; then
exit 1;
fi;
elif [[ $TASK = 'spellintian' ]]; then
# run spellintian only if it is the requested task, ignoring duplicate words
travis_fold start "autoreconf"
autoreconf -i;
travis_fold end "autoreconf"
travis_fold start "configure"
./configure --enable-rdm-tests --enable-ja-rule --enable-e133;
travis_fold end "configure"
# the following is a bit of a hack to build the files normally built during
# the build, so they are present for spellintian to run against
make builtfiles
travis_fold start "make_builtfiles"
make builtfiles;
travis_fold end "make_builtfiles"
spellingfiles=$(eval "find ./ -type f -and ! \( \
$SPELLINGBLACKLIST \
\) | xargs")
@@ -114,11 +130,17 @@ elif [[ $TASK = 'spellintian' ]]; then
fi;
elif [[ $TASK = 'spellintian-duplicates' ]]; then
# run spellintian only if it is the requested task
travis_fold start "autoreconf"
autoreconf -i;
travis_fold end "autoreconf"
travis_fold start "configure"
./configure --enable-rdm-tests --enable-ja-rule --enable-e133;
travis_fold end "configure"
# the following is a bit of a hack to build the files normally built during
# the build, so they are present for spellintian to run against
make builtfiles
travis_fold start "make_builtfiles"
make builtfiles;
travis_fold end "make_builtfiles"
spellingfiles=$(eval "find ./ -type f -and ! \( \
$SPELLINGBLACKLIST \
\) | xargs")
@@ -134,11 +156,17 @@ elif [[ $TASK = 'spellintian-duplicates' ]]; then
fi;
elif [[ $TASK = 'codespell' ]]; then
# run codespell only if it is the requested task
travis_fold start "autoreconf"
autoreconf -i;
travis_fold end "autoreconf"
travis_fold start "configure"
./configure --enable-rdm-tests --enable-ja-rule --enable-e133;
travis_fold end "configure"
# the following is a bit of a hack to build the files normally built during
# the build, so they are present for codespell to run against
make builtfiles
travis_fold start "make_builtfiles"
make builtfiles;
travis_fold end "make_builtfiles"
spellingfiles=$(eval "find ./ -type f -and ! \( \
$SPELLINGBLACKLIST \
\) | xargs")
@@ -154,12 +182,18 @@ elif [[ $TASK = 'codespell' ]]; then
fi;
elif [[ $TASK = 'doxygen' ]]; then
# check doxygen only if it is the requested task
travis_fold start "autoreconf"
autoreconf -i;
travis_fold end "autoreconf"
# Doxygen is C++ only, so don't bother with RDM tests
travis_fold start "configure"
./configure --enable-ja-rule --enable-e133;
travis_fold end "configure"
# the following is a bit of a hack to build the files normally built during
# the build, so they are present for Doxygen to run against
make builtfiles
travis_fold start "make_builtfiles"
make builtfiles;
travis_fold end "make_builtfiles"
# count the number of warnings
warnings=$(make doxygen-doc 2>&1 >/dev/null | wc -l)
if [[ $warnings -ne 0 ]]; then
@@ -172,11 +206,19 @@ elif [[ $TASK = 'doxygen' ]]; then
fi;
elif [[ $TASK = 'coverage' ]]; then
# Compile with coverage for coveralls
travis_fold start "autoreconf"
autoreconf -i;
travis_fold end "autoreconf"
# Coverage is C++ only, so don't bother with RDM tests
travis_fold start "configure"
./configure --enable-gcov --enable-ja-rule --enable-e133;
travis_fold end "configure"
travis_fold start "make"
make;
travis_fold end "make"
travis_fold start "make_check"
make check;
travis_fold end "make_check"
elif [[ $TASK = 'coverity' ]]; then
# Run Coverity Scan unless token is zero length
# The Coverity Scan script also relies on a number of other COVERITY_SCAN_
@@ -188,50 +230,91 @@ elif [[ $TASK = 'coverity' ]]; then
fi;
elif [[ $TASK = 'jshint' ]]; then
cd ./javascript/new-src;
travis_fold start "npm_install"
npm install;
travis_fold end "npm_install"
grunt test
elif [[ $TASK = 'flake8' ]]; then
travis_fold start "autoreconf"
autoreconf -i;
./configure --enable-rdm-tests
travis_fold end "autoreconf"
travis_fold start "configure"
./configure --enable-rdm-tests;
travis_fold end "configure"
# the following is a bit of a hack to build the files normally built during
# the build, so they are present for flake8 to run against
make builtfiles
flake8 --max-line-length 80 --exclude *_pb2.py,.git,__pycache --ignore E111,E114,E121,E127,E129 data/rdm include/ola python scripts tools/ola_mon tools/rdm
travis_fold start "make_builtfiles"
make builtfiles;
travis_fold end "make_builtfiles"
flake8 --max-line-length 80 --exclude *_pb2.py,.git,__pycache --ignore E111,E114,E121,E127,E129,W504 data/rdm include/ola python scripts tools/ola_mon tools/rdm
elif [[ $TASK = 'pychecker' ]]; then
travis_fold start "autoreconf"
autoreconf -i;
./configure --enable-rdm-tests
travis_fold end "autoreconf"
travis_fold start "configure"
./configure --enable-rdm-tests;
travis_fold end "configure"
# the following is a bit of a hack to build the files normally built during
# the build, so they are present for pychecker to run against
make builtfiles
travis_fold start "make_builtfiles"
make builtfiles;
travis_fold end "make_builtfiles"
PYTHONPATH=./python/:$PYTHONPATH
export PYTHONPATH
mkdir ./python/ola/testing/
ln -s ./tools/rdm ./python/ola/testing/rdm
travis_fold start "pychecker_a"
pychecker --quiet --limit 500 --blacklist $PYCHECKER_BLACKLIST $(find ./ -name "*.py" -and \( -wholename "./data/*" -or -wholename "./include/*" -or -wholename "./scripts/*" -or -wholename "./python/examples/rdm_compare.py" -or -wholename "./python/ola/*" \) -and ! \( -name "*_pb2.py" -or -name "OlaClient.py" -or -name "ola_candidate_ports.py" -or -wholename "./scripts/enforce_licence.py" -or -wholename "./python/ola/rpc/*" -or -wholename "./python/ola/ClientWrapper.py" -or -wholename "./python/ola/PidStore.py" -or -wholename "./python/ola/RDMAPI.py" \) | xargs)
travis_fold end "pychecker_a"
# More restricted checking for files that import files that break pychecker
travis_fold start "pychecker_b"
pychecker --quiet --limit 500 --blacklist $PYCHECKER_BLACKLIST --only $(find ./ -name "*.py" -and \( -wholename "./tools/rdm/ModelCollector.py" -or -wholename "./tools/rdm/DMXSender.py" -or -wholename "./tools/rdm/TestCategory.py" -or -wholename "./tools/rdm/TestHelpers.py" -or -wholename "./tools/rdm/TestState.py" -or -wholename "./tools/rdm/TimingStats.py" -or -wholename "./tools/rdm/list_rdm_tests.py" \) | xargs)
travis_fold end "pychecker_b"
# Even more restricted checking for files that import files that break pychecker and have unused parameters
travis_fold start "pychecker_c"
pychecker --quiet --limit 500 --blacklist $PYCHECKER_BLACKLIST --only --no-argsused $(find ./ -name "*.py" -and ! \( -name "*_pb2.py" -or -name "OlaClient.py" -or -name "ola_candidate_ports.py" -or -name "ola_universe_info.py" -or -name "rdm_snapshot.py" -or -name "ClientWrapper.py" -or -name "PidStore.py" -or -name "enforce_licence.py" -or -name "ola_mon.py" -or -name "TestLogger.py" -or -name "TestRunner.py" -or -name "rdm_model_collector.py" -or -name "rdm_responder_test.py" -or -name "rdm_test_server.py" \) | xargs)
travis_fold end "pychecker_c"
elif [[ $TASK = 'pychecker-wip' ]]; then
travis_fold start "autoreconf"
autoreconf -i;
./configure --enable-rdm-tests
travis_fold end "autoreconf"
travis_fold start "configure"
./configure --enable-rdm-tests;
travis_fold end "configure"
# the following is a bit of a hack to build the files normally built during
# the build, so they are present for pychecker to run against
make builtfiles
travis_fold start "make_builtfiles"
make builtfiles;
travis_fold end "make_builtfiles"
PYTHONPATH=./python/:$PYTHONPATH
export PYTHONPATH
mkdir ./python/ola/testing/
ln -s ./tools/rdm ./python/ola/testing/rdm
pychecker --quiet --limit 500 --blacklist $PYCHECKER_BLACKLIST $(find ./ -name "*.py" -and ! \( -name "*_pb2.py" -or -name "OlaClient.py" -or -name "ola_candidate_ports.py" \) | xargs)
else
# Otherwise compile and check as normal
export DISTCHECK_CONFIGURE_FLAGS='--enable-rdm-tests --enable-java-libs --enable-ja-rule --enable-e133'
if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then
# Silence all deprecated declarations on Linux due to auto_ptr making the build log too long
export DISTCHECK_CONFIGURE_FLAGS='--enable-rdm-tests --enable-java-libs --enable-ja-rule --enable-e133 CPPFLAGS=-Wno-deprecated-declarations'
else
export DISTCHECK_CONFIGURE_FLAGS='--enable-rdm-tests --enable-java-libs --enable-ja-rule --enable-e133'
fi
travis_fold start "autoreconf"
autoreconf -i;
travis_fold end "autoreconf"
travis_fold start "configure"
./configure $DISTCHECK_CONFIGURE_FLAGS;
travis_fold end "configure"
travis_fold start "make_distcheck"
make distcheck;
travis_fold end "make_distcheck"
travis_fold start "make_dist"
make dist;
travis_fold end "make_dist"
travis_fold start "verify_trees"
tarball=$(ls -Ut ola*.tar.gz | head -1)
tar -zxf $tarball;
tarball_root=$(echo $tarball | sed 's/.tar.gz$//')
./scripts/verify_trees.py ./ $tarball_root
travis_fold end "verify_trees"
fi
@@ -3,6 +3,10 @@ language: cpp
sudo: required
# Use the latest Travis images since they are more up to date than the stable release.
group: edge
before_script:
- export -f travis_fold
script:
- "bash -ex .travis-ci.sh"
@@ -263,6 +267,8 @@ matrix:
env:
global:
# No colours in terminal (to reduce log file size)
- TERM=dumb
# Parallel make build
- MAKEFLAGS="-j 2"
# -- BEGIN Coverity Scan ENV
@@ -331,6 +337,10 @@ before_install:
- if [ "$TASK" == "spellintian" -o "$TASK" == "spellintian-duplicates" ]; then sudo add-apt-repository ppa:waja/trusty-backports -y; sudo apt-get update -qq; sudo apt-get install lintian -y; fi # Install a late enough lintian
after_failure:
# Disabled as otherwise the logfile is too big
# - if [ -f ${TRAVIS_BUILD_DIR}/config.log ]; then cat ${TRAVIS_BUILD_DIR}/config.log; fi
- if [ -f ${TRAVIS_BUILD_DIR}/ola-*/_build/config.log ]; then cat ${TRAVIS_BUILD_DIR}/ola-*/_build/config.log; fi
- if [ -f ${TRAVIS_BUILD_DIR}/ola-*/_build/sub/config.log ]; then cat ${TRAVIS_BUILD_DIR}/ola-*/_build/sub/config.log; fi
- if [ -f ${TRAVIS_BUILD_DIR}/ola-*/_build/test-suite.log ]; then cat ${TRAVIS_BUILD_DIR}/ola-*/_build/test-suite.log; fi
- if [ -f ${TRAVIS_BUILD_DIR}/ola-*/_build/sub/test-suite.log ]; then cat ${TRAVIS_BUILD_DIR}/ola-*/_build/sub/test-suite.log; fi
@@ -59,7 +59,7 @@ COMMON_TESTING_FLAGS_ONLY_WARNINGS = $(COMMON_CXXFLAGS_ONLY_WARNINGS) \
COMMON_TESTING_FLAGS = $(COMMON_TESTING_FLAGS_ONLY_WARNINGS)
COMMON_TESTING_PROTOBUF_FLAGS = $(COMMON_TESTING_FLAGS)
# The genererated protobuf files don't compile with -Werror on win32 so we
# The generated protobuf files don't compile with -Werror on win32 so we
# disable fatal warnings on WIN32.
if ! USING_WIN32
if FATAL_WARNINGS
@@ -71,6 +71,13 @@ if FATAL_WARNINGS
COMMON_TESTING_FLAGS += -Werror
COMMON_TESTING_PROTOBUF_FLAGS += -Werror -Wno-error=unused-parameter \
-Wno-error=deprecated-declarations
if GNU_PLUS_PLUS_11_DEPRECATIONS
# We have to use gnu++11 for some reason, so stop it complaining about
# auto_ptr
COMMON_CXXFLAGS += -Wno-error=deprecated-declarations
COMMON_TESTING_FLAGS += -Wno-error=deprecated-declarations
endif
endif
endif
@@ -71,7 +71,6 @@ void MockLogDestination::AddExpected(log_level level, string log_line) {
void MockLogDestination::Write(log_level level, const string &log_line) {
vector<string> tokens;
ola::StringSplit(log_line, &tokens, ":");
vector<string>::iterator iter;
OLA_ASSERT_EQ(tokens.size() , (size_t) 3);
OLA_ASSERT_GT(m_log_lines.size(), 0);
std::pair<log_level, string> expected_result = m_log_lines.at(0);
@@ -651,19 +651,28 @@ RDMResponse *ResponderHelper::GetListInterfaces(
std::sort(interfaces.begin(), interfaces.end(),
ola::network::InterfaceIndexOrdering());
uint16_t interface_count = std::count_if(
interfaces.begin(), interfaces.end(), IsInterfaceIndexValidInterface);
PACK(
struct list_interfaces_s {
uint32_t index;
uint16_t type;
});
STATIC_ASSERT(sizeof(list_interfaces_s) == 6);
list_interfaces_s list_interfaces[interfaces.size()];
list_interfaces_s list_interfaces[interface_count];
// Reorder so valid interfaces are first
std::stable_partition(interfaces.begin(), interfaces.end(),
IsInterfaceIndexValidInterface);
for (uint16_t i = 0; i < interfaces.size(); i++) {
list_interfaces[i].index = HostToNetwork(interfaces[i].index);
// Then just iterate through the valid ones
vector<Interface>::iterator iter = interfaces.begin();
for (uint16_t i = 0; i < interface_count; i++) {
list_interfaces[i].index = HostToNetwork(iter[i].index);
list_interfaces[i].type = HostToNetwork(
static_cast<uint16_t>(interfaces[i].type));
static_cast<uint16_t>(iter[i].type));
}
return GetResponseFromData(
@@ -1201,10 +1210,24 @@ RDMResponse *ResponderHelper::SetUInt32Value(
bool ResponderHelper::FindInterface(
const NetworkManagerInterface *network_manager,
Interface *interface, uint32_t index) {
if (!IsInterfaceIndexValid(index)) {
// Invalid index
return false;
}
InterfacePicker::Options options;
options.specific_only = true;
return network_manager->GetInterfacePicker()->ChooseInterface(
interface, index, options);
}
bool ResponderHelper::IsInterfaceIndexValid(uint32_t index) {
return (index >= MIN_RDM_INTERFACE_INDEX &&
index <= MAX_RDM_INTERFACE_INDEX);
}
bool ResponderHelper::IsInterfaceIndexValidInterface(Interface interface) {
return IsInterfaceIndexValid(interface.index);
}
} // namespace rdm
} // namespace ola
Oops, something went wrong.

0 comments on commit b31846b

Please sign in to comment.