diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2b427cc..503b621 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,7 +47,7 @@ build_with_idf_v3: build_with_idf_v4: stage: build - image: ${CI_DOCKER_REGISTRY}/esp32-ci-env + image: ${CI_DOCKER_REGISTRY}/esp-env:v4.4-1 tags: - build dependencies: [] @@ -56,9 +56,12 @@ build_with_idf_v4: paths: - tidybuild/* expire_in: 1 day + variables: + PYTHON_VER: 3.6.13 script: - cit_add_ssh_key "${GITLAB_KEY}" - git clone "${IDF_REPO}" + - source /opt/pyenv/activate && pyenv global $PYTHON_VER - $MQTT_PATH/ci/set_idf.sh master - cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" - $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA @@ -72,6 +75,11 @@ build_with_idf_v4: - export EXTRA_CFLAGS=${PEDANTIC_CFLAGS} && export EXTRA_CXXFLAGS=${EXTRA_CFLAGS} # build other examples - $MQTT_PATH/ci/build_examples.sh + # rebuild with IDFv4.3 + - $MQTT_PATH/ci/set_idf.sh release/v4.3 + - cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" + - $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA + - $MQTT_PATH/ci/build_examples.sh # rebuild with IDFv4.2 - $MQTT_PATH/ci/set_idf.sh release/v4.2 - cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" @@ -90,26 +98,30 @@ build_with_idf_v4: build_and_test_qemu: stage: build - image: ${CI_DOCKER_REGISTRY}/qemu:esp-develop-20191124 + image: ${CI_DOCKER_REGISTRY}/qemu:esp-develop-20210517-dda2caf0 tags: - build - shiny dependencies: [] + variables: + PYTHON_VER: 3.7.0 script: - cit_add_ssh_key "${GITLAB_KEY}" - git clone "${IDF_REPO}" - - $MQTT_PATH/ci/set_idf.sh release/v4.1 + # switch to IDF and setup the right tools + - $MQTT_PATH/ci/set_idf.sh master + - source /opt/pyenv/activate && pyenv install $PYTHON_VER && pyenv global $PYTHON_VER - cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" + - ./install.sh && source export.sh + - python -m pip install -r $IDF_PATH/tools/ci/python_packages/ttfw_idf/requirements.txt && python -m pip install paho-mqtt - $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA - # build publish stress test - - cd $IDF_PATH/examples/protocols/mqtt/publish_test && cat sdkconfig.qemu | $IDF_PATH/tools/ci/envsubst.py >> sdkconfig.defaults && idf.py build - - source /opt/pyenv/activate && pyenv global 2.7.15 && python --version - # setup runner params + # build publish-connect stress test, setup test parameters + - cd tools/test_apps/protocols/mqtt/publish_connect_test && cat sdkconfig.qemu | $IDF_PATH/tools/ci/envsubst.py > sdkconfig.defaults && idf.py build + - export TEST_PATH=`pwd` && export MQTT_PUBLISH_TEST=1 - export PYTHONPATH="$IDF_PATH/tools:$IDF_PATH/tools/ci/python_packages" - - export TEST_CASE_PATH=$IDF_PATH/components/mqtt/weekend_test - - cd $IDF_PATH/tools/ci/python_packages/tiny_test_fw/bin # run test (with environment->qemu) - - python Runner.py $TEST_CASE_PATH -c $TEST_CASE_PATH/test_weekend_mqtt_qemu.yml -e $TEST_CASE_PATH/env.yml + - cd $IDF_PATH/tools/ci/python_packages/tiny_test_fw/bin + - python Runner.py $TEST_PATH -c $TEST_PATH/publish_connect_mqtt_qemu.yml -e $TEST_PATH/env.yml clang_tidy_check: stage: static_analysis diff --git a/include/mqtt_supported_features.h b/include/mqtt_supported_features.h index eaad295..6e49182 100644 --- a/include/mqtt_supported_features.h +++ b/include/mqtt_supported_features.h @@ -57,6 +57,10 @@ // Features supported in 4.3 #define MQTT_SUPPORTED_FEATURE_DIGITAL_SIGNATURE #define MQTT_SUPPORTED_FEATURE_TRANSPORT_SOCK_ERRNO_REPORTING +#endif + +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0) +// Features supported in 4.4 #define MQTT_SUPPORTED_FEATURE_CERTIFICATE_BUNDLE #endif diff --git a/lib/include/mqtt_outbox.h b/lib/include/mqtt_outbox.h index 21a10dd..7010e39 100644 --- a/lib/include/mqtt_outbox.h +++ b/lib/include/mqtt_outbox.h @@ -58,6 +58,7 @@ esp_err_t outbox_set_tick(outbox_handle_t outbox, int msg_id, outbox_tick_t tick int outbox_get_size(outbox_handle_t outbox); esp_err_t outbox_cleanup(outbox_handle_t outbox, int max_size); void outbox_destroy(outbox_handle_t outbox); +void outbox_delete_all_items(outbox_handle_t outbox); #ifdef __cplusplus } diff --git a/lib/mqtt_outbox.c b/lib/mqtt_outbox.c index 77ef3ec..e6fc12b 100644 --- a/lib/mqtt_outbox.c +++ b/lib/mqtt_outbox.c @@ -224,7 +224,7 @@ esp_err_t outbox_cleanup(outbox_handle_t outbox, int max_size) return ESP_OK; } -void outbox_destroy(outbox_handle_t outbox) +void outbox_delete_all_items(outbox_handle_t outbox) { outbox_item_handle_t item, tmp; STAILQ_FOREACH_SAFE(item, outbox, next, tmp) { @@ -232,6 +232,10 @@ void outbox_destroy(outbox_handle_t outbox) free(item->buffer); free(item); } +} +void outbox_destroy(outbox_handle_t outbox) +{ + outbox_delete_all_items(outbox); free(outbox); } diff --git a/mqtt_client.c b/mqtt_client.c index 14d91ea..f015de9 100644 --- a/mqtt_client.c +++ b/mqtt_client.c @@ -1491,6 +1491,7 @@ static void esp_mqtt_task(void *pv) } esp_transport_close(client->transport); + outbox_delete_all_items(client->outbox); xEventGroupSetBits(client->status_bits, STOPPED_BIT); vTaskDelete(NULL);