Skip to content

Commit

Permalink
emulation on host: fix internal udp management (#8561)
Browse files Browse the repository at this point in the history
* emulation on host: fix internal udp management
help dtors: clear map before exit, check with valgrind

* fix style
  • Loading branch information
d-a-v committed May 15, 2022
1 parent 80c0570 commit 33afdc2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/ci/host_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/host/common/ArduinoMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ static struct option options[] = {

void cleanup()
{
mock_stop_udp();
mock_stop_spiffs();
mock_stop_littlefs();
mock_stop_uart();
Expand Down
7 changes: 6 additions & 1 deletion tests/host/common/ArduinoMainUdp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <poll.h>
#include <map>

std::map<int, UdpContext*> udps;
static std::map<int, UdpContext*> udps;

void register_udp(int sock, UdpContext* udp)
{
Expand All @@ -58,3 +58,8 @@ void check_incoming_udp()
}
}
}

void mock_stop_udp()
{
udps.clear();
}
1 change: 1 addition & 0 deletions tests/host/common/mock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

//

Expand Down

0 comments on commit 33afdc2

Please sign in to comment.