Skip to content

Commit 6232585

Browse files
d-a-vhasenradball
authored andcommitted
emulation on host: fix internal udp management (esp8266#8561)
* emulation on host: fix internal udp management help dtors: clear map before exit, check with valgrind * fix style
1 parent 405974f commit 6232585

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

tests/ci/host_test.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ for i in ../../libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient \
1313
../../libraries/ESP8266WebServer/examples/HelloServer/HelloServer \
1414
../../libraries/SD/examples/Files/Files \
1515
../../libraries/LittleFS/examples/LittleFS_Timestamp/LittleFS_Timestamp \
16-
../../libraries/LittleFS/examples/SpeedTest/SpeedTest ; do
16+
../../libraries/LittleFS/examples/SpeedTest/SpeedTest \
17+
../../libraries/DNSServer/examples/DNSServer/DNSServer ; do
1718
make -j2 D=1 FORCE32=0 $i
1819
valgrind --leak-check=full --track-origins=yes --error-limit=no --show-leak-kinds=all --error-exitcode=999 bin/$(basename $i)/$(basename $i) -1
1920
done

tests/host/common/ArduinoMain.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ static struct option options[] = {
163163

164164
void cleanup()
165165
{
166+
mock_stop_udp();
166167
mock_stop_spiffs();
167168
mock_stop_littlefs();
168169
mock_stop_uart();

tests/host/common/ArduinoMainUdp.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include <poll.h>
3434
#include <map>
3535

36-
std::map<int, UdpContext*> udps;
36+
static std::map<int, UdpContext*> udps;
3737

3838
void register_udp(int sock, UdpContext* udp)
3939
{
@@ -58,3 +58,8 @@ void check_incoming_udp()
5858
}
5959
}
6060
}
61+
62+
void mock_stop_udp()
63+
{
64+
udps.clear();
65+
}

tests/host/common/mock.h

+1
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ void mockUDPSwallow(size_t copied, char* ccinbuf, size_t& ccinbufsize);
170170

171171
class UdpContext;
172172
void register_udp(int sock, UdpContext* udp = nullptr);
173+
void mock_stop_udp();
173174

174175
//
175176

0 commit comments

Comments
 (0)