esp8266 / esp8266/Arduino

Host side tests (Phase 2)

Open
#1,715 3 comments 0 reactions 2 assignees Claimed by @d-a-v View on GitHub
help wanted type: enhancement
Dominant language
C++
Stars
16.7k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

This issue is tracking implementation of a set of mocks which enable testing parts of the core on the PC, and writing relevant tests.

Easy testing targets include core classes (String, Stream, Print), heap management functions, and filesystem APIs.

Testing WiFiClient, WiFiClientSecure, WiFiServer, ESP8266WebServer, ESP8266httpClient is also possible, but requires a bit more work to build Linux port of LwIP and link against it.

To do list:

~~Phase 1~~ (#1716)
- [x] initial batch of mocks
- [x] some filesystem tests
- [x] add makefile, run tests on Travis
- [x] correct license headers in all mock files
- [x] measure coverage for host based tests

Phase 2
- [x] mock for HardwareSerial
- [x] more filesystem tests
- [ ] optional replacement of malloc/free/new/delete in test environment — to test against simulated 40k heap. Need to figure out how to support different behaviour of `operator new` and `operator delete` in parts of code under test and in test runner.
- [ ] (***new***) unify host-tests and emulation-on-host APIs

Phase 3
- [ ] tests for number formatting functions in core_esp8266_noniso.c
- [x] tests for String class

Phase 4
- [ ] LwIP port for Linux and infrastructure to link tests against it
- [ ] tests for WiFiClient/WiFiServer
(*update*: can be done by adding more device tests now also runnable on host)

Phase 5
- [x] ~~AxTLS~~ BearSSL Linux build
(done with emulation-on-host)
- [x] tests for WiFiClientSecure
(device test `test_sw_http_client` is working on host with https w/ BearSSL using WiFiClientSecure)

Phase 6 (***edit***: done via running device tests on host)
- [x] tests for ESP8266WebServer
- [x] tests for ESP8266HTTPClient
##

Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/31551596-host-side-tests?utm_campaign=plugin&utm_content=tracker%2F14245935&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F14245935&utm_medium=issues&utm_source=github).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.