Skip to content

Commit

Permalink
Merge d24d3c4 into a9a9e2a
Browse files Browse the repository at this point in the history
  • Loading branch information
Pro committed Apr 17, 2019
2 parents a9a9e2a + d24d3c4 commit 78c15f9
Show file tree
Hide file tree
Showing 6 changed files with 770 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Expand Up @@ -223,6 +223,10 @@ matrix:
# OSX clang build
- os: osx
compiler: clang
# OSX may have different hostnames between processes, which causes multicast unit test to fail.
# Hardcode the hostname here
addons:
hostname: travis-osx
# disable homebrew auto update which takes a lot of time
env: HOMEBREW_NO_AUTO_UPDATE=1
cache:
Expand Down
7 changes: 7 additions & 0 deletions tests/CMakeLists.txt
Expand Up @@ -12,6 +12,13 @@ if(CMAKE_HOST_SYSTEM_NAME MATCHES "OpenBSD")
add_definitions(-Wno-gnu-zero-variadic-macro-arguments)
endif()

if(APPLE)
# CLang on Apple complains about many cases like this:
# /Users/travis/build/open62541/open62541/tests/check_chunking.c:148:22: warning: implicit conversion changes signedness: 'size_t' (aka 'unsigned long') to 'intmax_t' (aka 'long') [-Wsign-conversion]
# ck_assert_int_eq(counter,9); //10 chunks allocated - callback called 4 times
add_definitions(-Wno-sign-conversion)
endif()

get_property(open62541_BUILD_INCLUDE_DIRS TARGET open62541 PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
include_directories(${open62541_BUILD_INCLUDE_DIRS})
# ua_server_internal.h
Expand Down
16 changes: 11 additions & 5 deletions tests/server/check_discovery.c
Expand Up @@ -312,9 +312,15 @@ FindOnNetworkAndCheck(UA_String expectedServerNames[], size_t expectedServerName
ck_assert_ptr_ne(serverOnNetwork, NULL);

if(serverOnNetwork != NULL) {
for(size_t i = 0; i < expectedServerNamesSize; i++)
ck_assert(UA_String_equal(&serverOnNetwork[i].serverName,
&expectedServerNames[i]));
for(size_t i = 0; i < expectedServerNamesSize; i++) {
UA_Boolean expectedServerNameInServerOnNetwork = false;
for(size_t j = 0; j < expectedServerNamesSize && !expectedServerNameInServerOnNetwork; j++) {
expectedServerNameInServerOnNetwork = UA_String_equal(&serverOnNetwork[j].serverName,
&expectedServerNames[i]);
}
ck_assert_msg(expectedServerNameInServerOnNetwork, "Expected %.*s in serverOnNetwork list, but not found",
expectedServerNames[i].length, expectedServerNames[i].data);
}
}

UA_Array_delete(serverOnNetwork, serverOnNetworkSize, &UA_TYPES[UA_TYPES_SERVERONNETWORK]);
Expand Down Expand Up @@ -510,8 +516,8 @@ END_TEST

#ifdef UA_ENABLE_DISCOVERY_MULTICAST
START_TEST(Util_wait_mdns) {
UA_fakeSleep(1000);
UA_realSleep(1000);
UA_fakeSleep(5000);
UA_realSleep(5000);
}
END_TEST
#endif
Expand Down
9 changes: 7 additions & 2 deletions tools/travis/travis_osx_script.sh
Expand Up @@ -25,6 +25,7 @@ cmake \
-DUA_BUILD_EXAMPLES=ON \
-DUA_NAMESPACE_ZERO=FULL ..
make -j
if [ $? -ne 0 ] ; then exit 1 ; fi
cd .. && rm -rf build
echo -en 'travis_fold:end:script.build.ns0\\r'

Expand All @@ -36,7 +37,9 @@ cmake \
-DUA_BUILD_EXAMPLES=ON \
-DUA_ENABLE_AMALGAMATION=OFF ..
make -j
if [ $? -ne 0 ] ; then exit 1 ; fi
make install
if [ $? -ne 0 ] ; then exit 1 ; fi
cd ..
tar -pczf open62541-osx.tar.gz LICENSE AUTHORS README.md ${TRAVIS_BUILD_DIR}/open62541-osx/*
rm -rf build
Expand All @@ -48,6 +51,7 @@ cmake \
-DUA_BUILD_EXAMPLES=ON \
-DUA_ENABLE_MULTITHREADING=ON ..
make -j
if [ $? -ne 0 ] ; then exit 1 ; fi
cd .. && rm -rf build
echo -en 'travis_fold:end:script.build.multithread\\r'

Expand All @@ -58,11 +62,12 @@ cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DUA_BUILD_EXAMPLES=ON \
-DUA_BUILD_UNIT_TESTS=ON \
-DUA_ENABLE_COVERAGE=ON \
-DUA_ENABLE_COVERAGE=OFF \
-DUA_ENABLE_DISCOVERY=ON \
-DUA_ENABLE_DISCOVERY_MULTICAST=ON \
-DUA_ENABLE_ENCRYPTION=ON \
-DUA_ENABLE_UNIT_TESTS_MEMCHECK=ON ..
-DUA_ENABLE_UNIT_TESTS_MEMCHECK=OFF ..
make -j && make test ARGS="-V"
if [ $? -ne 0 ] ; then exit 1 ; fi
cd .. && rm -rf build
echo -en 'travis_fold:end:script.build.unit_test\\r'
16 changes: 14 additions & 2 deletions tools/valgrind_check_error.py
Expand Up @@ -13,13 +13,15 @@
import subprocess
import os.path
import re
import os

logfile = sys.argv[1]

valgrind_command = ' '.join('"' + item + '"' for item in sys.argv[2:])

# Execute a command and output its stdout text
def execute(command):

process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

# Poll process for new output until finished
Expand All @@ -46,9 +48,19 @@ def execute(command):
print("### PYTHON ERROR: Valgrind logfile is empty: " + logfile)
exit(1)

# Remove output of possible bug in OSX
# --16672-- run: /usr/bin/dsymutil "/Users/travis/build/Pro/open62541/build/bin/tests/check_utils"
# --16672-- WARNING: unhandled amd64-darwin syscall: unix:464
# --16672-- You may be able to write your own handler.
# --16672-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
# --16672-- Nevertheless we consider this a bug. Please report
# --16672-- it at http://valgrind.org/support/bug_reports.html.
replace_re = re.compile(r"^--(\d+)--\s+run: .*-- it at http://valgrind.org/support/bug_reports.html\.$\n", re.MULTILINE | re.DOTALL)
log_content = replace_re.sub('', log_content)

# Try to parse the output. Look for the following line:
# ==17054== FILE DESCRIPTORS: 5 open at exit.
descriptors_re = re.compile(r"^==(\d+)==\s+FILE DESCRIPTORS: (\d+) open at exit.$", re.MULTILINE)
descriptors_re = re.compile(r".*==(\d+)==\s+FILE DESCRIPTORS: (\d+) open at exit\..*", re.DOTALL)
m = descriptors_re.match(log_content)

if not m:
Expand Down Expand Up @@ -83,7 +95,7 @@ def execute(command):
exit(ret_code)

# No issues by valgrind
if log_content.isspace():
if len(log_content) == 0 or log_content.isspace():
exit(0)

# There is something fishy in the valgrind output, so error-exit
Expand Down

0 comments on commit 78c15f9

Please sign in to comment.