Skip to content

Commit ba023bc

Browse files
author
Michael Klishin
committed
Make it possible to run tests for only some of the tutorials
Otherwise we have to run 9 * 9 * 6 = 486 examples, which takes a while.
1 parent 8f07ab6 commit ba023bc

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

test.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,18 @@ def skip(cwd_cmd, to_skip):
8787
'fib[(]30[)]'),
8888
}
8989

90+
def tests_to_run():
91+
if os.environ.get('TUTORIALS'):
92+
return sorted(str.split(os.environ.get('TUTORIALS'), ","))
93+
else:
94+
return sorted(tests.keys())
95+
9096
errors = 0
97+
ts = tests_to_run()
9198

9299
print " [.] Running tests with SLOWNESS=%r" % (multiplier,)
93-
for test in sorted(tests.keys()):
100+
print " [.] Will test %s" % (ts)
101+
for test in ts:
94102
(send_progs, recv_progs, output_mask) = tests[test]
95103
for scwd, send_cmd in send_progs:
96104
for rcwd, recv_cmd in recv_progs:
@@ -102,13 +110,13 @@ def skip(cwd_cmd, to_skip):
102110
scmd = send_cmd % ctx
103111
mask = output_mask % ctx
104112
p = spawn(rcmd, cwd=rcwd)
105-
serror, sout = run(scmd, cwd=scwd)
113+
exit_code, sout = run(scmd, cwd=scwd)
106114
matched, rout = wait(p, mask)
107-
if matched and serror == 0:
115+
if matched and exit_code == 0:
108116
print " [+] %s %-30s ok" % (test, scwd+'/'+rcwd)
109117
else:
110118
print " [!] %s %-30s FAILED" % (test, scwd+'/'+rcwd)
111-
print " [!] %r output (error=%s):\n%s\n" % (scmd, serror,
119+
print " [!] %r exited with status %s, output:\n%s\n" % (scmd, exit_code,
112120
sout.strip())
113121
print " [!] %r output:\n%s\n" % (rcmd, rout.strip())
114122
errors += 1

0 commit comments

Comments
 (0)