Skip to content

Commit

Permalink
Fix name of environmental variable for UDP tests
Browse files Browse the repository at this point in the history
The name of the environmental variable in the Dockerfile for
plgd-dev/hub/test-cloud-server that enables UDP protocol
is COAP_GATEWAY_UDP_ENABLED.
  • Loading branch information
Danielius1922 authored Apr 28, 2023
1 parent e1d2c58 commit 112f18f
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 32 deletions.
28 changes: 21 additions & 7 deletions .github/workflows/plgd-device-test-with-cfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ name: Run plgd/device test with cloud_server and a single configuration
on:
workflow_call:
inputs:
name:
type: string
required: true
build_args:
description: build arguments forwarded to CMake in docker/apps/Dockerfile.cloud-server-debug
type: string
required: true
build_type:
Expand All @@ -31,6 +29,14 @@ on:
type: boolean
required: false
default: false
name:
type: string
required: true
skip:
description: Skip this run of the job
type: boolean
required: false
default: false
env:
TEST_CLOUD_SERVER_IMAGE: ghcr.io/plgd-dev/device/test-cloud-server:latest
CERT_TOOL_IMAGE: ghcr.io/plgd-dev/hub/cert-tool:vnext
Expand All @@ -40,6 +46,7 @@ env:

jobs:
plgd-device-test-with-cfg:
if: ${{ !inputs.skip }}
runs-on: ubuntu-22.04

steps:
Expand Down Expand Up @@ -92,6 +99,13 @@ jobs:
docker run --rm --network=host -v `pwd`/${{ env.CERT_PATH }}:/pki_certs ${{ env.TEST_CLOUD_SERVER_IMAGE }} \
-test.parallel 1 -test.v
- name: Get output file name
if: ${{ inputs.coverage }}
id: coverage
run: |
SUFFIX=`echo "-DCMAKE_BUILD_TYPE=${{ inputs.build_type }} ${{ inputs.build_args }} ${{ inputs.name }} -DBUILD_TESTING=ON" | sha1sum | cut -f 1 -d ' '`
echo "filename=coverage-plgd-device-${SUFFIX}.json" >> $GITHUB_OUTPUT
- name: Gather coverage data
if: ${{ inputs.coverage }}
run: |
Expand All @@ -101,14 +115,14 @@ jobs:
docker start ${{ inputs.name }}
# see Dockerfile.cloud-server-debug for the absolute path with the iotivity-lite checkout
docker exec --workdir "/iotivity-lite/tools" ${{ inputs.name }} /bin/bash -c "./collect-coverage.sh \
--output /data/coverage/coverage-plgd-device.json"
--output /data/coverage/${{ steps.coverage.outputs.filename }}"
- name: Upload coverage data
if: ${{ inputs.coverage }}
uses: actions/upload-artifact@v3
with:
name: plgd-device-coverage
path: data/coverage/coverage-plgd-device.json
path: data/coverage/${{ steps.coverage.outputs.filename }}
if-no-files-found: error
retention-days: 1

Expand All @@ -123,8 +137,8 @@ jobs:
if: ${{ failure() }}
run: cat `pwd`/data/0.log

- name: Collect sanitizers cloud server logs when the test fails
if: ${{ failure() }}
- name: Collect sanitizers cloud server logs
if: ${{ always() }}
run: |
if ls `pwd`/data/0.asan.log* 1> /dev/null 2>&1; then \
sudo cat `pwd`/data/0.asan.log*; \
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/plgd-device-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
include:
- name: cloud-server
args: ""
# same configuration as "cloud-server-debug" in the SonarCloud scan job, skip for events that trigger both jobs
skip: ${{ github.event_name != 'workflow_dispatch' }}
- name: cloud-server-asan
args: "-DOC_ASAN_ENABLED=ON"
- name: cloud-server-tsan
Expand Down Expand Up @@ -86,3 +88,4 @@ jobs:
build_type: Debug
cert_signature_algorithm: ${{ (github.event_name == 'workflow_dispatch' && inputs.cert_signature_algorithm) || 'ECDSA-SHA256' }}
cert_elliptic_curve: ${{ (github.event_name == 'workflow_dispatch' && inputs.cert_elliptic_curve) || 'P256' }}
skip: ${{ matrix.skip || false }}
21 changes: 17 additions & 4 deletions .github/workflows/plgd-hub-test-with-cfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ on:
description: name of the docker container with running cloud_server
type: string
required: true
skip:
description: Skip this run of the job
type: boolean
required: false
default: false

env:
TEST_CLOUD_SERVER_IMAGE: ghcr.io/plgd-dev/hub/test-cloud-server:latest
Expand All @@ -57,6 +62,7 @@ env:

jobs:
plgd-hub-test-with-cfg:
if: ${{ !inputs.skip }}
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
Expand Down Expand Up @@ -86,6 +92,13 @@ jobs:
- name: Run plgd hub tests image
run: docker run --rm --network=host ${{ inputs.hub_args }} ${{ env.TEST_CLOUD_SERVER_IMAGE }}

- name: Get output file name
if: ${{ inputs.coverage }}
id: coverage
run: |
SUFFIX=`echo "-DCMAKE_BUILD_TYPE=${{ inputs.build_type }} ${{ inputs.build_args }} ${{ inputs.docker_args }} ${{ inputs.hub_args }} ${{ inputs.name }} -DBUILD_TESTING=ON" | sha1sum | cut -f 1 -d ' '`
echo "filename=coverage-plgd-hub-${SUFFIX}.json" >> $GITHUB_OUTPUT
- name: Gather coverage data
if: ${{ inputs.coverage }}
run: |
Expand All @@ -94,14 +107,14 @@ jobs:
# restart to generate report from the .gcda files
docker start ${{ inputs.name }}
# see Dockerfile.cloud-server-debug for the absolute path with the iotivity-lite checkout
docker exec --workdir "/iotivity-lite/tools" ${{ inputs.name }} /bin/bash -c "./collect-coverage.sh --output /data/coverage/coverage-plgd-hub.json"
docker exec --workdir "/iotivity-lite/tools" ${{ inputs.name }} /bin/bash -c "./collect-coverage.sh --output /data/coverage/${{ steps.coverage.outputs.filename }}"
- name: Upload coverage data
if: ${{ inputs.coverage }}
uses: actions/upload-artifact@v3
with:
name: plgd-hub-coverage
path: data/coverage/coverage-plgd-hub.json
path: data/coverage/${{ steps.coverage.outputs.filename }}
if-no-files-found: error
retention-days: 1

Expand All @@ -116,8 +129,8 @@ jobs:
if: ${{ failure() }}
run: cat `pwd`/data/0.log

- name: Collect sanitizers cloud server logs when the test fails
if: ${{ failure() }}
- name: Collect sanitizers cloud server logs
if: ${{ always() }}
run: |
if ls `pwd`/data/0.asan.log* 1> /dev/null 2>&1; then \
sudo cat `pwd`/data/0.asan.log*; \
Expand Down
31 changes: 18 additions & 13 deletions .github/workflows/plgd-hub-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
include:
- name: cloud-server
build_args: ""
# same configuration as "cloud-server-debug" in the SonarCloud scan job, skip for events that trigger both jobs
skip: ${{ github.event_name != 'workflow_dispatch' }}
- name: cloud-server-asan
build_args: "-DOC_ASAN_ENABLED=ON"
- name: cloud-server-tsan
Expand Down Expand Up @@ -116,51 +118,54 @@ jobs:

- name: dtls-cloud-server
build_args: ""
hub_args: "-e TEST_COAP_GATEWAY_UDP_ENABLED=true"
hub_args: "-e COAP_GATEWAY_UDP_ENABLED=true"
# same configuration as "dtls-cloud-server-debug" in the SonarCloud scan job, skip for events that trigger both jobs
skip: ${{ github.event_name != 'workflow_dispatch' }}
- name: dtls-cloud-server-asan
build_args: "-DOC_ASAN_ENABLED=ON"
hub_args: "-e TEST_COAP_GATEWAY_UDP_ENABLED=true"
hub_args: "-e COAP_GATEWAY_UDP_ENABLED=true"
- name: dtls-cloud-server-tsan
build_args: "-DOC_TSAN_ENABLED=ON"
hub_args: "-e TEST_COAP_GATEWAY_UDP_ENABLED=true"
hub_args: "-e COAP_GATEWAY_UDP_ENABLED=true"

- name: dtls-cloud-server-discovery-resource-observable
build_args: "-DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON"
hub_args: "-e TEST_COAP_GATEWAY_UDP_ENABLED=true"
hub_args: "-e COAP_GATEWAY_UDP_ENABLED=true"
- name: dtls-cloud-server-discovery-resource-observable-asan
build_args: "-DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_ASAN_ENABLED=ON"
hub_args: "-e TEST_COAP_GATEWAY_UDP_ENABLED=true"
hub_args: "-e COAP_GATEWAY_UDP_ENABLED=true"
- name: dtls-cloud-server-discovery-resource-observable-tsan
build_args: "-DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_TSAN_ENABLED=ON"
hub_args: "-e TEST_COAP_GATEWAY_UDP_ENABLED=true"
hub_args: "-e COAP_GATEWAY_UDP_ENABLED=true"

- name: dtls-cloud-server-rep-realloc
build_args: "-DOC_REPRESENTATION_REALLOC_ENCODING_ENABLED=ON"
hub_args: "-e TEST_COAP_GATEWAY_UDP_ENABLED=true"
hub_args: "-e COAP_GATEWAY_UDP_ENABLED=true"
- name: dtls-cloud-server-rep-realloc-asan
build_args: "-DOC_REPRESENTATION_REALLOC_ENCODING_ENABLED=ON -DOC_ASAN_ENABLED=ON"
hub_args: "-e TEST_COAP_GATEWAY_UDP_ENABLED=true"
hub_args: "-e COAP_GATEWAY_UDP_ENABLED=true"
- name: dtls-cloud-server-rep-realloc-tsan
build_args: "-DOC_REPRESENTATION_REALLOC_ENCODING_ENABLED=ON -DOC_TSAN_ENABLED=ON"
hub_args: "-e TEST_COAP_GATEWAY_UDP_ENABLED=true"
hub_args: "-e COAP_GATEWAY_UDP_ENABLED=true"

- name: dtls-cloud-server-discovery-resource-observable-rep-realloc
build_args: "-DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_REPRESENTATION_REALLOC_ENCODING_ENABLED=ON"
hub_args: "-e TEST_COAP_GATEWAY_UDP_ENABLED=true"
hub_args: "-e COAP_GATEWAY_UDP_ENABLED=true"
- name: dtls-cloud-server-discovery-resource-observable-rep-realloc-asan
build_args: "-DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_REPRESENTATION_REALLOC_ENCODING_ENABLED=ON -DOC_ASAN_ENABLED=ON"
hub_args: "-e TEST_COAP_GATEWAY_UDP_ENABLED=true"
hub_args: "-e COAP_GATEWAY_UDP_ENABLED=true"
- name: dtls-cloud-server-discovery-resource-observable-rep-realloc-tsan
build_args: "-DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_REPRESENTATION_REALLOC_ENCODING_ENABLED=ON -DOC_TSAN_ENABLED=ON"
hub_args: "-e TEST_COAP_GATEWAY_UDP_ENABLED=true"
hub_args: "-e COAP_GATEWAY_UDP_ENABLED=true"

uses: ./.github/workflows/plgd-hub-test-with-cfg.yml
with:
name: ${{ matrix.name }}
build_args: -DOC_DEBUG_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_OSCORE_ENABLED=OFF ${{ matrix.build_args }}
build_args: -DOC_DEBUG_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_OSCORE_ENABLED=OFF -DOC_RESOURCE_ACCESS_IN_RFOTM_ENABLED=ON ${{ matrix.build_args }}
build_type: Debug
hub_args: ${{ matrix.hub_args }}
args: ${{ matrix.args }}
docker_args: ${{ matrix.docker_args }}
cert_signature_algorithm: ${{ (github.event_name == 'workflow_dispatch' && inputs.cert_signature_algorithm) || 'ECDSA-SHA256' }}
cert_elliptic_curve: ${{ (github.event_name == 'workflow_dispatch' && inputs.cert_elliptic_curve) || 'P256' }}
skip: ${{ matrix.skip || false }}
21 changes: 15 additions & 6 deletions .github/workflows/sonar-cloud-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,44 @@ jobs:
fail-fast: false
matrix:
include:
- args: "-DOC_CLOUD_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_PUSH_ENABLED=ON -DOC_RESOURCE_ACCESS_IN_RFOTM_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON"
- build_args: "-DOC_CLOUD_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_PUSH_ENABLED=ON -DOC_RESOURCE_ACCESS_IN_RFOTM_ENABLED=ON"
# dynamic allocation off
- args: "-DOC_DYNAMIC_ALLOCATION_ENABLED=OFF -DOC_RESOURCE_ACCESS_IN_RFOTM_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON"
- build_args: "-DOC_DYNAMIC_ALLOCATION_ENABLED=OFF -DOC_RESOURCE_ACCESS_IN_RFOTM_ENABLED=ON"
# security off
- args: "-DOC_SECURITY_ENABLED=OFF -DOC_CLOUD_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_PUSH_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON"
- build_args: "-DOC_SECURITY_ENABLED=OFF -DOC_CLOUD_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_PUSH_ENABLED=ON"

uses: ./.github/workflows/unit-test-with-cfg.yml
with:
build_args: "-DOC_MNT_ENABLED=ON -DOC_WKCORE_ENABLED=ON -DOC_SOFTWARE_UPDATE_ENABLED=ON ${{ matrix.args }}"
build_args: "-DOC_MNT_ENABLED=ON -DOC_WKCORE_ENABLED=ON -DOC_SOFTWARE_UPDATE_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON ${{ matrix.build_args }}"
build_type: Debug
coverage: true

plgd-device-tests:
uses: ./.github/workflows/plgd-device-test-with-cfg.yml
with:
name: cloud-server-debug
build_args: "-DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_OSCORE_ENABLED=OFF -DBUILD_TESTING=ON"
build_args: "-DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_OSCORE_ENABLED=OFF"
build_type: Debug
cert_signature_algorithm: ECDSA-SHA384
cert_elliptic_curve: P384
coverage: true

plgd-hub-tests:
strategy:
fail-fast: false
matrix:
include:
- name: cloud-server-debug
hub_args: ""
- name: dtls-cloud-server-debug
hub_args: "-e COAP_GATEWAY_UDP_ENABLED=true"
uses: ./.github/workflows/plgd-hub-test-with-cfg.yml
with:
name: cloud-server-debug
name: ${{ matrix.name }}
build_args: "-DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_OSCORE_ENABLED=OFF -DOC_RESOURCE_ACCESS_IN_RFOTM_ENABLED=ON -DBUILD_TESTING=ON"
build_type: Debug
coverage: true
hub_args: ${{ matrix.hub_args }}

sonar-cloud-scan:
name: Sonar Cloud scan
Expand Down
4 changes: 2 additions & 2 deletions docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ mkdir -p /tmp/logbt-coredumps
pids=()
echo "called_from_lib:libfaketimeMT.so.1" > /tmp/tsan.suppressions
for ((i=0;i<$NUM_DEVICES;i++)); do
export ASAN_OPTIONS="verbosity=1:atexit=1:log_path=/tmp/${i}.asan.log:verify_asan_link_order=0"
export ASAN_OPTIONS="atexit=1:log_path=/tmp/${i}.asan.log:verify_asan_link_order=0"
# abort on first tsan problem found
export TSAN_OPTIONS="verbosity=1:halt_on_error=1:abort_on_error=1:log_path=/tmp/${i}.tsan.log:suppressions=/tmp/tsan.suppressions"
export TSAN_OPTIONS="halt_on_error=1:abort_on_error=1:log_path=/tmp/${i}.tsan.log:suppressions=/tmp/tsan.suppressions"
export LD_PRELOAD=/usr/local/lib/faketime/libfaketimeMT.so.1
${PREFIX_EXEC} /iotivity-lite/port/linux/service $@ > /tmp/$i.log 2>&1 &
pids+=($!)
Expand Down

0 comments on commit 112f18f

Please sign in to comment.