EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #1516 background imageLoading...
Page #1516 background image
Chapter 4. API Guides
(continued from previous page)
}
TEST_CASE_MULTIPLE_STAGES("reset reason check for deepsleep", "[esp32s2]", trigger_
,deepsleep, check_deepsleep_reset_reason);
Multi-stage test cases present a group of test functions to users. It needs user interactions (select cases and select
different stages) to run the case.
4.30.4 Tests For Different Targets
Some tests (especially those related to hardware) cannot run on all targets. Below is a guide how to make your unit
tests run on only specified targets.
1. Wrap your test code by !(TEMPORARY_)DISABLED_FOR_TARGETS() macros and place them either in
the original test file, or separate the code into files grouped by functions, but make sure all these files will be
processed by the compiler. E.g.:
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32, ESP8266)
TEST_CASE("a test that is not ready for esp32 and esp8266 yet", "[]")
{
}
#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32, ESP8266)
Once you need one of the tests to be compiled on a specified target, just modify the targets in the disabled
list. Its more encouraged to use some general conception that can be described in soc_caps.h to control
the disabling of tests. If this is done but some of the tests are not ready yet, use both of them (and remove !
(TEMPORARY_)DISABLED_FOR_TARGETS() later). E.g.:
#if SOC_SDIO_SLAVE_SUPPORTED
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP64)
TEST_CASE("a sdio slave tests that is not ready for esp64 yet", "[sdio_slave]")
{
//available for esp32 now, and will be available for esp64 in the future
}
#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP64)
#endif //SOC_SDIO_SLAVE_SUPPORTED
2. For test code that you are 100% for sure that will not be supported (e.g. no peripheral at all), use DIS-
ABLED_FOR_TARGETS; for test code that should be disabled temporarily, or due to lack of runners, etc.,
use TEMPORARY_DISABLED_FOR_TARGETS.
Some old ways of disabling unit tests for targets, that have obvious disadvantages, are deprecated:
DONT put the test code under test/target folder and use CMakeLists.txt to choose one of the target
folder. This is prevented because test code is more likely to be reused than the implementations. If you put
something into test/esp32 just to avoid building it on esp32s2, its hard to make the code tidy if you
want to enable the test again on esp32s3.
DONT use CONFIG_IDF_TARGET_xxx macros to disable the test items any more. This makes it harder
to track disabled tests and enable them again. Also, a black-list style #if !disabled is preferred to white-
list style #if CONFIG_IDF_TARGET_xxx, since you will not silently disable cases when new targets are
added in the future. But for test implementations, its allowed to use #if CONFIG_IDF_TARGET_xxx
to pick one of the implementation code.
Test item: some items that will be performed on some targets, but skipped on other targets. E.g.
There are three test items SD 1-bit, SD 4-bit and SDSPI. For ESP32-S2, which doesnt have SD host,
among the tests only SDSPI is enabled on ESP32-S2.
Test implementation: some code will always happen, but in different ways. E.g.
There is no SDIO PKT_LEN register on ESP8266. If you want to get the length from the slave
as a step in the test process, you can have different implementation code protected by #if CON-
FIG_IDF_TARGET_ reading in different ways.
Espressif Systems 1505
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish