1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-26 07:02:15 +03:00

add support for environment variables in device tests

Previously device tests included information such as access point SSID/password at compile time. This made it difficult to compile test binaries once and then send them to multiple test runners for execution.

This change adds a command to the test library to set environment variable on the target device: “setenv key value”. C library setenv/getenv facility is used to store variables.

Test runner, tests, and makefile are updated to use this functionality.
This commit is contained in:
Ivan Grokhotkov
2018-04-10 16:27:19 +08:00
committed by Ivan Grokhotkov
parent 2315ac20bc
commit 8bd26f2ded
21 changed files with 306 additions and 78 deletions

View File

@ -35,11 +35,27 @@ public:
return len;
}
bool read_int(int& result)
size_t read_line(char* dest, size_t dest_size)
{
// TODO: fix this for 0 value
result = m_stream.parseInt();
return result != 0;
size_t len = 0;
// Can't use Stream::readBytesUntil here because it can't tell the
// difference between timing out and receiving the terminator.
while (len < dest_size - 1) {
int c = m_stream.read();
if (c < 0) {
delay(1);
continue;
}
if (c == '\r') {
continue;
}
if (c == '\n') {
dest[len] = 0;
break;
}
dest[len++] = c;
}
return len;
}
protected: