From 80e581e8c1ca4bf75003dc8a8a10728d554127c3 Mon Sep 17 00:00:00 2001 From: fabik111 Date: Tue, 29 Apr 2025 17:57:46 +0200 Subject: [PATCH 1/4] add unit test workflow --- .github/workflows/unit-tests.yml | 56 ++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/unit-tests.yml diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 0000000..39718d2 --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,56 @@ +name: Unit Tests + +on: + pull_request: + paths: + - ".github/workflows/unit-tests.yml" + - 'extras/test/**' + - 'src/**' + + push: + paths: + - ".github/workflows/unit-tests.yml" + - 'extras/test/**' + - 'src/**' + +jobs: + test: + name: Run unit tests + runs-on: ubuntu-latest + + env: + COVERAGE_DATA_PATH: extras/coverage-data/coverage.info + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: arduino/cpp-test-action@main + with: + runtime-paths: | + - extras/test/build/bin/testNetworkConfigurator + coverage-exclude-paths: | + - '*/extras/test/*' + - '/usr/*' + coverage-data-path: ${{ env.COVERAGE_DATA_PATH }} + + # A token is used to avoid intermittent spurious job failures caused by rate limiting. + - name: Set up Codecov upload token + run: | + if [[ "${{ github.repository }}" == "arduino-libraries/Arduino_CloudUtils" ]]; then + # In order to avoid uploads of data from forks, only use the token for runs in the parent repo. + # Token is intentionally exposed. + # See: https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954 + CODECOV_TOKEN="bf6a7f2a-362b-43a8-ac34-c0fd5ef11d6a" + else + # codecov/codecov-action does unauthenticated upload if empty string is passed via the `token` input. + CODECOV_TOKEN="" + fi + echo "CODECOV_TOKEN=$CODECOV_TOKEN" >> "$GITHUB_ENV" + + - name: Upload coverage report to Codecov + uses: codecov/codecov-action@v3 + with: + file: "${{ env.COVERAGE_DATA_PATH }}" + fail_ci_if_error: true + token: ${{ env.CODECOV_TOKEN }} From 7bdb857955b99347fb82e0226bbad84b9673c830 Mon Sep 17 00:00:00 2001 From: fabik111 Date: Tue, 29 Apr 2025 21:07:39 +0200 Subject: [PATCH 2/4] fix test --- .github/workflows/unit-tests.yml | 2 +- extras/test/src/test_provisioning_command_encode.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 39718d2..8917a5d 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -37,7 +37,7 @@ jobs: # A token is used to avoid intermittent spurious job failures caused by rate limiting. - name: Set up Codecov upload token run: | - if [[ "${{ github.repository }}" == "arduino-libraries/Arduino_CloudUtils" ]]; then + if [[ "${{ github.repository }}" == "arduino-libraries/Arduino_NetworkConfigurator" ]]; then # In order to avoid uploads of data from forks, only use the token for runs in the parent repo. # Token is intentionally exposed. # See: https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954 diff --git a/extras/test/src/test_provisioning_command_encode.cpp b/extras/test/src/test_provisioning_command_encode.cpp index b0f7198..64872fc 100644 --- a/extras/test/src/test_provisioning_command_encode.cpp +++ b/extras/test/src/test_provisioning_command_encode.cpp @@ -123,6 +123,7 @@ { JWTProvisioningMessage command; command.c.id = ProvisioningMessageId::JWTProvisioningMessageId; + memset(command.jwt, 0x00, 269); memset(command.jwt, 0xCA, 268); uint8_t buffer[512]; size_t bytes_encoded = sizeof(buffer); From 36fad3d983d94e4f637e3bb8e70b62f58423b178 Mon Sep 17 00:00:00 2001 From: fabik111 Date: Wed, 30 Apr 2025 09:41:30 +0200 Subject: [PATCH 3/4] update codecov_token --- .github/workflows/unit-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 8917a5d..e69308f 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -41,7 +41,7 @@ jobs: # In order to avoid uploads of data from forks, only use the token for runs in the parent repo. # Token is intentionally exposed. # See: https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954 - CODECOV_TOKEN="bf6a7f2a-362b-43a8-ac34-c0fd5ef11d6a" + CODECOV_TOKEN="49f6e3b9-4c5b-40a0-ba75-0f5ce723a2ad" else # codecov/codecov-action does unauthenticated upload if empty string is passed via the `token` input. CODECOV_TOKEN="" From d05d62170bc05689f3c606048a78d3df3672c43b Mon Sep 17 00:00:00 2001 From: fabik111 Date: Wed, 30 Apr 2025 15:58:23 +0200 Subject: [PATCH 4/4] CBORDefinitions: fix comment --- .../boardConfigurationProtocol/cbor/ProvisioningMessage.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/ProvisioningMessage.h b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/ProvisioningMessage.h index ac9d467..97387d5 100644 --- a/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/ProvisioningMessage.h +++ b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/ProvisioningMessage.h @@ -105,7 +105,7 @@ struct UniqueHardwareIdProvisioningMessage { struct JWTProvisioningMessage { ProvisioningMessage c; struct { - char jwt[PROVISIONING_JWT_SIZE]; //The payload is an array of char with a maximum length of 268, not null terminated. It's not a string. + char jwt[PROVISIONING_JWT_SIZE]; //The payload is a string with maximum dimension of 268 characters + '\0'. }; }; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy