Merge pull request #12816 from aabadie/pr/tests/stdin_fix_avr
tests/stdin: fix automatic test on slow platforms
This commit is contained in:
commit
2b934dea5f
@ -18,7 +18,10 @@
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int value = getchar();
|
||||
printf("You entered '%c'\n", (char)value);
|
||||
while (1) {
|
||||
int value = getchar();
|
||||
printf("You entered '%c'\n", (char)value);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -7,12 +7,25 @@
|
||||
# directory for more details.
|
||||
|
||||
import sys
|
||||
import pexpect
|
||||
from testrunner import run
|
||||
|
||||
|
||||
TEST_INPUT = 'O'
|
||||
RETRIES = 5
|
||||
TIMEOUT = 3
|
||||
|
||||
|
||||
def testfunc(child):
|
||||
child.sendline('O')
|
||||
child.expect_exact('You entered \'O\'')
|
||||
expected_output = 'You entered \'{}\''.format(TEST_INPUT)
|
||||
for _ in range(0, RETRIES):
|
||||
child.sendline(TEST_INPUT)
|
||||
ret = child.expect_exact([expected_output, pexpect.TIMEOUT],
|
||||
timeout=TIMEOUT)
|
||||
if ret == 0:
|
||||
break
|
||||
else:
|
||||
child.expect_exact(expected_output)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user