summaryrefslogtreecommitdiff
path: root/tests/run-tests
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2020-06-14 14:28:32 -0500
committerJeff Epler <jepler@unpythonic.net>2020-06-25 11:42:23 -0500
commit9737dd9c308df0d7356ee5ff727e34a93a88e302 (patch)
treea6196156515944001f1164e5d5b4f7e6ffb21475 /tests/run-tests
parent9110e366369ba0f99c8e33032da64edb34a4c74a (diff)
Scripts: Change wording for pseudoterminals
Diffstat (limited to 'tests/run-tests')
-rwxr-xr-xtests/run-tests20
1 files changed, 12 insertions, 8 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: