forked from espressif/esp-idf
ci(esp_event): upgrade host test to Catch2 as a component, fix build
- use espressif/catch2 component - fix build issues after FreeRTOS upgrade - enable test app build in CI
This commit is contained in:
3
components/esp_event/host_test/.build-test-rules.yml
Normal file
3
components/esp_event/host_test/.build-test-rules.yml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
components/esp_event/host_test:
|
||||||
|
enable:
|
||||||
|
- if: IDF_TARGET == "linux"
|
@@ -1,3 +1,8 @@
|
|||||||
idf_component_register(SRCS "esp_event_test.cpp"
|
idf_component_register(SRCS "esp_event_test.cpp"
|
||||||
INCLUDE_DIRS "../../" $ENV{IDF_PATH}/tools/catch
|
INCLUDE_DIRS "../../"
|
||||||
REQUIRES esp_event cmock)
|
REQUIRES esp_event cmock
|
||||||
|
WHOLE_ARCHIVE)
|
||||||
|
|
||||||
|
# Currently 'main' for IDF_TARGET=linux is defined in freertos component.
|
||||||
|
# Since we are using a freertos mock here, need to let Catch2 provide 'main'.
|
||||||
|
target_link_libraries(${COMPONENT_LIB} PRIVATE Catch2WithMain)
|
||||||
|
@@ -7,12 +7,11 @@
|
|||||||
CONDITIONS OF ANY KIND, either express or implied.
|
CONDITIONS OF ANY KIND, either express or implied.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CATCH_CONFIG_MAIN
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "esp_event.h"
|
#include "esp_event.h"
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
#include "fixtures.hpp"
|
#include "fixtures.hpp"
|
||||||
|
|
||||||
|
@@ -0,0 +1,2 @@
|
|||||||
|
dependencies:
|
||||||
|
espressif/catch2: "^3.4.0"
|
@@ -9,11 +9,12 @@
|
|||||||
|
|
||||||
#include "esp_event.h"
|
#include "esp_event.h"
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "Mocktask.h"
|
#include "Mocktask.h"
|
||||||
#include "Mockqueue.h"
|
#include "Mockqueue.h"
|
||||||
|
#include "Mockidf_additions.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -129,11 +130,11 @@ struct MockTask : public CMockFix {
|
|||||||
xTaskCreatePinnedToCore_ExpectAnyArgsAndReturn(pdFALSE);
|
xTaskCreatePinnedToCore_ExpectAnyArgsAndReturn(pdFALSE);
|
||||||
} else if (flags == CreateAnd::IGNORE) {
|
} else if (flags == CreateAnd::IGNORE) {
|
||||||
xTaskCreatePinnedToCore_IgnoreAndReturn(pdTRUE);
|
xTaskCreatePinnedToCore_IgnoreAndReturn(pdTRUE);
|
||||||
xTaskCreatePinnedToCore_ReturnThruPtr_pvCreatedTask(&task);
|
xTaskCreatePinnedToCore_ReturnThruPtr_pxCreatedTask(&task);
|
||||||
vTaskDelete_Ignore();
|
vTaskDelete_Ignore();
|
||||||
} else {
|
} else {
|
||||||
xTaskCreatePinnedToCore_ExpectAnyArgsAndReturn(pdTRUE);
|
xTaskCreatePinnedToCore_ExpectAnyArgsAndReturn(pdTRUE);
|
||||||
xTaskCreatePinnedToCore_ReturnThruPtr_pvCreatedTask(&task);
|
xTaskCreatePinnedToCore_ReturnThruPtr_pxCreatedTask(&task);
|
||||||
vTaskDelete_Expect(task);
|
vTaskDelete_Expect(task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user