mirror of
https://github.com/littlefs-project/littlefs.git
synced 2025-12-11 18:12:44 +00:00
scripts: Adopted better input file handling in result scripts
- Error on no/insufficient files. Instead of just returning no results. This is more useful when debugging complicated bash scripts. - Use elf magic to allow any file order in perfbd.py/stack.py. This was already implemented in stack.py, now also adopted in perfbd.py. Elf files always start with the magic string "\x7fELF", so we can use this to figure out the types of input files without needing to rely on argument order. This is just one less thing to worry about when invoking these scripts.
This commit is contained in:
@@ -1383,15 +1383,25 @@ if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Find stack usage at the function level.",
|
||||
allow_abbrev=False)
|
||||
class AppendPath(argparse.Action):
|
||||
def __call__(self, parser, namespace, value, option):
|
||||
if getattr(namespace, 'paths', None) is None:
|
||||
namespace.paths = []
|
||||
if value is None:
|
||||
pass
|
||||
elif isinstance(value, str):
|
||||
namespace.paths.append(value)
|
||||
else:
|
||||
namespace.paths.extend(value)
|
||||
parser.add_argument(
|
||||
'paths',
|
||||
metavar='obj_paths',
|
||||
'obj_paths',
|
||||
nargs='*',
|
||||
action=AppendPath,
|
||||
help="Input *.o files.")
|
||||
parser.add_argument(
|
||||
'paths_',
|
||||
metavar='ci_paths',
|
||||
'ci_paths',
|
||||
nargs='*',
|
||||
action=AppendPath,
|
||||
help="Input *.ci files.")
|
||||
parser.add_argument(
|
||||
'-v', '--verbose',
|
||||
|
||||
Reference in New Issue
Block a user