mirror of
https://github.com/open62541/open62541.git
synced 2025-06-03 04:00:21 +00:00
feat(ci): Build and run all examples with valgrind
This commit is contained in:
parent
1aa9c3e23d
commit
7c3a971b71
10
.github/workflows/build_linux.yml
vendored
10
.github/workflows/build_linux.yml
vendored
@ -82,12 +82,18 @@ jobs:
|
||||
- build_name: Amalgamation Build with Multithreading
|
||||
cmd_deps: ""
|
||||
cmd_action: build_amalgamation_mt
|
||||
- build_name: "Valgrind Build & Unit Tests with MbedTLS (gcc)"
|
||||
- build_name: "Valgrind Unit Tests with MbedTLS (gcc)"
|
||||
cmd_deps: sudo apt-get install -y -qq valgrind libmbedtls-dev
|
||||
cmd_action: unit_tests_valgrind MBEDTLS
|
||||
- build_name: "Valgrind Build & Unit Tests with OpenSSL (gcc)"
|
||||
- build_name: "Valgrind Unit Tests with OpenSSL (gcc)"
|
||||
cmd_deps: sudo apt-get install -y -qq valgrind openssl
|
||||
cmd_action: unit_tests_valgrind OPENSSL
|
||||
- build_name: "Valgrind Examples with MbedTLS (gcc)"
|
||||
cmd_deps: sudo apt-get install -y -qq valgrind libmbedtls-dev
|
||||
cmd_action: examples_valgrind MBEDTLS
|
||||
- build_name: "Valgrind Examples with OpenSSL (gcc)"
|
||||
cmd_deps: sudo apt-get install -y -qq valgrind openssl
|
||||
cmd_action: examples_valgrind OPENSSL
|
||||
- build_name: "Clang Static Analyzer"
|
||||
cmd_deps: sudo apt-get install -y -qq clang-11 clang-tools-11 libmbedtls-dev
|
||||
cmd_action: build_clang_analyzer
|
||||
|
43
tools/ci.sh
43
tools/ci.sh
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Exit immediately if a command exits with a non-zero status
|
||||
set -e
|
||||
set -e
|
||||
|
||||
# Use the error status of the first failure in a pipeline
|
||||
set -o pipefail
|
||||
@ -252,7 +252,6 @@ function unit_tests_encryption_mbedtls_pubsub {
|
||||
function unit_tests_valgrind {
|
||||
mkdir -p build; cd build; rm -rf *
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug \
|
||||
-DUA_BUILD_EXAMPLES=ON \
|
||||
-DUA_BUILD_UNIT_TESTS=ON \
|
||||
-DUA_ENABLE_DISCOVERY=ON \
|
||||
-DUA_ENABLE_DISCOVERY_MULTICAST=ON \
|
||||
@ -270,6 +269,46 @@ function unit_tests_valgrind {
|
||||
make test ARGS="-V"
|
||||
}
|
||||
|
||||
########################################
|
||||
# Build and Run Examples with Valgrind #
|
||||
########################################
|
||||
|
||||
function examples_valgrind {
|
||||
mkdir -p build; cd build; rm -rf *
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug \
|
||||
-DUA_BUILD_EXAMPLES=ON \
|
||||
-DUA_ENABLE_DISCOVERY=ON \
|
||||
-DUA_ENABLE_DISCOVERY_MULTICAST=ON \
|
||||
-DUA_ENABLE_ENCRYPTION=$1 \
|
||||
-DUA_ENABLE_SUBSCRIPTIONS_EVENTS=ON \
|
||||
-DUA_ENABLE_HISTORIZING=ON \
|
||||
-DUA_ENABLE_JSON_ENCODING=ON \
|
||||
-DUA_ENABLE_PUBSUB=ON \
|
||||
-DUA_ENABLE_PUBSUB_DELTAFRAMES=ON \
|
||||
-DUA_ENABLE_PUBSUB_INFORMATIONMODEL=ON \
|
||||
-DUA_ENABLE_PUBSUB_MONITORING=ON \
|
||||
-DUA_ENABLE_UNIT_TESTS_MEMCHECK=ON \
|
||||
..
|
||||
make ${MAKEOPTS}
|
||||
|
||||
# Run each example with valgrind. Wait 10 seconds and send the SIGINT
|
||||
# signal. Wait for the process to terminate and collect the exit status.
|
||||
# Abort when the exit status is non-null.
|
||||
FILES="./bin/examples/*"
|
||||
for f in $FILES
|
||||
do
|
||||
echo "Processing $f"
|
||||
valgrind --leak-check=yes --error-exitcode=1 $f &
|
||||
sleep 10
|
||||
kill -INT %1
|
||||
wait $!; EXIT_CODE=$?
|
||||
if [[ $EXIT_CODE -ne 0 ]]; then
|
||||
echo "Processing $f failed with exit code $EXIT_CODE "
|
||||
exit $EXIT_CODE
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
##############################
|
||||
# Clang Static Code Analysis #
|
||||
##############################
|
||||
|
Loading…
Reference in New Issue
Block a user