Commit c1a5affd authored by Kevin Modzelewski's avatar Kevin Modzelewski

Add 'expected: fail' annotations to tests that are currently failing; tests pass now!

parent 2b4b3737
# expected: fail
print [(i, j) for i in range(4) for j in range(4)] print [(i, j) for i in range(4) for j in range(4)]
......
# expected: fail
i = "global" i = "global"
def f(n): def f(n):
i = "hello" i = "hello"
......
# expected: fail
# Regression test to make sure we can do an OSR if one of the live variables # Regression test to make sure we can do an OSR if one of the live variables
# is potentially-undefined. # is potentially-undefined.
......
# expected: fail
class Union(object): class Union(object):
def __init__(self, subs): def __init__(self, subs):
self.subs = subs self.subs = subs
......
...@@ -68,15 +68,20 @@ def run_test(fn, check_stats, run_memcheck): ...@@ -68,15 +68,20 @@ def run_test(fn, check_stats, run_memcheck):
statchecks = [] statchecks = []
jit_args = ["-csr"] + EXTRA_JIT_ARGS jit_args = ["-csr"] + EXTRA_JIT_ARGS
expected = "success"
for l in open(fn): for l in open(fn):
if not l.startswith("#"): if not l.startswith("#"):
break; break
if l.startswith("# statcheck:"): if l.startswith("# statcheck:"):
l = l[len("# statcheck:"):].strip() l = l[len("# statcheck:"):].strip()
statchecks.append(l) statchecks.append(l)
if l.startswith("# run_args:"): elif l.startswith("# run_args:"):
l = l[len("# run_args:"):].split() l = l[len("# run_args:"):].split()
jit_args += l jit_args += l
elif l.startswith("# expected:"):
expected = l[len("# run_args:"):].strip()
assert expected in ("success", "fail"), expected
run_args = ["./%s" % IMAGE] + jit_args + ["-q", fn] run_args = ["./%s" % IMAGE] + jit_args + ["-q", fn]
start = time.time() start = time.time()
...@@ -111,27 +116,47 @@ def run_test(fn, check_stats, run_memcheck): ...@@ -111,27 +116,47 @@ def run_test(fn, check_stats, run_memcheck):
else: else:
msg = "Exited with code %d (expected code %d)" % (code, expected_code) msg = "Exited with code %d (expected code %d)" % (code, expected_code)
if expected == "fail":
r += " Expected failure (got code %d, should be %d)" % (code, expected_code)
return r
else:
if KEEP_GOING:
r += " \033[%dmFAILED\033[0m (%s)" % (color, msg)
failed.append(fn)
return r
else:
raise Exception("%s\n%s\n%s" % (msg, err, full_err))
elif out != expected_out:
if expected == "fail":
r += " Expected failure (bad output)"
return r
else:
if KEEP_GOING:
r += " \033[31mFAILED\033[0m (bad output)"
failed.append(fn)
return r
exp_fd, exp_fn = tempfile.mkstemp()
out_fd, out_fn = tempfile.mkstemp()
os.fdopen(exp_fd, 'w').write(expected_out)
os.fdopen(out_fd, 'w').write(out)
p = subprocess.Popen(["diff", "-a", exp_fn, out_fn], stdout=subprocess.PIPE, preexec_fn=set_ulimits)
diff = p.stdout.read()
assert p.wait() in (0, 1)
raise Exception("Failed on %s:\n%s" % (fn, diff))
elif err != expected_err:
if KEEP_GOING: if KEEP_GOING:
r += " \033[%dmFAILED\033[0m (%s)" % (color, msg) r += " \033[31mFAILED\033[0m (bad stderr)"
failed.append(fn) failed.append(fn)
return r return r
else: else:
raise Exception("%s\n%s\n%s" % (msg, err, full_err)) raise Exception((err, expected_err))
elif out != expected_out: elif expected == "fail":
if KEEP_GOING: if KEEP_GOING:
r += " \033[31mFAILED\033[0m (bad output)" r += " \033[31mFAILED\033[0m (unexpected success)"
failed.append(fn) failed.append(fn)
return r return r
exp_fd, exp_fn = tempfile.mkstemp() raise Exception("Unexpected success on %s" % fn)
out_fd, out_fn = tempfile.mkstemp()
os.fdopen(exp_fd, 'w').write(expected_out)
os.fdopen(out_fd, 'w').write(out)
p = subprocess.Popen(["diff", "-a", exp_fn, out_fn], stdout=subprocess.PIPE, preexec_fn=set_ulimits)
diff = p.stdout.read()
assert p.wait() in (0, 1)
raise Exception("Failed on %s:\n%s" % (fn, diff))
elif err != expected_err:
raise Exception((err, expected_err))
r += " Correct output (%5.1fms)" % (elapsed * 1000,) r += " Correct output (%5.1fms)" % (elapsed * 1000,)
if check_stats: if check_stats:
...@@ -270,8 +295,8 @@ if __name__ == "__main__": ...@@ -270,8 +295,8 @@ if __name__ == "__main__":
nostat = functools.partial(_addto, IGNORE_STATS) nostat = functools.partial(_addto, IGNORE_STATS)
if '-O' in EXTRA_JIT_ARGS: if '-O' in EXTRA_JIT_ARGS:
# OSR test, doesn't make sense with -O # OSR tests, doesn't make sense with -O
skip(["30"]) skip(["30", "listcomp_osr"])
if datetime.datetime.now() < datetime.datetime(2014,4,28): if datetime.datetime.now() < datetime.datetime(2014,4,28):
nostat(["nondirectly_callable_ics"]) # WIP nostat(["nondirectly_callable_ics"]) # WIP
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment