Merge branch 'master' into merge

Signed-off-by: Martin Bremmer <martin.bremmer@adlinktech.com>
This commit is contained in:
Martin Bremmer 2019-09-27 14:10:10 +02:00
commit 919850232c
128 changed files with 6936 additions and 2075 deletions

View file

@ -10,6 +10,7 @@
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#include <stdlib.h>
#include <assert.h>
#include "CUnit/Theory.h"
#include "dds/ddsrt/environ.h"
@ -49,11 +50,13 @@ CU_Test(ddsrt_environ, setenv)
CU_ASSERT_EQUAL(rc, DDS_RETCODE_OK);
ptr = getenv(name);
CU_ASSERT_PTR_NOT_NULL(ptr);
assert (ptr != NULL); /* for the benefit of clang's static analyzer */
CU_ASSERT_STRING_EQUAL(ptr, "bar");
/* Ensure value is copied into the environment. */
value[2] = 'z';
ptr = getenv(name);
CU_ASSERT_PTR_NOT_NULL(ptr);
assert (ptr != NULL); /* for the benefit of clang's static analyzer */
CU_ASSERT_STRING_EQUAL(ptr, "bar");
rc = ddsrt_setenv(name, "");
CU_ASSERT_EQUAL(rc, DDS_RETCODE_OK);

View file

@ -9,6 +9,7 @@
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#include <assert.h>
#include "dds/ddsrt/cdtors.h"
#include "dds/ddsrt/ifaddrs.h"
#include "dds/ddsrt/retcode.h"
@ -73,6 +74,7 @@ CU_Test(ddsrt_getifaddrs, ipv4)
CU_ASSERT_EQUAL_FATAL(ret, DDS_RETCODE_OK);
for (ifa = ifa_root; ifa; ifa = ifa->next) {
CU_ASSERT_PTR_NOT_EQUAL_FATAL(ifa->addr, NULL);
assert (ifa->addr != NULL); /* for the benefit of clang's static analyzer */
CU_ASSERT_EQUAL(ifa->addr->sa_family, AF_INET);
if (ifa->addr->sa_family == AF_INET) {
if (ifa->flags & IFF_LOOPBACK) {
@ -130,6 +132,7 @@ CU_Test(ddsrt_getifaddrs, ipv6)
CU_ASSERT_EQUAL_FATAL(ret, DDS_RETCODE_OK);
for (ifa = ifa_root; ifa; ifa = ifa->next) {
CU_ASSERT_PTR_NOT_EQUAL_FATAL(ifa->addr, NULL);
assert (ifa->addr != NULL); /* for the benefit of clang's static analyzer */
CU_ASSERT_EQUAL(ifa->addr->sa_family, AF_INET6);
if (ifa->addr->sa_family == AF_INET6) {
have_ipv6 = 1;
@ -170,6 +173,7 @@ CU_Test(ddsrt_getifaddrs, ipv4_n_ipv6)
CU_ASSERT_EQUAL_FATAL(ret, DDS_RETCODE_OK);
for (ifa = ifa_root; ifa; ifa = ifa->next) {
CU_ASSERT_PTR_NOT_EQUAL_FATAL(ifa->addr, NULL);
assert (ifa->addr != NULL); /* for the benefit of clang's static analyzer */
CU_ASSERT(ifa->addr->sa_family == AF_INET ||
ifa->addr->sa_family == AF_INET6);
if (ifa->addr->sa_family == AF_INET) {

View file

@ -254,11 +254,8 @@ CU_Test(dds_log, no_sink, .init=setup, .fini=teardown)
ptr = NULL;
DDS_ERROR("foobaz\n");
ret = fseek(fh, 0, SEEK_SET);
CU_ASSERT_EQUAL_FATAL(ret, 0);
CU_ASSERT_PTR_NULL(ptr);
if (ptr != NULL) {
ddsrt_free(ptr);
ptr = NULL;
}
buf[0]= '\0';
cnt[1] = fread(buf, 1, sizeof(buf) - 1, fh);
#ifdef _WIN32

View file

@ -29,9 +29,13 @@ static int test_sleep(int argi, int argc, char **argv)
argi++;
if (argi < argc) {
long long dorment;
ddsrt_strtoll(argv[argi], NULL, 0, &dorment);
printf(" Process: sleep %d seconds.\n", (int)dorment);
dds_sleepfor(DDS_SECS((int64_t)dorment));
if (ddsrt_strtoll(argv[argi], NULL, 0, &dorment) != DDS_RETCODE_OK || dorment < 0 || dorment > INT32_MAX) {
printf(" Process: invalid --sleep argument.\n");
return TEST_EXIT_WRONG_ARGS;
} else {
printf(" Process: sleep %d seconds.\n", (int)dorment);
dds_sleepfor(DDS_SECS((int64_t)dorment));
}
} else {
printf(" Process: no --sleep value.\n");
return TEST_EXIT_WRONG_ARGS;