Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI updates #1947

Merged
merged 7 commits into from Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions .azure/templates/build-test.yml
Expand Up @@ -19,6 +19,13 @@ steps:
inputs:
versionSpec: '3.8'
name: install_python
- bash: |
# Asan in llvm 14 provided in ubuntu 22.04 is incompatible with
# high-entropy ASLR in much newer kernels that GitHub runners are
# using leading to random crashes: https://reviews.llvm.org/D148280
sudo sysctl vm.mmap_rnd_bits=28
condition: eq(variables['Agent.OS'], 'Linux')
name: fix_kernel_mmap_rnd_bits
# Set defaults from steps to share them among pipelines
- bash: |
[[ -n "${ARCH}" ]] || \
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Expand Up @@ -134,6 +134,10 @@ elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
if(${WERROR})
add_compile_options(-Werror)
add_link_options(-Werror)
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0 AND CMAKE_C_COMPILER_VERSION VERSION_LESS 13.2)
add_compile_options(-Wno-error=stringop-overflow -Wno-error=array-bounds)
add_link_options(-Wno-error=stringop-overflow -Wno-error=array-bounds)
endif()
endif()
if("${CMAKE_GENERATOR}" STREQUAL "Ninja")
add_compile_options(-fdiagnostics-color=always)
Expand Down
75 changes: 36 additions & 39 deletions azure-pipelines.yml
Expand Up @@ -40,19 +40,23 @@ jobs:
build_type: Release
sanitizer: undefined
cc: gcc-10
'Ubuntu 22.04 LTS with GCC 10 (Debug, x86_64, Iceoryx)':
'Ubuntu 22.04 LTS with GCC 13 (Debug, x86_64, Iceoryx)':
image: ubuntu-22.04
#analyzer: on # disabled for now because of warnings
sanitizer: address,undefined
# No address sanitizer because of this in test run:
# Shadow memory range interleaves with an existing memory mapping.
# ASan cannot proceed correctly. ABORTING.
# ASan shadow was supposed to be located in the [0x00007fff7000-0x10007fff7fff]
# range.
sanitizer: undefined
iceoryx: on
cc: gcc-10
cc: gcc-13
coverage: on
'Ubuntu 22.04 LTS with GCC 10 (Release, x86_64)':
'Ubuntu 22.04 LTS with GCC 13 (Release, x86_64)':
image: ubuntu-22.04
build_type: Release
sanitizer: undefined
cc: gcc-10
'Ubuntu 22.04 LTS with GCC 10 (Debug, x86_64, security only)':
cc: gcc-13
'Ubuntu 22.04 LTS with GCC 12 (Debug, x86_64, security only)':
image: ubuntu-22.04
sanitizer: address,undefined
ssl: off
Expand All @@ -61,72 +65,65 @@ jobs:
type_discovery: off
topic_discovery: off
idlc_xtests: off # temporary disabled because of passing -t option to idlc in this test for recursive types
cc: gcc-10
'Ubuntu 22.04 LTS with GCC 10 (Debug, x86_64, no tests)':
cc: gcc-12
'Ubuntu 22.04 LTS with GCC 12 (Debug, x86_64, no tests)':
image: ubuntu-22.04
cc: gcc-10
cc: gcc-12
testing: off
idlc_xtests: off
'Ubuntu 22.04 LTS with Clang 13 (Debug, x86_64)':
'Ubuntu 22.04 LTS with Clang 15 (Debug, x86_64)':
image: ubuntu-22.04
analyzer: on
sanitizer: address,undefined
cc: clang-13
'Ubuntu 22.04 LTS with Clang 13 (Debug, x86_64, no security)':
cc: clang-15
'Ubuntu 22.04 LTS with Clang 15 (Debug, x86_64, no security)':
image: ubuntu-22.04
sanitizer: address,undefined
security: off
cc: clang-13
'Ubuntu 22.04 LTS with Clang 13 (Release, x86_64, no topic discovery)':
cc: clang-15
'Ubuntu 22.04 LTS with Clang 15 (Release, x86_64, no topic discovery)':
image: ubuntu-22.04
build_type: Release
sanitizer: undefined
topic_discovery: off
idlc_xtests: off # temporary disabled because of passing -t option to idlc in this test for recursive types
cc: clang-13
'macOS 11 with Clang 12 (Debug, x86_64)':
image: macOS-11
cc: clang-15
'macOS 13 with Clang 15 (Debug, x86_64)':
image: macos-13
sanitizer: address,undefined
deadline_update_skip: on
cc: clang
'macOS 11 with Clang 12 (Release, x86_64)':
image: macOS-11
build_type: Release
sanitizer: undefined
deadline_update_skip: on
cc: clang
'macOS 11 with Clang 13 (Release, x86_64)':
image: macOS-11
'macOS 13 with Clang 15 (Release, x86_64)':
image: macos-13
build_type: Release
sanitizer: undefined
deadline_update_skip: on
cc: clang
coverage: on
'macOS 12 with gcc 12 (Debug, analyzer, x86_64)':
image: macOS-12
sanitizer: undefined
'macOS 13 with gcc 13 (Debug, analyzer, x86_64)':
image: macos-13
deadline_update_skip: on
cc: gcc-12
cc: gcc-13
analyzer: on
# 32-bit Windows: without SSL/security because Chocolateley only provides 64-bit OpenSSL
'Windows 2019 with Visual Studio 2019 (Visual Studio 2017, Debug, x86, no security)':
'Windows 2022 with Visual Studio 2022 (Debug, x86, no security)':
arch: x86
image: windows-2019
image: windows-2022
ssl: off
security: off
idlc_xtests: off
generator: 'Visual Studio 16 2019'
generator: 'Visual Studio 17 2022'
toolset: v141
'Windows 2019 with Visual Studio 2019 (Debug, x86_64)':
image: windows-2019
'Windows 2022 with Visual Studio 2022 (Debug, x86_64)':
image: windows-2022
idlc_xtests: off
generator: 'Visual Studio 16 2019'
'Windows 2019 with Visual Studio 2019 (Release, x86_64, no tests)':
image: windows-2019
generator: 'Visual Studio 17 2022'
'Windows 2022 with Visual Studio 2022 (Release, x86_64, no tests)':
image: windows-2022
build_type: Release
testing: off
idlc_xtests: off
generator: 'Visual Studio 16 2019'
generator: 'Visual Studio 17 2022'
'Windows 2019 with Visual Studio 2019 (RelWithDebInfo, x86_64)':
image: windows-2019
build_type: RelWithDebInfo
Expand Down
1 change: 1 addition & 0 deletions examples/dynsub/dynsub.c
Expand Up @@ -121,6 +121,7 @@ static dds_return_t get_topic_and_typeobj (const char *topic_name, dds_duration_
{
// not sure whether this is at all possible
info = malloc (sizeof (*info));
assert (info);
*info = (struct typeinfo){ .key = { .key = (uintptr_t) *xtypeobj }, .typeobj = &(*xtypeobj)->_u.complete, .release = *xtypeobj, .align = align, .size = size };
type_cache_add (info);
}
Expand Down
7 changes: 7 additions & 0 deletions examples/dynsub/type_cache.c
Expand Up @@ -252,6 +252,7 @@ static void build_typecache_ti (const DDS_XTypes_TypeIdentifier *typeid, size_t
const DDS_XTypes_CompleteTypeObject *tobj = get_complete_typeobj_for_hashid (typeid->_u.equivalence_hash);
build_typecache_to (tobj, align, size);
info = malloc (sizeof (*info));
assert (info);
*info = (struct typeinfo){ .key = { .key = (uintptr_t) typeid }, .typeobj = tobj, .release = NULL, .align = *align, .size = *size };
type_cache_add (info);
}
Expand Down Expand Up @@ -289,6 +290,7 @@ void build_typecache_to (const DDS_XTypes_CompleteTypeObject *typeobj, size_t *a
*align = sizeof (int);
*size = sizeof (int);
info = malloc (sizeof (*info));
assert (info);
*info = (struct typeinfo){ .key = { .key = (uintptr_t) typeobj }, .typeobj = typeobj, .release = NULL, .align = *align, .size = *size };
ddsrt_hh_add (typecache, info);
}
Expand All @@ -310,6 +312,7 @@ void build_typecache_to (const DDS_XTypes_CompleteTypeObject *typeobj, size_t *a
else
*align = *size = 1;
info = malloc (sizeof (*info));
assert (info);
*info = (struct typeinfo){ .key = { .key = (uintptr_t) typeobj }, .typeobj = typeobj, .release = NULL, .align = *align, .size = *size };
ddsrt_hh_add (typecache, info);
}
Expand All @@ -327,6 +330,7 @@ void build_typecache_to (const DDS_XTypes_CompleteTypeObject *typeobj, size_t *a
*align = a;
*size = s;
info = malloc (sizeof (*info));
assert (info);
*info = (struct typeinfo){ .key = { .key = (uintptr_t) typeobj }, .typeobj = typeobj, .release = NULL, .align = *align, .size = *size };
ddsrt_hh_add (typecache, info);
}
Expand Down Expand Up @@ -354,6 +358,7 @@ void build_typecache_to (const DDS_XTypes_CompleteTypeObject *typeobj, size_t *a
if (*size % *align)
*size += *align - (*size % *align);
info = malloc (sizeof (*info));
assert (info);
*info = (struct typeinfo){ .key = { .key = (uintptr_t) typeobj }, .typeobj = typeobj, .release = NULL, .align = *align, .size = *size };
ddsrt_hh_add (typecache, info);
}
Expand Down Expand Up @@ -391,6 +396,7 @@ void build_typecache_to (const DDS_XTypes_CompleteTypeObject *typeobj, size_t *a
if (*size % *align)
*size += *align - (*size % *align);
info = malloc (sizeof (*info));
assert (info);
*info = (struct typeinfo){ .key = { .key = (uintptr_t) typeobj }, .typeobj = typeobj, .release = NULL, .align = *align, .size = *size };
ddsrt_hh_add (typecache, info);
}
Expand Down Expand Up @@ -468,6 +474,7 @@ static bool load_deps_ti (dds_entity_t participant, const DDS_XTypes_TypeIdentif
return load_deps_failed ();
DDS_XTypes_TypeObject * const xtypeobj = (DDS_XTypes_TypeObject *) typeobj;
info = malloc (sizeof (*info));
assert (info);
memcpy (info->id, typeid->_u.equivalence_hash, sizeof (info->id));
info->typeobj = xtypeobj;
info->lineno = 0;
Expand Down
17 changes: 7 additions & 10 deletions examples/roundtrip/ping.c
Expand Up @@ -53,8 +53,7 @@ static void exampleDeleteTimeStats (ExampleTimeStats *stats)
free (stats->values);
}

static ExampleTimeStats *exampleAddTimingToTimeStats
(ExampleTimeStats *stats, dds_time_t timing)
static void exampleAddTimingToTimeStats (ExampleTimeStats *stats, dds_time_t timing)
{
if (stats->valuesSize > stats->valuesMax)
{
Expand All @@ -70,8 +69,6 @@ static ExampleTimeStats *exampleAddTimingToTimeStats
stats->min = (stats->count == 0 || timing < stats->min) ? timing : stats->min;
stats->max = (stats->count == 0 || timing > stats->max) ? timing : stats->max;
stats->count++;

return stats;
}

static int exampleCompareul (const void* a, const void* b)
Expand Down Expand Up @@ -166,16 +163,16 @@ static void data_available(dds_entity_t rd, void *arg)

/* Update stats */
difference = (postWriteTime - preWriteTime)/DDS_NSECS_IN_USEC;
writeAccess = *exampleAddTimingToTimeStats (&writeAccess, difference);
writeAccessOverall = *exampleAddTimingToTimeStats (&writeAccessOverall, difference);
exampleAddTimingToTimeStats (&writeAccess, difference);
exampleAddTimingToTimeStats (&writeAccessOverall, difference);

difference = (postTakeTime - preTakeTime)/DDS_NSECS_IN_USEC;
readAccess = *exampleAddTimingToTimeStats (&readAccess, difference);
readAccessOverall = *exampleAddTimingToTimeStats (&readAccessOverall, difference);
exampleAddTimingToTimeStats (&readAccess, difference);
exampleAddTimingToTimeStats (&readAccessOverall, difference);

difference = (postTakeTime - info[0].source_timestamp)/DDS_NSECS_IN_USEC;
roundTrip = *exampleAddTimingToTimeStats (&roundTrip, difference);
roundTripOverall = *exampleAddTimingToTimeStats (&roundTripOverall, difference);
exampleAddTimingToTimeStats (&roundTrip, difference);
exampleAddTimingToTimeStats (&roundTripOverall, difference);

if (!warmUp) {
/* Print stats each second */
Expand Down
30 changes: 21 additions & 9 deletions src/core/ddsc/src/dds_instance.c
Expand Up @@ -159,9 +159,13 @@ dds_return_t dds_unregister_instance_ih_ts (dds_entity_t writer, dds_instance_ha
{
struct ddsi_sertype *tp = wr->m_topic->m_stype;
void *sample = ddsi_sertype_alloc_sample (tp);
ddsi_serdata_untyped_to_sample (tp, tk->m_sample, sample, NULL, NULL);
ddsi_tkmap_instance_unref (wr->m_entity.m_domain->gv.m_tkmap, tk);
ret = dds_write_impl (wr, sample, timestamp, action);
if (!ddsi_serdata_untyped_to_sample (tp, tk->m_sample, sample, NULL, NULL))
ret = DDS_RETCODE_ERROR;
else
{
ddsi_tkmap_instance_unref (wr->m_entity.m_domain->gv.m_tkmap, tk);
ret = dds_write_impl (wr, sample, timestamp, action);
}
ddsi_sertype_free_sample (tp, sample, DDS_FREE_ALL);
}
ddsi_thread_state_asleep (thrst);
Expand Down Expand Up @@ -239,9 +243,13 @@ dds_return_t dds_dispose_ih_ts (dds_entity_t writer, dds_instance_handle_t handl
{
const struct ddsi_sertype *tp = wr->m_wr->type;
void *sample = ddsi_sertype_alloc_sample (tp);
ddsi_serdata_untyped_to_sample (tp, tk->m_sample, sample, NULL, NULL);
ddsi_tkmap_instance_unref (wr->m_entity.m_domain->gv.m_tkmap, tk);
ret = dds_dispose_impl (wr, sample, handle, timestamp);
if (!ddsi_serdata_untyped_to_sample (tp, tk->m_sample, sample, NULL, NULL))
ret = DDS_RETCODE_ERROR;
else
{
ddsi_tkmap_instance_unref (wr->m_entity.m_domain->gv.m_tkmap, tk);
ret = dds_dispose_impl (wr, sample, handle, timestamp);
}
ddsi_sertype_free_sample (tp, sample, DDS_FREE_ALL);
}
ddsi_thread_state_asleep (thrst);
Expand Down Expand Up @@ -327,9 +335,13 @@ dds_return_t dds_instance_get_key (dds_entity_t entity, dds_instance_handle_t ih
/* Use sertype from topic, as the zero_sample and untyped_to_sample functions
are identical for the derived sertype that is stored in the endpoint. */
ddsi_sertype_zero_sample (topic->m_stype, data);
ddsi_serdata_untyped_to_sample (topic->m_stype, tk->m_sample, data, NULL, NULL);
ddsi_tkmap_instance_unref (e->m_domain->gv.m_tkmap, tk);
ret = DDS_RETCODE_OK;
if (!ddsi_serdata_untyped_to_sample (topic->m_stype, tk->m_sample, data, NULL, NULL))
ret = DDS_RETCODE_ERROR;
else
{
ddsi_tkmap_instance_unref (e->m_domain->gv.m_tkmap, tk);
ret = DDS_RETCODE_OK;
}
}
ddsi_thread_state_asleep (thrst);
dds_entity_unlock (e);
Expand Down
53 changes: 34 additions & 19 deletions src/core/ddsc/src/dds_rhc_default.c
Expand Up @@ -621,7 +621,14 @@ static void dds_rhc_default_set_qos (struct ddsi_rhc *rhc_common, const dds_qos_

static bool eval_predicate_sample (const struct dds_rhc_default *rhc, const struct ddsi_serdata *sample, bool (*pred) (const void *sample))
{
ddsi_serdata_to_sample (sample, rhc->qcond_eval_samplebuf, NULL, NULL);
// What to do if deserialization fails? Consider it matching or not?
//
// This is used in query evaluation, so claiming it matches at least allows taking it,
// and at least it allows the application to detect something is amiss. Always
// returning false would likely lead to endless loops in the application because some
// read condition remains triggered.
if (!ddsi_serdata_to_sample (sample, rhc->qcond_eval_samplebuf, NULL, NULL))
return true;
bool ret = pred (rhc->qcond_eval_samplebuf);
return ret;
}
Expand Down Expand Up @@ -989,23 +996,30 @@ static bool content_filter_accepts (const dds_reader *reader, const struct ddsi_
case DDS_TOPIC_FILTER_SAMPLE_SAMPLEINFO_ARG: {
char *tmp;
tmp = ddsi_sertype_alloc_sample (tp->m_stype);
ddsi_serdata_to_sample (sample, tmp, NULL, NULL);
switch (tp->m_filter.mode)
if (!ddsi_serdata_to_sample (sample, tmp, NULL, NULL))
{
// Samples we can't deserialize are (presumably) best never inserted
ret = false;
}
else
{
case DDS_TOPIC_FILTER_NONE:
case DDS_TOPIC_FILTER_SAMPLEINFO_ARG:
assert (0);
case DDS_TOPIC_FILTER_SAMPLE:
ret = (tp->m_filter.f.sample) (tmp);
break;
case DDS_TOPIC_FILTER_SAMPLE_ARG:
ret = (tp->m_filter.f.sample_arg) (tmp, tp->m_filter.arg);
break;
case DDS_TOPIC_FILTER_SAMPLE_SAMPLEINFO_ARG: {
struct dds_sample_info si;
content_filter_make_sampleinfo (&si, sample, inst, wr_iid, iid);
ret = tp->m_filter.f.sample_sampleinfo_arg (tmp, &si, tp->m_filter.arg);
break;
switch (tp->m_filter.mode)
{
case DDS_TOPIC_FILTER_NONE:
case DDS_TOPIC_FILTER_SAMPLEINFO_ARG:
assert (0);
case DDS_TOPIC_FILTER_SAMPLE:
ret = (tp->m_filter.f.sample) (tmp);
break;
case DDS_TOPIC_FILTER_SAMPLE_ARG:
ret = (tp->m_filter.f.sample_arg) (tmp, tp->m_filter.arg);
break;
case DDS_TOPIC_FILTER_SAMPLE_SAMPLEINFO_ARG: {
struct dds_sample_info si;
content_filter_make_sampleinfo (&si, sample, inst, wr_iid, iid);
ret = tp->m_filter.f.sample_sampleinfo_arg (tmp, &si, tp->m_filter.arg);
break;
}
}
}
ddsi_sertype_free_sample (tp->m_stype, tmp, DDS_FREE_ALL);
Expand Down Expand Up @@ -2922,10 +2936,11 @@ static bool rhc_check_counts_locked (struct dds_rhc_default *rhc, bool check_con
{
struct rhc_sample *sample = inst->latest->next, * const end = sample;
do {
ddsi_serdata_to_sample (sample->sample, rhc->qcond_eval_samplebuf, NULL, NULL);
// Follow error handling choices made in eval_predicate_sample()
const bool asifmatch = !ddsi_serdata_to_sample (sample->sample, rhc->qcond_eval_samplebuf, NULL, NULL);
qcmask = 0;
for (rciter = rhc->conds; rciter; rciter = rciter->m_next)
if (rciter->m_query.m_filter != 0 && rciter->m_query.m_filter (rhc->qcond_eval_samplebuf))
if (rciter->m_query.m_filter != 0 && (asifmatch || rciter->m_query.m_filter (rhc->qcond_eval_samplebuf)))
qcmask |= rciter->m_query.m_qcmask;
assert ((sample->conds & enabled_qcmask) == qcmask);
sample = sample->next;
Expand Down