forked from osmocom/wireshark
tools/check_*.py: allow multiple --file entries
This commit is contained in:
parent
581f3142bb
commit
55d3a9db9e
|
@ -166,7 +166,7 @@ def find_links_in_folder(folder):
|
|||
# command-line args. Controls which dissector files should be scanned.
|
||||
# If no args given, will just scan epan/dissectors folder.
|
||||
parser = argparse.ArgumentParser(description='Check URL links in dissectors')
|
||||
parser.add_argument('--file', action='store', default='',
|
||||
parser.add_argument('--file', action='append',
|
||||
help='specify individual dissector file to test')
|
||||
parser.add_argument('--commits', action='store',
|
||||
help='last N commits to check')
|
||||
|
@ -185,9 +185,15 @@ def is_dissector_file(filename):
|
|||
|
||||
# Get files from wherever command-line args indicate.
|
||||
if args.file:
|
||||
# Fetch links from single file.
|
||||
find_links_in_file(args.file)
|
||||
files.append(args.file)
|
||||
# Add specified file(s)
|
||||
for f in args.file:
|
||||
if not f.startswith('epan'):
|
||||
f = os.path.join('epan', 'dissectors', f)
|
||||
if not os.path.isfile(f):
|
||||
print('Chosen file', f, 'does not exist.')
|
||||
exit(1)
|
||||
else:
|
||||
files.append(f)
|
||||
elif args.commits:
|
||||
# Get files affected by specified number of commits.
|
||||
command = ['git', 'diff', '--name-only', 'HEAD~' + args.commits]
|
||||
|
|
|
@ -387,7 +387,7 @@ def checkFile(filename):
|
|||
# command-line args. Controls which files should be checked.
|
||||
# If no args given, will just scan epan/dissectors folder.
|
||||
parser = argparse.ArgumentParser(description='Check spellings in specified files')
|
||||
parser.add_argument('--file', action='store', default='',
|
||||
parser.add_argument('--file', action='append',
|
||||
help='specify individual file to test')
|
||||
parser.add_argument('--folder', action='store', default='',
|
||||
help='specify folder to test')
|
||||
|
@ -404,12 +404,13 @@ args = parser.parse_args()
|
|||
# Get files from wherever command-line args indicate.
|
||||
files = []
|
||||
if args.file:
|
||||
# Add single specified file..
|
||||
if not os.path.isfile(args.file):
|
||||
print('Chosen file', args.file, 'does not exist.')
|
||||
exit(1)
|
||||
else:
|
||||
files.append(args.file)
|
||||
# Add specified file(s)
|
||||
for f in args.file:
|
||||
if not os.path.isfile(f):
|
||||
print('Chosen file', f, 'does not exist.')
|
||||
exit(1)
|
||||
else:
|
||||
files.append(f)
|
||||
elif args.commits:
|
||||
# Get files affected by specified number of commits.
|
||||
command = ['git', 'diff', '--name-only', 'HEAD~' + args.commits]
|
||||
|
|
|
@ -222,7 +222,7 @@ issues_found = 0
|
|||
parser = argparse.ArgumentParser(description='Check calls in dissectors')
|
||||
parser.add_argument('--build', action='store', default='',
|
||||
help='build folder', required=False)
|
||||
parser.add_argument('--file', action='store', default='',
|
||||
parser.add_argument('--file', action='append',
|
||||
help='specify individual dissector file to test')
|
||||
parser.add_argument('--commits', action='store',
|
||||
help='last N commits to check')
|
||||
|
@ -239,11 +239,15 @@ if args.build:
|
|||
build_folder = args.build
|
||||
|
||||
if args.file:
|
||||
# Add single specified file..
|
||||
if not args.file.startswith('epan'):
|
||||
files.append(os.path.join('epan', 'dissectors', args.file))
|
||||
else:
|
||||
files.append(args.file)
|
||||
# Add specified file(s)
|
||||
for f in args.file:
|
||||
if not f.startswith('epan'):
|
||||
f = os.path.join('epan', 'dissectors', f)
|
||||
if not os.path.isfile(f):
|
||||
print('Chosen file', f, 'does not exist.')
|
||||
exit(1)
|
||||
else:
|
||||
files.append(f)
|
||||
elif args.commits:
|
||||
# Get files affected by specified number of commits.
|
||||
command = ['git', 'diff', '--name-only', 'HEAD~' + args.commits]
|
||||
|
|
|
@ -163,7 +163,7 @@ def checkFile(filename, tfs_items, look_for_common=False):
|
|||
# command-line args. Controls which dissector files should be checked.
|
||||
# If no args given, will just scan epan/dissectors folder.
|
||||
parser = argparse.ArgumentParser(description='Check calls in dissectors')
|
||||
parser.add_argument('--file', action='store', default='',
|
||||
parser.add_argument('--file', action='append',
|
||||
help='specify individual dissector file to test')
|
||||
parser.add_argument('--commits', action='store',
|
||||
help='last N commits to check')
|
||||
|
@ -179,11 +179,15 @@ args = parser.parse_args()
|
|||
# Get files from wherever command-line args indicate.
|
||||
files = []
|
||||
if args.file:
|
||||
# Add single specified file..
|
||||
if not args.file.startswith('epan'):
|
||||
files.append(os.path.join('epan', 'dissectors', args.file))
|
||||
else:
|
||||
files.append(args.file)
|
||||
# Add specified file(s)
|
||||
for f in args.file:
|
||||
if not f.startswith('epan'):
|
||||
f = os.path.join('epan', 'dissectors', f)
|
||||
if not os.path.isfile(f):
|
||||
print('Chosen file', f, 'does not exist.')
|
||||
exit(1)
|
||||
else:
|
||||
files.append(f)
|
||||
elif args.commits:
|
||||
# Get files affected by specified number of commits.
|
||||
command = ['git', 'diff', '--name-only', 'HEAD~' + args.commits]
|
||||
|
|
|
@ -665,7 +665,7 @@ def checkFile(filename, check_mask=False, check_label=False, check_consecutive=F
|
|||
# command-line args. Controls which dissector files should be checked.
|
||||
# If no args given, will just scan epan/dissectors folder.
|
||||
parser = argparse.ArgumentParser(description='Check calls in dissectors')
|
||||
parser.add_argument('--file', action='store', default='',
|
||||
parser.add_argument('--file', action='append',
|
||||
help='specify individual dissector file to test')
|
||||
parser.add_argument('--folder', action='store', default='',
|
||||
help='specify folder to test')
|
||||
|
@ -690,11 +690,15 @@ args = parser.parse_args()
|
|||
# Get files from wherever command-line args indicate.
|
||||
files = []
|
||||
if args.file:
|
||||
# Add single specified file
|
||||
if not args.file.startswith('epan') and not os.path.exists(args.file):
|
||||
files.append(os.path.join('epan', 'dissectors', args.file))
|
||||
else:
|
||||
files.append(args.file)
|
||||
# Add specified file(s)
|
||||
for f in args.file:
|
||||
if not f.startswith('epan'):
|
||||
f = os.path.join('epan', 'dissectors', f)
|
||||
if not os.path.isfile(f):
|
||||
print('Chosen file', f, 'does not exist.')
|
||||
exit(1)
|
||||
else:
|
||||
files.append(f)
|
||||
elif args.folder:
|
||||
# Add all files from a given folder.
|
||||
folder = args.folder
|
||||
|
|
Loading…
Reference in New Issue