esp-idf/components/log/host_test/log_test
Jakob Hasse 0ea20caa71 [log]: Normal log works on Linux now
* also removed strlcpy dependency from log
* added Kconfig option for linux target

Closes IDF-3245
2021-05-28 11:05:22 +08:00
..
main [log]: Normal log works on Linux now 2021-05-28 11:05:22 +08:00
CMakeLists.txt [log]: Normal log works on Linux now 2021-05-28 11:05:22 +08:00
README.md [log]: Normal log works on Linux now 2021-05-28 11:05:22 +08:00
sdkconfig.defaults [log]: Normal log works on Linux now 2021-05-28 11:05:22 +08: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.

Note that the early log (ESP_EARLY_LOG) functionality has not been ported to Linux since it depends on the ROM component.

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)