esp-idf/components/log/host_test/log_test
2022-11-03 11:45:19 +01:00
..
main log: support ESP_LOG_BUFFER* functions for Linux target 2022-04-11 13:29:01 +02:00
CMakeLists.txt tools: Increase the minimal supported CMake version to 3.16 2022-06-01 06:35:02 +00:00
README.md [esp_rom]: Partially buildable for linux 2021-08-03 12:03:24 +08:00
sdkconfig.defaults bugfix(esp_rom): Fixed writable string issue on Linux implementation 2022-11-03 11:45:19 +01:00

Supported Targets Linux

Simple log test on Linux target

This unit test tests basic functionality of the log component. The test does not use mocks. Instead, it runs the whole implementation of the component on the Linux host. The test framework is CATCH. For early log, we only perform a compile time test since there's nothing to test on Linux except for the log macros themselves (all the implementation will be in chip ROM).

Requirements

  • A Linux system
  • The usual IDF requirements for Linux system, as described in the Getting Started Guides.
  • The host's gcc/g++

This application has been tested on Ubuntu 20.04 with gcc version 9.3.0.

Build

First, make sure that the target is set to Linux. Run idf.py --preview set-target linux if you are not sure. Then do a normal IDF build: idf.py build.

Run

IDF monitor doesn't work yet for Linux. You have to run the app manually:

./build/test_log_host.elf

Example Output

Ideally, all tests pass, which is indicated by "All tests passed" in the last line:

$ ./build/test_log_host.elf 
===============================================================================
All tests passed (8 assertions in 6 test cases)