Skip to content

Commit 27a65cb

Browse files
authored
Merge pull request #993 from david-cermak/bump/asio_1.32.0_1
[asio]: Bump v1.32.0~1
2 parents 1347113 + 8d72233 commit 27a65cb

File tree

10 files changed

+136
-28
lines changed

10 files changed

+136
-28
lines changed

.github/workflows/asio__build-target-test.yml

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ jobs:
1313
name: Build
1414
strategy:
1515
matrix:
16-
idf_ver: ["latest", "release-v5.0", "release-v5.1", "release-v5.2", "release-v5.3", "release-v5.4"]
16+
idf_ver: ["latest", "release-v5.1", "release-v5.2", "release-v5.3", "release-v5.4", "release-v5.5", "release-v6.0"]
1717
idf_target: ["esp32", "esp32s2"]
18-
example: ["asio_chat", "async_request", "socks4", "ssl_client_server", "tcp_echo_server", "udp_echo_server"]
18+
example: ["asio_chat", "async_request", "socks4", "ssl_client_server", "tcp_echo_server", "udp_echo_server", "unit"]
1919
runs-on: ubuntu-22.04
2020
container: espressif/idf:${{ matrix.idf_ver }}
2121
env:
22-
TEST_DIR: components/asio/examples
22+
APP_DIR: ${{ matrix.example == 'unit' && 'components/asio/tests/unit' || format('components/asio/examples/{0}', matrix.example) }}
2323
steps:
2424
- name: Checkout esp-protocols
2525
uses: actions/checkout@v4
2626
with:
2727
submodules: recursive
2828
- name: Build ${{ matrix.example }} with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
29-
working-directory: ${{ env.TEST_DIR }}/${{ matrix.example }}
29+
working-directory: ${{ env.APP_DIR }}
3030
env:
3131
IDF_TARGET: ${{ matrix.idf_target }}
3232
shell: bash
@@ -35,25 +35,12 @@ jobs:
3535
test -f sdkconfig.ci && cat sdkconfig.ci >> sdkconfig.defaults || echo "No sdkconfig.ci"
3636
idf.py set-target ${{ matrix.idf_target }}
3737
idf.py build
38-
- name: Merge binaries with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }} for ${{ matrix.example }}
39-
working-directory: ${{ env.TEST_DIR }}/${{ matrix.example }}/build
40-
env:
41-
IDF_TARGET: ${{ matrix.idf_target }}
42-
shell: bash
43-
run: |
44-
. ${IDF_PATH}/export.sh
45-
esptool.py --chip ${{ matrix.idf_target }} merge_bin --fill-flash-size 4MB -o flash_image.bin @flash_args
38+
$GITHUB_WORKSPACE/ci/clean_build_artifacts.sh `pwd`/build
39+
zip -qur artifacts.zip build
4640
- uses: actions/upload-artifact@v4
4741
with:
4842
name: examples_app_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.example }}
49-
path: |
50-
${{ env.TEST_DIR }}/${{ matrix.example }}/build/bootloader/bootloader.bin
51-
${{ env.TEST_DIR }}/${{ matrix.example }}/build//partition_table/partition-table.bin
52-
${{ env.TEST_DIR }}/${{ matrix.example }}/build/*.bin
53-
${{ env.TEST_DIR }}/${{ matrix.example }}/build/*.elf
54-
${{ env.TEST_DIR }}/${{ matrix.example }}/build/flasher_args.json
55-
${{ env.TEST_DIR }}/${{ matrix.example }}/build/config/sdkconfig.h
56-
${{ env.TEST_DIR }}/${{ matrix.example }}/build/config/sdkconfig.json
43+
path: ${{ env.APP_DIR }}/artifacts.zip
5744
if-no-files-found: error
5845

5946
target_tests_asio:
@@ -64,25 +51,25 @@ jobs:
6451
name: Target tests
6552
strategy:
6653
matrix:
67-
idf_ver: ["latest", "release-v5.1", "release-v5.2", "release-v5.3", "release-v5.4"]
54+
idf_ver: ["latest", "release-v5.3", "release-v5.4", "release-v5.5", "release-v6.0"]
6855
idf_target: ["esp32"]
69-
example: ["asio_chat", "tcp_echo_server", "udp_echo_server", "ssl_client_server"]
56+
example: ["asio_chat", "tcp_echo_server", "udp_echo_server", "ssl_client_server", "unit"]
7057
needs: build_asio
7158
runs-on:
7259
- self-hosted
7360
- ESP32-ETHERNET-KIT
7461
env:
75-
TEST_DIR: components/asio/examples
62+
APP_DIR: ${{ matrix.example == 'unit' && 'components/asio/tests/unit' || format('components/asio/examples/{0}', matrix.example) }}
7663
steps:
7764
- name: Clear repository
7865
run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE
7966
- uses: actions/checkout@v4
8067
- uses: actions/download-artifact@v4
8168
with:
8269
name: examples_app_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.example }}
83-
path: ${{ env.TEST_DIR }}/${{ matrix.example }}/build
70+
path: ${{ env.APP_DIR }}
8471
- name: Run Example Test ${{ matrix.example }} on target
85-
working-directory: ${{ env.TEST_DIR }}/${{ matrix.example }}
72+
working-directory: ${{ env.APP_DIR }}
8673
run: |
8774
export PYENV_ROOT="$HOME/.pyenv"
8875
export PATH="$PYENV_ROOT/bin:$PATH"
@@ -98,9 +85,10 @@ jobs:
9885
fi
9986
pyenv activate myenv
10087
python --version
88+
unzip artifacts.zip -d .
10189
python -m pytest --log-cli-level DEBUG --junit-xml=./examples_results_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.config }}.xml --target=${{ matrix.idf_target }}
10290
- uses: actions/upload-artifact@v4
10391
if: always()
10492
with:
10593
name: examples_results_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.example }}
106-
path: ${{ env.TEST_DIR }}/${{ matrix.example }}/*.xml
94+
path: ${{ env.APP_DIR }}/*.xml

components/asio/.cz.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ commitizen:
33
bump_message: 'bump(asio): $current_version -> $new_version'
44
pre_bump_hooks: python ../../ci/changelog.py asio
55
tag_format: asio-v$version
6-
version: 1.32.0
6+
version: 1.32.0~1
77
version_files:
88
- idf_component.yml

components/asio/CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# Changelog
22

3+
## [1.32.0~1](https://github.com/espressif/esp-protocols/commits/asio-v1.32.0_1)
4+
5+
### Features
6+
7+
- Add mbedtls specific APIs to use TLS stack specific features ([ad94cc95](https://github.com/espressif/esp-protocols/commit/ad94cc95))
8+
9+
### Bug Fixes
10+
11+
- Add a simple unit test to check the leaks ([c3b01688](https://github.com/espressif/esp-protocols/commit/c3b01688))
12+
- Use mbedtls-v4 API (PSA-crypto support) ([a465ad41](https://github.com/espressif/esp-protocols/commit/a465ad41))
13+
- memory leaks over ssl::stream lifetime ([d33cb616](https://github.com/espressif/esp-protocols/commit/d33cb616))
14+
- Fix picolib missing pthread_sigmask() declaration ([25d54efd](https://github.com/espressif/esp-protocols/commit/25d54efd))
15+
- Fixed TLS server-client example failure per cert expiry ([4885d282](https://github.com/espressif/esp-protocols/commit/4885d282))
16+
17+
### Updated
18+
19+
- change mbedtls_*_free destruction order ([9590aecc](https://github.com/espressif/esp-protocols/commit/9590aecc))
20+
- chore(asio): Fixed formatting ([ff5d6021](https://github.com/espressif/esp-protocols/commit/ff5d6021))
21+
322
## [1.32.0](https://github.com/espressif/esp-protocols/commits/asio-v1.32.0)
423

524
### Features

components/asio/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "1.32.0"
1+
version: "1.32.0~1"
22
description: Cross-platform C++ library for network and I/O programming
33
url: https://github.com/espressif/esp-protocols/tree/master/components/asio
44
issues: https://github.com/espressif/esp-protocols/issues
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This is the project CMakeLists.txt file for the test subproject
2+
cmake_minimum_required(VERSION 3.16)
3+
4+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
5+
6+
if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER_EQUAL "6.0")
7+
set(test_component_dir $ENV{IDF_PATH}/tools/test_apps/components)
8+
else()
9+
set(test_component_dir $ENV{IDF_PATH}/tools/unit-test-app/components)
10+
endif()
11+
12+
set(EXTRA_COMPONENT_DIRS ../..
13+
${test_component_dir})
14+
15+
project(asio_ssl_unit_test)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
idf_component_register(SRCS "test_asio_ssl.cpp"
2+
# REQUIRES test_utils
3+
INCLUDE_DIRS ".")
4+
# PRIV_REQUIRES unity asio)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
dependencies:
2+
idf: ">=5.1"
3+
espressif/asio:
4+
version: "^1.14.1"
5+
override_path: "../../../"
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Unlicense OR CC0-1.0
5+
*/
6+
7+
#include "unity.h"
8+
extern "C" // workaround for unity headers (possibly) without C++ guards
9+
{
10+
#include "unity_fixture.h"
11+
}
12+
#include "test_utils.h"
13+
#include "memory_checks.h"
14+
#include "esp_netif.h"
15+
#include "esp_event.h"
16+
17+
#include "asio.hpp"
18+
#include "asio/ssl.hpp"
19+
20+
static void create_stream_and_attempt_handshake()
21+
{
22+
asio::io_context io;
23+
asio::ssl::context ctx(asio::ssl::context::tlsv12_client);
24+
asio::ssl::stream<asio::ip::tcp::socket> stream(io, ctx);
25+
stream.set_verify_mode(asio::ssl::verify_none);
26+
27+
asio::error_code ec;
28+
stream.handshake(asio::ssl::stream_base::client, ec);
29+
}
30+
31+
32+
TEST_GROUP(asio_ssl);
33+
34+
TEST_SETUP(asio_ssl)
35+
{
36+
// call once to allocate all one time inits
37+
create_stream_and_attempt_handshake();
38+
test_utils_record_free_mem();
39+
}
40+
41+
TEST_TEAR_DOWN(asio_ssl)
42+
{
43+
// account for some timer-based lwip allocations
44+
test_utils_finish_and_evaluate_leaks(128, 256);
45+
}
46+
47+
48+
TEST(asio_ssl, ssl_stream_lifecycle_no_leak)
49+
{
50+
test_case_uses_tcpip();
51+
create_stream_and_attempt_handshake();
52+
TEST_ASSERT_TRUE(true);
53+
}
54+
55+
TEST_GROUP_RUNNER(asio_ssl)
56+
{
57+
RUN_TEST_CASE(asio_ssl, ssl_stream_lifecycle_no_leak)
58+
}
59+
60+
extern "C" void app_main(void)
61+
{
62+
esp_netif_init();
63+
esp_event_loop_create_default();
64+
UNITY_MAIN(asio_ssl);
65+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
from pytest_embedded import Dut
5+
6+
7+
def test_asio_ssl_unit(dut: Dut) -> None:
8+
dut.expect_unity_test_output()
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CONFIG_COMPILER_CXX_EXCEPTIONS=y
2+
CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=n
3+
CONFIG_UNITY_ENABLE_FIXTURE=y
4+
CONFIG_ASIO_SSL_SUPPORT=y

0 commit comments

Comments
 (0)