diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-11-24 19:52:03 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-11-24 19:52:30 +0200 |
commit | ff8c4188f473ac7c8311694a6ffa4ca5357b0492 (patch) | |
tree | 2e0de2e2583cb406fc3b6c39b17d52e7425eeb43 /tests | |
parent | 65888e2006ad5aac6d613550aecea9956562eb59 (diff) | |
download | micropython-ff8c4188f473ac7c8311694a6ffa4ca5357b0492.tar.gz micropython-ff8c4188f473ac7c8311694a6ffa4ca5357b0492.zip |
tests/run-tests: Improve robustness of REPL tests.
Unconditionally wait for MicroPython banner. On overloaded systems, when
using emulators, etc. initial executable startup may take more than 20ms.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/run-tests | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/run-tests b/tests/run-tests index b275be0064..7340d5f550 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -51,14 +51,15 @@ def run_micropython(pyb, args, test_file): return b'SKIP\n' import select - def get(): + def get(required=False): rv = b'' while True: ready = select.select([master], [], [], 0.02) if ready[0] == [master]: rv += os.read(master, 1024) else: - return rv + if not required or rv: + return rv def send_get(what): os.write(master, what) @@ -69,7 +70,7 @@ def run_micropython(pyb, args, test_file): master, slave = pty.openpty() p = subprocess.Popen(args, stdin=slave, stdout=slave, stderr=subprocess.STDOUT, bufsize=0) - banner = get() + banner = get(True) output_mupy = banner + b''.join(send_get(line) for line in f) p.kill() os.close(master) |