Skip to content

Add valgrind mocked test to CI #7501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ void setup() {
}

void loop() {
static bool wait = false;

Serial.print("connecting to ");
Serial.print(host);
Serial.print(':');
Expand Down Expand Up @@ -87,5 +89,8 @@ void loop() {
Serial.println("closing connection");
client.stop();

delay(300000); // execute once every 5 minutes, don't flood remote service
if (wait) {
delay(300000); // execute once every 5 minutes, don't flood remote service
}
wait = true;
}
15 changes: 14 additions & 1 deletion tests/ci/host_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,18 @@ set -ev

cd $TRAVIS_BUILD_DIR/tests/host

make CI

make -j2 ssl
for i in ../../libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient \
../../libraries/ESP8266WiFi/examples/BearSSL_Validation/BearSSL_Validation \
../../libraries/ESP8266WebServer/examples/HelloServer/HelloServer \
../../libraries/SD/examples/Files/Files \
../../libraries/LittleFS/examples/LittleFS_Timestamp/LittleFS_Timestamp \
../../libraries/LittleFS/examples/SpeedTest/SpeedTest ; do
make -j2 D=1 $i
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a 64-bits gcc-multilib environment, 32 bits binaries are generated by default but valgrind does not work with them. FORCE32=0 disables that and 64 bits binaries are generated.
In a non-gcc-multilib 64-bits environment, everything is 64 bits.
Just in case, I would 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

make -j2 CI

make clean-objects
13 changes: 11 additions & 2 deletions tests/host/common/ArduinoMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#define MOCK_PORT_SHIFTER 9000

bool user_exit = false;
bool run_once = false;
const char* host_interface = nullptr;
size_t spiffs_kb = 1024;
size_t littlefs_kb = 1024;
Expand Down Expand Up @@ -137,6 +138,7 @@ void help (const char* argv0, int exitcode)
"\tgeneral:\n"
"\t-c - ignore CTRL-C (send it via Serial)\n"
"\t-f - no throttle (possibly 100%%CPU)\n"
"\t-1 - run loop once then exit (for host testing)\n"
"\t-v - verbose\n"
, argv0, MOCK_PORT_SHIFTER, argv0, spiffs_kb, littlefs_kb);
exit(exitcode);
Expand All @@ -152,10 +154,11 @@ static struct option options[] =
{ "verbose", no_argument, NULL, 'v' },
{ "timestamp", no_argument, NULL, 'T' },
{ "interface", required_argument, NULL, 'i' },
{ "fspath", required_argument, NULL, 'P' },
{ "fspath", required_argument, NULL, 'P' },
{ "spiffskb", required_argument, NULL, 'S' },
{ "littlefskb", required_argument, NULL, 'L' },
{ "portshifter", required_argument, NULL, 's' },
{ "once", no_argument, NULL, '1' },
};

void cleanup ()
Expand Down Expand Up @@ -209,7 +212,7 @@ int main (int argc, char* const argv [])

for (;;)
{
int n = getopt_long(argc, argv, "hlcfbvTi:S:s:L:P:", options, NULL);
int n = getopt_long(argc, argv, "hlcfbvTi:S:s:L:P:1", options, NULL);
if (n < 0)
break;
switch (n)
Expand Down Expand Up @@ -250,6 +253,9 @@ int main (int argc, char* const argv [])
case 'T':
serial_timestamp = true;
break;
case '1':
run_once = true;
break;
default:
help(argv[0], EXIT_FAILURE);
}
Expand Down Expand Up @@ -300,6 +306,9 @@ int main (int argc, char* const argv [])
usleep(1000); // not 100% cpu, ~1000 loops per second
loop();
check_incoming_udp();

if (run_once)
user_exit = true;
}
cleanup();

Expand Down