Move compile-fail tests that are rejected by the parser to parse-fail
This commit is contained in:
parent
f3573aa834
commit
01db9a46af
|
@ -452,6 +452,7 @@ RPASS_FULL_RS := $(wildcard $(S)src/test/run-pass-fulldeps/*.rs)
|
||||||
CFAIL_FULL_RS := $(wildcard $(S)src/test/compile-fail-fulldeps/*.rs)
|
CFAIL_FULL_RS := $(wildcard $(S)src/test/compile-fail-fulldeps/*.rs)
|
||||||
RFAIL_RS := $(wildcard $(S)src/test/run-fail/*.rs)
|
RFAIL_RS := $(wildcard $(S)src/test/run-fail/*.rs)
|
||||||
CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
|
CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
|
||||||
|
PFAIL_RS := $(wildcard $(S)src/test/parse-fail/*.rs)
|
||||||
BENCH_RS := $(wildcard $(S)src/test/bench/*.rs)
|
BENCH_RS := $(wildcard $(S)src/test/bench/*.rs)
|
||||||
PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
|
PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
|
||||||
DEBUGINFO_GDB_RS := $(wildcard $(S)src/test/debuginfo/*.rs)
|
DEBUGINFO_GDB_RS := $(wildcard $(S)src/test/debuginfo/*.rs)
|
||||||
|
@ -468,7 +469,7 @@ RPASS_VALGRIND_TESTS := $(RPASS_VALGRIND_RS)
|
||||||
RPASS_FULL_TESTS := $(RPASS_FULL_RS)
|
RPASS_FULL_TESTS := $(RPASS_FULL_RS)
|
||||||
CFAIL_FULL_TESTS := $(CFAIL_FULL_RS)
|
CFAIL_FULL_TESTS := $(CFAIL_FULL_RS)
|
||||||
RFAIL_TESTS := $(RFAIL_RS)
|
RFAIL_TESTS := $(RFAIL_RS)
|
||||||
CFAIL_TESTS := $(CFAIL_RS)
|
CFAIL_TESTS := $(CFAIL_RS) $(PFAIL_RS)
|
||||||
BENCH_TESTS := $(BENCH_RS)
|
BENCH_TESTS := $(BENCH_RS)
|
||||||
PERF_TESTS := $(PERF_RS)
|
PERF_TESTS := $(PERF_RS)
|
||||||
PRETTY_TESTS := $(PRETTY_RS)
|
PRETTY_TESTS := $(PRETTY_RS)
|
||||||
|
|
|
@ -35,34 +35,42 @@ for parser in args.parser:
|
||||||
ok[parser] = 0
|
ok[parser] = 0
|
||||||
bad[parser] = []
|
bad[parser] = []
|
||||||
devnull = open(os.devnull, 'w')
|
devnull = open(os.devnull, 'w')
|
||||||
print "\n"
|
print("\n")
|
||||||
|
|
||||||
for base, dirs, files in os.walk(args.source_dir[0]):
|
for base, dirs, files in os.walk(args.source_dir[0]):
|
||||||
for f in filter(lambda p: p.endswith('.rs'), files):
|
for f in filter(lambda p: p.endswith('.rs'), files):
|
||||||
p = os.path.join(base, f)
|
p = os.path.join(base, f)
|
||||||
compile_fail = 'compile-fail' in p
|
parse_fail = 'parse-fail' in p
|
||||||
ignore = any('ignore-test' in line or 'ignore-lexer-test' in line
|
if sys.version_info.major == 3:
|
||||||
for line in open(p).readlines())
|
lines = open(p, encoding='utf-8').readlines()
|
||||||
if compile_fail or ignore:
|
else:
|
||||||
|
lines = open(p).readlines()
|
||||||
|
if any('ignore-test' in line or 'ignore-lexer-test' in line for line in lines):
|
||||||
continue
|
continue
|
||||||
total += 1
|
total += 1
|
||||||
for parser in args.parser:
|
for parser in args.parser:
|
||||||
if subprocess.call(parser, stdin=open(p), stderr=subprocess.STDOUT, stdout=devnull) == 0:
|
if subprocess.call(parser, stdin=open(p), stderr=subprocess.STDOUT, stdout=devnull) == 0:
|
||||||
ok[parser] += 1
|
if parse_fail:
|
||||||
|
bad[parser].append(p)
|
||||||
|
else:
|
||||||
|
ok[parser] += 1
|
||||||
else:
|
else:
|
||||||
bad[parser].append(p)
|
if parse_fail:
|
||||||
|
ok[parser] += 1
|
||||||
|
else:
|
||||||
|
bad[parser].append(p)
|
||||||
parser_stats = ', '.join(['{}: {}'.format(parser, ok[parser]) for parser in args.parser])
|
parser_stats = ', '.join(['{}: {}'.format(parser, ok[parser]) for parser in args.parser])
|
||||||
sys.stdout.write("\033[K\r total: {}, {}, scanned {}"
|
sys.stdout.write("\033[K\r total: {}, {}, scanned {}"
|
||||||
.format(total, os.path.relpath(parser_stats), os.path.relpath(p)))
|
.format(total, os.path.relpath(parser_stats), os.path.relpath(p)))
|
||||||
|
|
||||||
devnull.close()
|
devnull.close()
|
||||||
|
|
||||||
print "\n"
|
print("\n")
|
||||||
|
|
||||||
for parser in args.parser:
|
for parser in args.parser:
|
||||||
filename = os.path.basename(parser) + '.bad'
|
filename = os.path.basename(parser) + '.bad'
|
||||||
print("writing {} files that failed to parse with {} to {}".format(len(bad[parser]), parser, filename))
|
print("writing {} files that did not yield the correct result with {} to {}".format(len(bad[parser]), parser, filename))
|
||||||
with open(filename, "w") as f:
|
with open(filename, "w") as f:
|
||||||
for p in bad[parser]:
|
for p in bad[parser]:
|
||||||
f.write(p)
|
f.write(p)
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue