diff options
| author | Jeff Epler <jepler@gmail.com> | 2020-06-14 14:28:32 -0500 |
|---|---|---|
| committer | Jeff Epler <jepler@unpythonic.net> | 2020-06-25 11:42:23 -0500 |
| commit | 9737dd9c308df0d7356ee5ff727e34a93a88e302 (patch) | |
| tree | a6196156515944001f1164e5d5b4f7e6ffb21475 | |
| parent | 9110e366369ba0f99c8e33032da64edb34a4c74a (diff) | |
Scripts: Change wording for pseudoterminals
| -rwxr-xr-x | tests/run-tests | 20 | ||||
| -rwxr-xr-x | tools/pyboard.py | 2 |
2 files changed, 13 insertions, 9 deletions
diff --git a/tests/run-tests b/tests/run-tests index 6e980f03c..151d48095 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -87,28 +87,32 @@ def run_micropython(pyb, args, test_file, is_special=False): def get(required=False): rv = b'' while True: - ready = select.select([master], [], [], 0.02) - if ready[0] == [master]: - rv += os.read(master, 1024) + ready = select.select([emulator], [], [], 0.02) + if ready[0] == [emulator]: + rv += os.read(emulator, 1024) else: if not required or rv: return rv def send_get(what): - os.write(master, what) + os.write(emulator, what) return get() with open(test_file, 'rb') as f: # instead of: output_mupy = subprocess.check_output(args, stdin=f) - master, slave = pty.openpty() - p = subprocess.Popen(args, stdin=slave, stdout=slave, + # openpty returns two read/write file descriptors. The first one is + # used by the program which provides the virtual + # terminal service, and the second one is used by the + # subprogram which requires a tty to work. + emulator, subterminal = pty.openpty() + p = subprocess.Popen(args, stdin=subterminal, stdout=subterminal, stderr=subprocess.STDOUT, bufsize=0) banner = get(True) output_mupy = banner + b''.join(send_get(line) for line in f) send_get(b'\x04') # exit the REPL, so coverage info is saved p.kill() - os.close(master) - os.close(slave) + os.close(emulator) + os.close(subterminal) else: output_mupy = subprocess.check_output(args + [test_file], stderr=subprocess.STDOUT) except subprocess.CalledProcessError: diff --git a/tools/pyboard.py b/tools/pyboard.py index 16ee41f70..bb5642bd7 100755 --- a/tools/pyboard.py +++ b/tools/pyboard.py @@ -191,7 +191,7 @@ class ProcessToSerial: class ProcessPtyToTerminal: - """Execute a process which creates a PTY and prints slave PTY as + """Execute a process which creates a PTY and prints secondary PTY as first line of its output, and emulate serial connection using this PTY.""" |
