1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-13 13:01:55 +03:00

Add valgrind mocked test to CI (#7501)

Run valgrind on host mock example runs to catch more bugs in CI.  These
tests would have caught the problem in #7464 before users did.

Add a list of some randomly picked examples to run, and add an option to
run the loop exactly once in the host mock routine, so the test will
actually exit under valgrind.
This commit is contained in:
Earle F. Philhower, III
2020-08-03 19:00:51 -07:00
committed by GitHub
parent fc1aa554cd
commit a8e35a579c
3 changed files with 31 additions and 4 deletions

View File

@ -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;
@ -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);
@ -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 ()
@ -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)
@ -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);
}
@ -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();