mirror of
https://github.com/espressif/esp-mqtt.git
synced 2025-07-29 18:28:24 +02:00
Merge branch 'fix/host_test' into 'master'
Adds mqtt host tests to Ci See merge request espressif/esp-mqtt!181
This commit is contained in:
@ -49,6 +49,16 @@ build_idf_latest:
|
||||
extends: .build_template
|
||||
image: espressif/idf:latest
|
||||
|
||||
build_and_host_test:
|
||||
stage: build
|
||||
image: espressif/idf:latest
|
||||
script:
|
||||
# Replace the IDF's default esp-mqtt with this version
|
||||
- rm -rf $IDF_PATH/components/mqtt/esp-mqtt && cp -r $MQTT_PATH $IDF_PATH/components/mqtt/
|
||||
- cd $IDF_PATH/components/mqtt/esp-mqtt/host_test
|
||||
- idf.py build
|
||||
- build/host_mqtt_client_test.elf
|
||||
|
||||
build_and_test_qemu:
|
||||
stage: build
|
||||
image: ${CI_DOCKER_REGISTRY}/qemu-v5.1:1-20220802
|
||||
|
@ -4,6 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <memory>
|
||||
#include <net/if.h>
|
||||
#include <random>
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
@ -51,7 +52,6 @@ using unique_mqtt_client = std::unique_ptr < std::remove_pointer_t<esp_mqtt_clie
|
||||
|
||||
SCENARIO("MQTT Client Operation")
|
||||
{
|
||||
// [[maybe_unused]] auto protect = TEST_PROTECT();
|
||||
// Set expectations for the mocked calls.
|
||||
int mtx = 0;
|
||||
int transport_list = 0;
|
||||
@ -76,6 +76,7 @@ SCENARIO("MQTT Client Operation")
|
||||
esp_read_mac_IgnoreAndReturn(ESP_OK);
|
||||
esp_read_mac_ReturnThruPtr_mac(mac);
|
||||
esp_transport_list_destroy_IgnoreAndReturn(ESP_OK);
|
||||
esp_transport_destroy_IgnoreAndReturn(ESP_OK);
|
||||
vEventGroupDelete_Ignore();
|
||||
vQueueDelete_Ignore();
|
||||
GIVEN("An a minimal config") {
|
||||
@ -113,6 +114,15 @@ SCENARIO("MQTT Client Operation")
|
||||
REQUIRE(res == ESP_FAIL);
|
||||
}
|
||||
}
|
||||
SECTION("User set interface to use"){
|
||||
http_parser_parse_url_ExpectAnyArgsAndReturn(0);
|
||||
http_parser_parse_url_ReturnThruPtr_u(&ret_uri);
|
||||
struct ifreq if_name = {.ifr_ifrn = {"custom"}};
|
||||
config.network.if_name = &if_name;
|
||||
SECTION("Client is not started"){
|
||||
REQUIRE(esp_mqtt_set_config(client.get(), &config)== ESP_OK);
|
||||
}
|
||||
}
|
||||
SECTION("After Start Client Is Cleanly destroyed") {
|
||||
REQUIRE(esp_mqtt_client_start(client.get()) == ESP_OK);
|
||||
// Only need to start the client, destroy is called automatically at the end of
|
||||
|
@ -608,6 +608,7 @@ void esp_mqtt_destroy_config(esp_mqtt_client_handle_t client)
|
||||
}
|
||||
free(client->config->alpn_protos);
|
||||
free(client->config->clientkey_password);
|
||||
free(client->config->if_name);
|
||||
free(client->mqtt_state.connection.information.will_topic);
|
||||
free(client->mqtt_state.connection.information.will_message);
|
||||
free(client->mqtt_state.connection.information.client_id);
|
||||
|
Reference in New Issue
Block a user