forked from Imagelibrary/littlefs
Fix test.py hang on ctrl-C, cleanup TODOs
A small mistake in test.py's control flow meant the failing test job would succesfully kill all other test jobs, but then humorously start up a new process to continue testing.
This commit is contained in:
@@ -17,6 +17,15 @@ import collections as co
|
|||||||
|
|
||||||
OBJ_PATHS = ['*.o']
|
OBJ_PATHS = ['*.o']
|
||||||
|
|
||||||
|
def openio(path, mode='r'):
|
||||||
|
if path == '-':
|
||||||
|
if 'r' in mode:
|
||||||
|
return os.fdopen(os.dup(sys.stdin.fileno()), 'r')
|
||||||
|
else:
|
||||||
|
return os.fdopen(os.dup(sys.stdout.fileno()), 'w')
|
||||||
|
else:
|
||||||
|
return open(path, mode)
|
||||||
|
|
||||||
def collect(paths, **args):
|
def collect(paths, **args):
|
||||||
results = co.defaultdict(lambda: 0)
|
results = co.defaultdict(lambda: 0)
|
||||||
pattern = re.compile(
|
pattern = re.compile(
|
||||||
@@ -64,15 +73,6 @@ def collect(paths, **args):
|
|||||||
return flat_results
|
return flat_results
|
||||||
|
|
||||||
def main(**args):
|
def main(**args):
|
||||||
def openio(path, mode='r'):
|
|
||||||
if path == '-':
|
|
||||||
if 'r' in mode:
|
|
||||||
return os.fdopen(os.dup(sys.stdin.fileno()), 'r')
|
|
||||||
else:
|
|
||||||
return os.fdopen(os.dup(sys.stdout.fileno()), 'w')
|
|
||||||
else:
|
|
||||||
return open(path, mode)
|
|
||||||
|
|
||||||
# find sizes
|
# find sizes
|
||||||
if not args.get('use', None):
|
if not args.get('use', None):
|
||||||
# find .o files
|
# find .o files
|
||||||
@@ -281,4 +281,6 @@ if __name__ == "__main__":
|
|||||||
parser.add_argument('--build-dir',
|
parser.add_argument('--build-dir',
|
||||||
help="Specify the relative build directory. Used to map object files \
|
help="Specify the relative build directory. Used to map object files \
|
||||||
to the correct source files.")
|
to the correct source files.")
|
||||||
sys.exit(main(**vars(parser.parse_args())))
|
sys.exit(main(**{k: v
|
||||||
|
for k, v in vars(parser.parse_args()).items()
|
||||||
|
if v is not None}))
|
||||||
|
|||||||
@@ -12,6 +12,15 @@ import bisect as b
|
|||||||
|
|
||||||
INFO_PATHS = ['tests/*.toml.info']
|
INFO_PATHS = ['tests/*.toml.info']
|
||||||
|
|
||||||
|
def openio(path, mode='r'):
|
||||||
|
if path == '-':
|
||||||
|
if 'r' in mode:
|
||||||
|
return os.fdopen(os.dup(sys.stdin.fileno()), 'r')
|
||||||
|
else:
|
||||||
|
return os.fdopen(os.dup(sys.stdout.fileno()), 'w')
|
||||||
|
else:
|
||||||
|
return open(path, mode)
|
||||||
|
|
||||||
def collect(paths, **args):
|
def collect(paths, **args):
|
||||||
file = None
|
file = None
|
||||||
funcs = []
|
funcs = []
|
||||||
@@ -66,15 +75,6 @@ def collect(paths, **args):
|
|||||||
|
|
||||||
|
|
||||||
def main(**args):
|
def main(**args):
|
||||||
def openio(path, mode='r'):
|
|
||||||
if path == '-':
|
|
||||||
if 'r' in mode:
|
|
||||||
return os.fdopen(os.dup(sys.stdin.fileno()), 'r')
|
|
||||||
else:
|
|
||||||
return os.fdopen(os.dup(sys.stdout.fileno()), 'w')
|
|
||||||
else:
|
|
||||||
return open(path, mode)
|
|
||||||
|
|
||||||
# find coverage
|
# find coverage
|
||||||
if not args.get('use'):
|
if not args.get('use'):
|
||||||
# find *.info files
|
# find *.info files
|
||||||
@@ -320,4 +320,6 @@ if __name__ == "__main__":
|
|||||||
parser.add_argument('--build-dir',
|
parser.add_argument('--build-dir',
|
||||||
help="Specify the relative build directory. Used to map object files \
|
help="Specify the relative build directory. Used to map object files \
|
||||||
to the correct source files.")
|
to the correct source files.")
|
||||||
sys.exit(main(**vars(parser.parse_args())))
|
sys.exit(main(**{k: v
|
||||||
|
for k, v in vars(parser.parse_args()).items()
|
||||||
|
if v is not None}))
|
||||||
|
|||||||
@@ -17,6 +17,15 @@ import collections as co
|
|||||||
|
|
||||||
OBJ_PATHS = ['*.o']
|
OBJ_PATHS = ['*.o']
|
||||||
|
|
||||||
|
def openio(path, mode='r'):
|
||||||
|
if path == '-':
|
||||||
|
if 'r' in mode:
|
||||||
|
return os.fdopen(os.dup(sys.stdin.fileno()), 'r')
|
||||||
|
else:
|
||||||
|
return os.fdopen(os.dup(sys.stdout.fileno()), 'w')
|
||||||
|
else:
|
||||||
|
return open(path, mode)
|
||||||
|
|
||||||
def collect(paths, **args):
|
def collect(paths, **args):
|
||||||
results = co.defaultdict(lambda: 0)
|
results = co.defaultdict(lambda: 0)
|
||||||
pattern = re.compile(
|
pattern = re.compile(
|
||||||
@@ -63,15 +72,6 @@ def collect(paths, **args):
|
|||||||
return flat_results
|
return flat_results
|
||||||
|
|
||||||
def main(**args):
|
def main(**args):
|
||||||
def openio(path, mode='r'):
|
|
||||||
if path == '-':
|
|
||||||
if 'r' in mode:
|
|
||||||
return os.fdopen(os.dup(sys.stdin.fileno()), 'r')
|
|
||||||
else:
|
|
||||||
return os.fdopen(os.dup(sys.stdout.fileno()), 'w')
|
|
||||||
else:
|
|
||||||
return open(path, mode)
|
|
||||||
|
|
||||||
# find sizes
|
# find sizes
|
||||||
if not args.get('use', None):
|
if not args.get('use', None):
|
||||||
# find .o files
|
# find .o files
|
||||||
@@ -280,4 +280,6 @@ if __name__ == "__main__":
|
|||||||
parser.add_argument('--build-dir',
|
parser.add_argument('--build-dir',
|
||||||
help="Specify the relative build directory. Used to map object files \
|
help="Specify the relative build directory. Used to map object files \
|
||||||
to the correct source files.")
|
to the correct source files.")
|
||||||
sys.exit(main(**vars(parser.parse_args())))
|
sys.exit(main(**{k: v
|
||||||
|
for k, v in vars(parser.parse_args()).items()
|
||||||
|
if v is not None}))
|
||||||
|
|||||||
@@ -15,6 +15,15 @@ import math as m
|
|||||||
|
|
||||||
CI_PATHS = ['*.ci']
|
CI_PATHS = ['*.ci']
|
||||||
|
|
||||||
|
def openio(path, mode='r'):
|
||||||
|
if path == '-':
|
||||||
|
if 'r' in mode:
|
||||||
|
return os.fdopen(os.dup(sys.stdin.fileno()), 'r')
|
||||||
|
else:
|
||||||
|
return os.fdopen(os.dup(sys.stdout.fileno()), 'w')
|
||||||
|
else:
|
||||||
|
return open(path, mode)
|
||||||
|
|
||||||
def collect(paths, **args):
|
def collect(paths, **args):
|
||||||
# parse the vcg format
|
# parse the vcg format
|
||||||
k_pattern = re.compile('([a-z]+)\s*:', re.DOTALL)
|
k_pattern = re.compile('([a-z]+)\s*:', re.DOTALL)
|
||||||
@@ -116,15 +125,6 @@ def collect(paths, **args):
|
|||||||
return flat_results
|
return flat_results
|
||||||
|
|
||||||
def main(**args):
|
def main(**args):
|
||||||
def openio(path, mode='r'):
|
|
||||||
if path == '-':
|
|
||||||
if 'r' in mode:
|
|
||||||
return os.fdopen(os.dup(sys.stdin.fileno()), 'r')
|
|
||||||
else:
|
|
||||||
return os.fdopen(os.dup(sys.stdout.fileno()), 'w')
|
|
||||||
else:
|
|
||||||
return open(path, mode)
|
|
||||||
|
|
||||||
# find sizes
|
# find sizes
|
||||||
if not args.get('use', None):
|
if not args.get('use', None):
|
||||||
# find .ci files
|
# find .ci files
|
||||||
@@ -427,4 +427,6 @@ if __name__ == "__main__":
|
|||||||
parser.add_argument('--build-dir',
|
parser.add_argument('--build-dir',
|
||||||
help="Specify the relative build directory. Used to map object files \
|
help="Specify the relative build directory. Used to map object files \
|
||||||
to the correct source files.")
|
to the correct source files.")
|
||||||
sys.exit(main(**vars(parser.parse_args())))
|
sys.exit(main(**{k: v
|
||||||
|
for k, v in vars(parser.parse_args()).items()
|
||||||
|
if v is not None}))
|
||||||
|
|||||||
@@ -15,6 +15,15 @@ import collections as co
|
|||||||
|
|
||||||
OBJ_PATHS = ['*.o']
|
OBJ_PATHS = ['*.o']
|
||||||
|
|
||||||
|
def openio(path, mode='r'):
|
||||||
|
if path == '-':
|
||||||
|
if 'r' in mode:
|
||||||
|
return os.fdopen(os.dup(sys.stdin.fileno()), 'r')
|
||||||
|
else:
|
||||||
|
return os.fdopen(os.dup(sys.stdout.fileno()), 'w')
|
||||||
|
else:
|
||||||
|
return open(path, mode)
|
||||||
|
|
||||||
def collect(paths, **args):
|
def collect(paths, **args):
|
||||||
decl_pattern = re.compile(
|
decl_pattern = re.compile(
|
||||||
'^\s+(?P<no>[0-9]+)'
|
'^\s+(?P<no>[0-9]+)'
|
||||||
@@ -115,15 +124,6 @@ def collect(paths, **args):
|
|||||||
|
|
||||||
|
|
||||||
def main(**args):
|
def main(**args):
|
||||||
def openio(path, mode='r'):
|
|
||||||
if path == '-':
|
|
||||||
if 'r' in mode:
|
|
||||||
return os.fdopen(os.dup(sys.stdin.fileno()), 'r')
|
|
||||||
else:
|
|
||||||
return os.fdopen(os.dup(sys.stdout.fileno()), 'w')
|
|
||||||
else:
|
|
||||||
return open(path, mode)
|
|
||||||
|
|
||||||
# find sizes
|
# find sizes
|
||||||
if not args.get('use', None):
|
if not args.get('use', None):
|
||||||
# find .o files
|
# find .o files
|
||||||
@@ -328,4 +328,6 @@ if __name__ == "__main__":
|
|||||||
parser.add_argument('--build-dir',
|
parser.add_argument('--build-dir',
|
||||||
help="Specify the relative build directory. Used to map object files \
|
help="Specify the relative build directory. Used to map object files \
|
||||||
to the correct source files.")
|
to the correct source files.")
|
||||||
sys.exit(main(**vars(parser.parse_args())))
|
sys.exit(main(**{k: v
|
||||||
|
for k, v in vars(parser.parse_args()).items()
|
||||||
|
if v is not None}))
|
||||||
|
|||||||
@@ -57,16 +57,16 @@ FIELDS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def main(**args):
|
def openio(path, mode='r'):
|
||||||
def openio(path, mode='r'):
|
if path == '-':
|
||||||
if path == '-':
|
if 'r' in mode:
|
||||||
if 'r' in mode:
|
return os.fdopen(os.dup(sys.stdin.fileno()), 'r')
|
||||||
return os.fdopen(os.dup(sys.stdin.fileno()), 'r')
|
|
||||||
else:
|
|
||||||
return os.fdopen(os.dup(sys.stdout.fileno()), 'w')
|
|
||||||
else:
|
else:
|
||||||
return open(path, mode)
|
return os.fdopen(os.dup(sys.stdout.fileno()), 'w')
|
||||||
|
else:
|
||||||
|
return open(path, mode)
|
||||||
|
|
||||||
|
def main(**args):
|
||||||
# find results
|
# find results
|
||||||
results = co.defaultdict(lambda: {})
|
results = co.defaultdict(lambda: {})
|
||||||
for path in args.get('csv_paths', '-'):
|
for path in args.get('csv_paths', '-'):
|
||||||
@@ -276,4 +276,6 @@ if __name__ == "__main__":
|
|||||||
help="Show file-level calls.")
|
help="Show file-level calls.")
|
||||||
parser.add_argument('-Y', '--summary', action='store_true',
|
parser.add_argument('-Y', '--summary', action='store_true',
|
||||||
help="Only show the totals.")
|
help="Only show the totals.")
|
||||||
sys.exit(main(**vars(parser.parse_args())))
|
sys.exit(main(**{k: v
|
||||||
|
for k, v in vars(parser.parse_args()).items()
|
||||||
|
if v is not None}))
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ def testcase(path):
|
|||||||
_, case, *_ = path.split('#', 2)
|
_, case, *_ = path.split('#', 2)
|
||||||
return '%s#%s' % (testsuite(path), case)
|
return '%s#%s' % (testsuite(path), case)
|
||||||
|
|
||||||
# TODO move this out in other files
|
|
||||||
def openio(path, mode='r'):
|
def openio(path, mode='r'):
|
||||||
if path == '-':
|
if path == '-':
|
||||||
if 'r' in mode:
|
if 'r' in mode:
|
||||||
@@ -728,6 +727,7 @@ def run_stage(name, runner_, **args):
|
|||||||
# stop other tests
|
# stop other tests
|
||||||
for child in children.copy():
|
for child in children.copy():
|
||||||
child.kill()
|
child.kill()
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
# parallel jobs?
|
# parallel jobs?
|
||||||
@@ -998,7 +998,6 @@ if __name__ == "__main__":
|
|||||||
help="Source file to compile, possibly injecting internal tests.")
|
help="Source file to compile, possibly injecting internal tests.")
|
||||||
comp_parser.add_argument('-o', '--output',
|
comp_parser.add_argument('-o', '--output',
|
||||||
help="Output file.")
|
help="Output file.")
|
||||||
# TODO apply this to other scripts?
|
|
||||||
sys.exit(main(**{k: v
|
sys.exit(main(**{k: v
|
||||||
for k, v in vars(parser.parse_args()).items()
|
for k, v in vars(parser.parse_args()).items()
|
||||||
if v is not None}))
|
if v is not None}))
|
||||||
|
|||||||
Reference in New Issue
Block a user