Fix some unit test failures that were my fault
This commit is contained in:
parent
aac87d85c0
commit
12c01f6f3e
3 changed files with 45 additions and 7 deletions
|
@ -2,11 +2,16 @@
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 3:
|
||||||
sys.stderr.write("Please specify a search directory\n")
|
sys.stderr.write("Usage: {0} <prefix> <paths>...\n".format(sys.argv[0]))
|
||||||
exit(2)
|
exit(2)
|
||||||
|
|
||||||
for search_path in sys.argv[1:]:
|
prefix = sys.argv[1]
|
||||||
for path in Path(search_path).rglob('*.wren'):
|
search_paths = sys.argv[2:]
|
||||||
|
|
||||||
|
for search_path in search_paths:
|
||||||
|
curr_path = os.path.join(prefix, search_path)
|
||||||
|
for path in Path(curr_path).rglob('*.wren'):
|
||||||
sys.stdout.write(str(path) + "\n")
|
sys.stdout.write(str(path) + "\n")
|
||||||
|
|
20
subprojects/wren/guess_test_outcome.py
Executable file
20
subprojects/wren/guess_test_outcome.py
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
|
||||||
|
if len(sys.argv) != 2:
|
||||||
|
sys.stderr.write("Please specify a file path\n")
|
||||||
|
exit(2)
|
||||||
|
|
||||||
|
try:
|
||||||
|
my_file = open(sys.argv[1], mode='r')
|
||||||
|
text = my_file.read()
|
||||||
|
my_file.close()
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
if re.search(r"expect\s+(?:runtime\s+)?\berror", text):
|
||||||
|
exit(0)
|
||||||
|
else:
|
||||||
|
exit(1)
|
|
@ -67,6 +67,7 @@ wren_dep = declare_dependency(
|
||||||
|
|
||||||
if get_option('build_testing')
|
if get_option('build_testing')
|
||||||
fs = import('fs')
|
fs = import('fs')
|
||||||
|
|
||||||
test_src = [
|
test_src = [
|
||||||
'wren/test/api/api_tests.c',
|
'wren/test/api/api_tests.c',
|
||||||
'wren/test/api/benchmark.c',
|
'wren/test/api/benchmark.c',
|
||||||
|
@ -101,8 +102,8 @@ if get_option('build_testing')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
test_scripts = run_command(
|
test_scripts = run_command(
|
||||||
meson.current_source_dir() / 'find_scripts.py',
|
files('find_scripts.py'),
|
||||||
meson.current_source_dir(),
|
meson.current_source_dir() / 'wren/test',
|
||||||
test_script_paths,
|
test_script_paths,
|
||||||
).stdout().strip().split('\n')
|
).stdout().strip().split('\n')
|
||||||
|
|
||||||
|
@ -115,8 +116,20 @@ if get_option('build_testing')
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach test_script : test_scripts
|
foreach test_script : test_scripts
|
||||||
|
expects_fail = run_command(
|
||||||
|
files('guess_test_outcome.py'),
|
||||||
|
test_script,
|
||||||
|
).returncode() == 0
|
||||||
|
|
||||||
name = fs.stem(test_script)
|
name = fs.stem(test_script)
|
||||||
test(meson.project_name() + ' test ' + name, test_api, args: files(test_script))
|
test(
|
||||||
|
meson.project_name() + ' test ' + name,
|
||||||
|
test_api,
|
||||||
|
args: test_script,
|
||||||
|
is_parallel: true,
|
||||||
|
should_fail: expects_fail,
|
||||||
|
workdir: meson.current_source_dir() / 'wren',
|
||||||
|
)
|
||||||
endforeach
|
endforeach
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue