Commit graph

740 commits

Author SHA1 Message Date
dennis-adlink
c8aa6fee5a Moved bswap functions to ddsrt (#297)
* Moved bswap functions to ddsrt

Moved the byte swapping functions from ddsi to ddsrt so that
these can be re-used in e.g. the security plugins and tests.

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>

* Moved  decarations for bswap functions to ddsrt

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2019-10-28 15:03:46 +01:00
Dan Rose
76fa688086 CMAKE_SOURCE_DIR -> CMAKE_CURRENT_SOURCE_DIR
Signed-off-by: Dan Rose <dan@digilabs.io>
2019-10-23 09:36:38 +02:00
Scott K Logan
860a6aadae Drop IDLC when building with colcon
This will eliminate two large dependencies when building CycloneDDS with
colcon for ROS 2, which doesn't appear to need the IDLC.

Signed-off-by: Scott K Logan <logans@cottsay.net>
2019-10-22 22:37:40 +02:00
Scott K Logan
1cc6caff14 First check the CMake Package Registry for CUnit
This is useful when building CycloneDDS on platforms that provide CMake
configuration for CUnit outside of Conan.

If no configuration is found in the system CMake registry the module
continues as before.

Co-authored-by: Steven! Ragnarök <steven@nuclearsandwich.com>
Signed-off-by: Scott K Logan <logans@cottsay.net>
2019-10-22 22:33:10 +02:00
Martin Bremmer
41d36d59b2 Removed duplicate build from travis
Signed-off-by: Martin Bremmer <martin.bremmer@adlinktech.com>
2019-10-22 20:28:34 +02:00
Thijs Sassen
36b1b9da3d Adjusted mpt qos test includes to be in line with other tests
Signed-off-by: Thijs Sassen <thijs.sassen@adlinktech.com>
2019-10-22 16:27:15 +02:00
Scott K Logan
a3b35a2aa4 Fix some unreliable STREQUAL calls in CMakeLists.txt
These conditionals may fail if the variable they're checking isn't
defined at all. Adding quotes makes the comparison against an empty
string in this case, which avoids the syntax error.

Signed-off-by: Scott K Logan <logans@cottsay.net>
2019-10-22 15:22:56 +02:00
Scott K Logan
94e4c0915d Skip some tests when BUILD_IDLC=OFF
These tests use `idlc_generate`, which is not available when
`BUILD_IDLC` is not `ON`.

Signed-off-by: Scott K Logan <logans@cottsay.net>
2019-10-22 15:20:30 +02:00
Dan Rose
98ce7d1971 Stylistic CMake changes
No functional impact intended
Signed-off-by: Dan Rose <dan@digilabs.io>
2019-10-22 15:18:26 +02:00
Dan Rose
418a70e7c3 Fix CI not finding pip3
Signed-off-by: Dan Rose <dan@digilabs.io>
2019-10-20 03:32:18 -07:00
Dan Rose
960d4f7358 Use PROJECT_NAME instead of CMAKE_PROJECT_NAME
CMAKE_PROJECT_NAME refers to the top-level project name, not the most recent project. So any CMake project that pulls this in as a dependency was in for a nasty surprise.
https://cmake.org/cmake/help/latest/variable/CMAKE_PROJECT_NAME.html

Signed-off-by: Dan Rose <dan@digilabs.io>
2019-10-20 03:28:15 -07:00
Erik Boasson
8ec68e1d7d No printing of null pointers in config errors
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-10-16 03:08:31 +02:00
Erik Boasson
a71be9dcec Remove all occurrences of strncpy
Too many compilers warn about correct use of strncpy these days ...

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-10-16 03:08:31 +02:00
Erik Boasson
f8bff97736 Fix off-by-one error in dds_strretcode (#270)
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-10-16 03:08:31 +02:00
Erik Boasson
5a746cad81 Always abort on DDS_FATAL variants + test (#270)
The test only works on Linux and macOS because of the system
dependencies in catching an abort.  The logging code is platform
independent so testing only on these platforms still gives a good sanity
check.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-10-16 03:08:31 +02:00
Erik Boasson
50e63b3324 Correct ddsrt_gnuc, ddsrt_clang definitions (#270)
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-10-16 03:08:31 +02:00
Erik Boasson
14ffab2705 Always use atomic64 for writer seq_xmit (#270)
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-10-16 03:08:31 +02:00
Erik Boasson
8ce389dd85 IID generator: init and atomic64 ops (#270)
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-10-16 03:08:31 +02:00
Dennis Potman
cbc6dc5aa0 Increase thread test timeout to check if this caused the failing tests on travis win32
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2019-10-15 19:29:18 +02:00
Erik Boasson
aa5236dea4 Prefix matching for config XML in CYCLONEDDS_URI
Allow unique prefix matches for elements and attributes specified in
directly in CYCLONEDDS_URI.  That mode already has a few niceties for
quickly specifying some configuration overrides, this is simply one
more.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-10-10 17:44:39 +02:00
Erik Boasson
a25b69be7d Exclude network channels from documentation
They are not supported yet.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-10-10 17:44:39 +02:00
Erik Boasson
d429045255 Add option documentation and add XSD
The ``docs/makernc.pl`` perl script can extract the options from the
source code for the configuration processing and turn these into a
GitHub MarkDown document and a RELAX NG Compact form (RNC) description
of the options.  Standard conversion tools can be used to turn the RNC
file into an XSD.

Although they are generated by a mechanical transformation, it is not
(yet) part of the build process, in no small part because there no
proper generation and publishing system has yet been set up for the
documentation.

Now that there is an XSD and a Markdown file for discovering the
options, there is no need to retain the configuration editing tool.  Any
decent editor will do a better job.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-10-10 17:44:39 +02:00
Erik Boasson
fde05810c6 Drop broken protection against casual eavesdroppers
From a distant past came code to encrypt data on the wire, but it hasn't
been functional in Cyclone for a long time and it only ever provided
protection against casual eavesdroppers.  It is better to delete it.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-10-10 17:44:39 +02:00
Thijs Sassen
0b57b74b93 Fix compile error when using rusage functionality on FreeRTOS
Signed-off-by: Thijs Sassen <thijs.sassen@adlinktech.com>
2019-10-07 14:12:27 +02:00
Jeroen Koekkoek
378b4b19d7 Add macOS 10.12 / Xcode 9 build on Travis CI
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-10-02 14:17:38 +02:00
Erik Boasson
0098cfcab7 Fix macOS 10.12 version check
Xcode 9 doesn't yet define MAC_OS_X_VERSION_10_13.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-10-02 08:52:06 +02:00
eboasson
50b0611ad1
macOS pre-10.13 support (#264)
* macOS < 10.13: skip log tests for want of fmemopen

There is a dependency on fmemopen in the tests for the logging
functions, which macOS introduced only in version 10.13.  There should
be no other obstacle to building/running/testing on older versions of
macOS.  This commit does the pragmatic thing: remove the dependency and
turns the tests into no-ops in this one case.

Signed-off-by: Erik Boasson <eb@ilities.com>

* Fix macOS clock_gettime_nsec_np availability test

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-30 09:13:49 +02:00
eboasson
78fc9c2e85
Merge pull request #260 from eboasson/plist-update
parameter list update: properties, fixes, unit tests
2019-09-27 13:32:46 +02:00
Erik Boasson
2289428991 Support optional tail in plist deserialisation
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-27 13:12:54 +02:00
Martin Bremmer
bc6ece0bfb Fixed missing-field-initializers clang-4 warnings.
Signed-off-by: Martin Bremmer <martin.bremmer@adlinktech.com>
2019-09-27 10:07:54 +02:00
Erik Boasson
bf8bc87a87 Fixes for table-driven plist ser/deser
* GUID, keyhash compare (currently no reliance on this comparison, so
  not causing trouble in Cyclone for applications)

* comparing "propagate" boolean in plist (newly added for security,
  not yet used)

* fix memory leak in plist_unalias (currently only used in duplicating
  them, in which case the memory leak doesn't occur)

* add unit tests for plist handling

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-26 15:58:50 +02:00
Martin Bremmer
8f46889f74 Improved property policy handling.
Signed-off-by: Martin Bremmer <martin.bremmer@adlinktech.com>
2019-09-26 15:54:05 +02:00
Martin Bremmer
9f1ddb0b38 Added property policy.
Signed-off-by: Martin Bremmer <martin.bremmer@adlinktech.com>
2019-09-26 15:54:00 +02:00
Erik Boasson
527a59f82f Add support for non-nested sequences in plist
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-26 15:53:50 +02:00
Erik Boasson
c5e4d36dc6 Remove unused "length" opcode from plist handling
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-26 15:43:25 +02:00
Erik Boasson
94483e3371 Address Coverity, Clang static analyzer warnings
* Fix type of num reliable readers (int to int32_t)

* Conversion codes in debug monitor printf formats

* Dead code elimination

* Skipping a test case where SIZE_MAX is assumed > INT32_MAX if
  assumption is false on target platform

* Error handling in os_sockWaitsetNew

* Stick to unsigned in fragment size calculations

  This check is actually guarded by valid_DataFrag and was safe for
  datagrams up to 2GB, but the unintended and implicit conversion to is
  still best eliminated.

* A "server" connection never has an invalid socket in TCP wrapper

* Handle error return from gethostname in SPDP write (CID 248183)

* Handle extended retcodes in dds_strretcode

  CID 248131, introduced by 19aec98b8a

* Remove dead code in ddsrt logging test (CID 248195)

* Validate command-line argument in process test (CID 248117)

* Allow for extremely delayed store in test

  Test is constructed to have the events trigger only at the appropriate
  times, but it does assume that the store to cb_called becomes visible
  prior to the listener callback.  I'm pretty sure that will always be
  the case in practice, but I'm also pretty sure there is no formal
  guarantee without a memory barrier, which mutex_unlock provides.

  CID 248088, 248136, 248177, 253590, 253591, 253593

* Check unsetenv return value in test (CID 248099)

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-25 10:46:40 +02:00
Erik Boasson
2996a6b5f8 Let Coverity ignore sleep in ddsrt init "spinlock"
Initialisation of ddsrt layer uses a hand-rolled CAS/sleep device not
unlike a spin lock.  This so initialisation doesn't depend on, e.g.,
ddsrt_once.

Checking or changing thread states between "awake" and "asleep" can end
up in ddsrt_init if the thread is unknown at the time of the call.
Once really only ends up in those cases when the library is initialised
already, in which case no sleeping occurs.

In any case, the sleep is just a friendly yielding of the CPU.  Coverity
will still see the loop, just not the sleep.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-25 10:46:40 +02:00
Erik Boasson
d1ad60fdd1 Fix locking in DATA_ON_READERS when masked
In the case of when a DATA_ON_READERS listener is set, but with the
corresponding status mask is set to suppress the event, the reader lock
would not be in locked, resulting in a unlocked access of status flags
and a double unlock.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-25 10:46:40 +02:00
Erik Boasson
2775e2527c Update Conan OpenSSL version to 1.1.1c
1.1.1a downloads now fail on macOS.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-25 10:46:40 +02:00
Erik Boasson
282ab69441 Update Travis to XCode 10.3 image
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-25 10:46:40 +02:00
Erik Boasson
df3ce2cbb4 README update: location of rmw_cyclonedds
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-19 17:56:33 +02:00
Frans Faase
f48bbd3d1c Initializing domain with configuration as a string
For targets that do not support ddsrt_setenv and ddsrt_getenv, an alternative
method is needed to supply an application specific configuration. One way to
implement this, is to add a function for creating a domain with a string
arguments, which needs to be called before any call to dds_create_participant
for given domain identifier.

The function dds_create_domain has been added, which has as arguments a domain
identifier and a configuration string. The string is treated in the same way
as the string that is retrieved from the environment variable, in that it may
containt a comma separated list of file names and/or XML fragments for the
configuration.

Two tests have been added. One limits the number of participants to two and
verifies that creating a third participant fails. The other tests checks
incorrect calls to dds_create_domain.

An assert in dds_handle_delete has been weakened.

Signed-off-by: Frans Faase <frans.faase@adlinktech.com>
2019-09-19 16:30:27 +02:00
Dan Rose
67f7f56a62 Update package.xml
Add bugtracker, repository
Rearrange buildtool depends
Add dependencies on openssl, cunit, sphinx

Signed-off-by: Dan Rose <dan@digilabs.io>
2019-09-18 13:51:14 +02:00
Dan Rose
03491c503d Switch from colcon.pkg to package.xml and add build-time dependencies.
Signed-off-by: Dan Rose <dan@digilabs.io>
2019-09-18 13:51:14 +02:00
Martin Bremmer
801c4b1456 Added participant mismatch tests.
Signed-off-by: Martin Bremmer <martin.bremmer@adlinktech.com>
2019-09-12 15:15:48 +02:00
Erik Boasson
53a21c5203 Add perl script for digesting traces more easily
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-11 10:06:24 +02:00
Erik Boasson
ac2eee3907 Skip the statistical tests on the random generator
Those fail with a small probability, but it is still annoying.  The code
has been vetted and tested; and by disabling the test only when run in
the CI infrastructure, anyone changing the code would still have the
test run locally.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-11 10:06:24 +02:00
Erik Boasson
3ff26103cb Lengthen timeout in ddsc_guardcond_waitset_thread
Rare intermittent failure appears to be timing.  Increasing the timeout
doesn't affect the duration of a successful run and will still signal an
missing trigger.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-11 10:06:24 +02:00
Erik Boasson
1e094c6fbb Fix race: delete participant, receipt of own SPDP
Deleting participant does: add to "deleted participants", remove from
GUID hash table; so SPDP processing must first check for an existing
participant and check deleted participants if nothing found.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-11 10:06:24 +02:00
Erik Boasson
d9dac3b7e2 Store logcfg in deleted_participants_admin
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-11 10:06:24 +02:00