Fix issues reported by Coverity #3624
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build on Linux with CMake and execute tests | |
name: CI-cmake building linux | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref_name != 'master' }} | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: [opened, synchronize, reopened] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
build_type: | |
description: "Type of the build" | |
type: string | |
default: "Debug" | |
clang: | |
description: "Compile using clang" | |
required: false | |
type: boolean | |
default: false | |
install_mbedtls: | |
description: "Install mbedTLS and use it for the build" | |
required: false | |
type: boolean | |
default: false | |
install_tinycbor: | |
description: "Install tinyCBOR and use it for the build" | |
required: false | |
type: boolean | |
default: false | |
jobs: | |
cmake_linux: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# default (secure on, pki on, dynamic allocation on, tcp off, oscore on, cloud off, maintenance resource on, software update on, well-known core resource on, /oic/res observable, push notifications on, plgd-time on, etag on) | |
- args: "" | |
# ipv4 on | |
- args: "-DOC_IPV4_ENABLED=ON" | |
# access in RFOTM on | |
- args: "-DOC_RESOURCE_ACCESS_IN_RFOTM_ENABLED=ON" | |
# tcp on | |
- args: "-DOC_TCP_ENABLED=ON" | |
# ipv4 on, tcp on | |
- args: "-DOC_IPV4_ENABLED=ON -DOC_TCP_ENABLED=ON" | |
# ipv4 on, tcp on, pki off | |
- args: "-DOC_IPV4_ENABLED=ON -DOC_TCP_ENABLED=ON -DOC_PKI_ENABLED=OFF" | |
# cloud on (ipv4+tcp on), dynamic allocation off, push notifications off | |
- args: "-DOC_CLOUD_ENABLED=ON -DOC_DYNAMIC_ALLOCATION_ENABLED=OFF -DOC_PUSH_ENABLED=OFF" | |
# cloud on (ipv4+tcp on), collections create on, dps on, dps test properties on | |
- args: "-DOC_CLOUD_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DPLGD_DEV_DEVICE_PROVISIONING_ENABLED=ON -DPLGD_DEV_DEVICE_PROVISIONING_TEST_PROPERTIES_ENABLED=ON -DPLGD_DEV_DEVICE_PROVISIONING_MAXIMUM_LOG_LEVEL=INFO" | |
# cloud on (ipv4+tcp on), collections create on, custom message buffer size, custom message buffer pool size, custom app data buffer size, custom app data buffer pool size | |
- args: "-DOC_CLOUD_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_INOUT_BUFFER_SIZE=2048 -DOC_INOUT_BUFFER_POOL=4 -DOC_APP_DATA_BUFFER_SIZE=2048 -DOC_APP_DATA_BUFFER_POOL=4" | |
# debug on | |
- args: "-DOC_DEBUG_ENABLED=ON" | |
# debug on, cloud on (ipv4+tcp on), plgd time off | |
- args: "-DOC_CLOUD_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=OFF -DOC_DEBUG_ENABLED=ON" | |
# secure off, tcp on | |
- args: "-DOC_SECURITY_ENABLED=OFF -DOC_TCP_ENABLED=ON" | |
# secure off, ipv4 on, tcp on | |
- args: "-DOC_SECURITY_ENABLED=OFF -DOC_TCP_ENABLED=ON -DOC_IPV4_ENABLED=ON" | |
# rep realloc on, ocf 1.1 on | |
- args: "-DOC_REPRESENTATION_REALLOC_ENCODING_ENABLED=ON -DOC_VERSION_1_1_0_ENABLED=ON" | |
# everything off (dynamic allocation off, secure off, pki off, idd off, oscore off, well-known core resource off, software update off, maintenance resource off, /oic/res observable off, push notifications off, plgd-time off, introspection off, etag off) | |
- args: "-DOC_DYNAMIC_ALLOCATION_ENABLED=OFF -DOC_SECURITY_ENABLED=OFF -DOC_PKI_ENABLED=OFF -DOC_IDD_API_ENABLED=OFF -DOC_OSCORE_ENABLED=OFF -DOC_WKCORE_ENABLED=OFF -DOC_SOFTWARE_UPDATE_ENABLED=OFF -DOC_MNT_ENABLED=OFF -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=OFF -DOC_PUSH_ENABLED=OFF -DPLGD_DEV_TIME_ENABLED=OFF -DOC_INTROSPECTION_ENABLED=OFF -DOC_ETAG_ENABLED=OFF" | |
uses: ./.github/workflows/unit-test-with-cfg.yml | |
with: | |
build_args: -DOC_LOG_MAXIMUM_LOG_LEVEL=INFO -DOC_WKCORE_ENABLED=ON -DOC_SOFTWARE_UPDATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_PUSH_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON ${{ matrix.args }} | |
build_type: ${{ (github.event_name == 'workflow_dispatch' && inputs.build_type) || 'Debug' }} | |
clang: ${{ github.event_name == 'workflow_dispatch' && inputs.clang }} | |
coverage: false | |
install_mbedtls: ${{ github.event_name == 'workflow_dispatch' && inputs.install_mbedtls }} | |
install_tinycbor: ${{ github.event_name == 'workflow_dispatch' && inputs.install_tinycbor }} | |
cmake_linux_mbedtls3_5_0: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# debug on, cloud on (ipv4+tcp on), collections create on | |
- args: "-DOC_DEBUG_ENABLED=ON -DOC_CLOUD_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON" | |
uses: ./.github/workflows/unit-test-with-cfg.yml | |
with: | |
build_args: -DOC_LOG_MAXIMUM_LOG_LEVEL=INFO -DOC_WKCORE_ENABLED=ON -DOC_SOFTWARE_UPDATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_PUSH_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON -DBUILD_MBEDTLS_FORCE_3_5_0=ON ${{ matrix.args }} | |
build_type: ${{ (github.event_name == 'workflow_dispatch' && inputs.build_type) || 'Debug' }} | |
clang: ${{ github.event_name == 'workflow_dispatch' && inputs.clang }} | |
coverage: false | |
install_mbedtls: ${{ github.event_name == 'workflow_dispatch' && inputs.install_mbedtls }} | |
install_tinycbor: ${{ github.event_name == 'workflow_dispatch' && inputs.install_tinycbor }} | |
cmake_linux_preinstalled: | |
uses: ./.github/workflows/unit-test-with-cfg.yml | |
with: | |
# cloud on (ipv4+tcp on), collections create on, maintenance resource on, well-known core resource on, software update on, /oic/res observable on, push notification on, plgd-time on, etag on | |
build_args: -DOC_LOG_MAXIMUM_LOG_LEVEL=INFO -DOC_CLOUD_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_WKCORE_ENABLED=ON -DOC_SOFTWARE_UPDATE_ENABLED=ON -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_PUSH_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON | |
build_type: ${{ (github.event_name == 'workflow_dispatch' && inputs.build_type) || 'Debug' }} | |
clang: ${{ github.event_name == 'workflow_dispatch' && inputs.clang }} | |
coverage: false | |
install_mbedtls: ${{ github.event_name != 'workflow_dispatch' }} | |
install_tinycbor: ${{ github.event_name != 'workflow_dispatch' }} | |
cmake_linux_sanitized: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# address sanitizer | |
- args: -DOC_ASAN_ENABLED=ON | |
install_faketime: true | |
# leak sanitizer | |
- args: -DOC_LSAN_ENABLED=ON | |
# there is some linker issue when LSAN and faketime are used together | |
install_faketime: false | |
# thread sanitizer | |
- args: -DOC_TSAN_ENABLED=ON | |
# GCC thread-sanitizer keeps reporting false positives, so we use clang instead for tests with thread-sanitizer | |
clang: true | |
install_faketime: false | |
# static allocation requires additional thread synchronization | |
- args: -DOC_TSAN_ENABLED=ON -DOC_DYNAMIC_ALLOCATION_ENABLED=OFF | |
# GCC thread-sanitizer keeps reporting false positives, so we use clang instead for tests with thread-sanitizer | |
clang: true | |
install_faketime: false | |
# undefined behaviour sanitizer | |
- args: -DOC_UBSAN_ENABLED=ON | |
install_faketime: true | |
# TODO: update gtest | |
# - args: -DOC_MSAN_ENABLED=ON | |
# install_faketime: true | |
uses: ./.github/workflows/unit-test-with-cfg.yml | |
with: | |
build_args: -DOC_LOG_MAXIMUM_LOG_LEVEL=INFO -DOC_CLOUD_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_WKCORE_ENABLED=ON -DOC_SOFTWARE_UPDATE_ENABLED=ON -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_PUSH_ENABLED=ON -DOC_RESOURCE_ACCESS_IN_RFOTM_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON -DPLGD_DEV_DEVICE_PROVISIONING_ENABLED=ON -DPLGD_DEV_DEVICE_PROVISIONING_TEST_PROPERTIES_ENABLED=ON ${{ matrix.args }} | |
build_type: ${{ (github.event_name == 'workflow_dispatch' && inputs.build_type) || 'Debug' }} | |
clang: ${{ ((github.event_name == 'workflow_dispatch' && inputs.clang) || matrix.clang) || false }} | |
coverage: false | |
install_mbedtls: ${{ github.event_name == 'workflow_dispatch' && inputs.install_mbedtls }} | |
install_tinycbor: ${{ github.event_name == 'workflow_dispatch' && inputs.install_tinycbor }} | |
install_faketime: ${{ matrix.install_faketime }} |