From 4a89920a5a1bc1c8d1e6063fd712ce84f4dc3daf Mon Sep 17 00:00:00 2001 From: david gauchard Date: Wed, 11 May 2022 22:07:49 +0200 Subject: [PATCH 1/2] emulation on host: fix internal udp management help dtors: clear map before exit, check with valgrind --- tests/ci/host_test.sh | 3 ++- tests/host/common/ArduinoMain.cpp | 1 + tests/host/common/ArduinoMainUdp.cpp | 7 ++++++- tests/host/common/mock.h | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/ci/host_test.sh b/tests/ci/host_test.sh index ef143f90e1..44d7517be0 100755 --- a/tests/ci/host_test.sh +++ b/tests/ci/host_test.sh @@ -13,7 +13,8 @@ for i in ../../libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient \ ../../libraries/ESP8266WebServer/examples/HelloServer/HelloServer \ ../../libraries/SD/examples/Files/Files \ ../../libraries/LittleFS/examples/LittleFS_Timestamp/LittleFS_Timestamp \ - ../../libraries/LittleFS/examples/SpeedTest/SpeedTest ; do + ../../libraries/LittleFS/examples/SpeedTest/SpeedTest \ + ../../libraries/DNSServer/examples/DNSServer/DNSServer ; do make -j2 D=1 FORCE32=0 $i valgrind --leak-check=full --track-origins=yes --error-limit=no --show-leak-kinds=all --error-exitcode=999 bin/$(basename $i)/$(basename $i) -1 done diff --git a/tests/host/common/ArduinoMain.cpp b/tests/host/common/ArduinoMain.cpp index 80e0a0c85b..ca03af9ddd 100644 --- a/tests/host/common/ArduinoMain.cpp +++ b/tests/host/common/ArduinoMain.cpp @@ -163,6 +163,7 @@ static struct option options[] = { void cleanup() { + mock_stop_udp(); mock_stop_spiffs(); mock_stop_littlefs(); mock_stop_uart(); diff --git a/tests/host/common/ArduinoMainUdp.cpp b/tests/host/common/ArduinoMainUdp.cpp index cfcaacef2a..e388d5463d 100644 --- a/tests/host/common/ArduinoMainUdp.cpp +++ b/tests/host/common/ArduinoMainUdp.cpp @@ -33,7 +33,7 @@ #include #include -std::map udps; +static std::map udps; void register_udp(int sock, UdpContext* udp) { @@ -58,3 +58,8 @@ void check_incoming_udp() } } } + +void mock_stop_udp () +{ + udps.clear(); +} diff --git a/tests/host/common/mock.h b/tests/host/common/mock.h index a8dc3e2bdc..dbcb1dbf31 100644 --- a/tests/host/common/mock.h +++ b/tests/host/common/mock.h @@ -170,6 +170,7 @@ void mockUDPSwallow(size_t copied, char* ccinbuf, size_t& ccinbufsize); class UdpContext; void register_udp(int sock, UdpContext* udp = nullptr); +void mock_stop_udp(); // From e7aa12277ce87efe1e480dc875155f692da9ff31 Mon Sep 17 00:00:00 2001 From: david gauchard Date: Wed, 11 May 2022 22:24:48 +0200 Subject: [PATCH 2/2] fix style --- tests/host/common/ArduinoMainUdp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/host/common/ArduinoMainUdp.cpp b/tests/host/common/ArduinoMainUdp.cpp index e388d5463d..49d7c091d2 100644 --- a/tests/host/common/ArduinoMainUdp.cpp +++ b/tests/host/common/ArduinoMainUdp.cpp @@ -59,7 +59,7 @@ void check_incoming_udp() } } -void mock_stop_udp () +void mock_stop_udp() { udps.clear(); }