code_size_compare: check --record-dir properly

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
This commit is contained in:
Yanray Wang 2023-07-26 15:37:26 +08:00
parent a279ca9ff8
commit 9e8b671b1c

View File

@ -815,11 +815,11 @@ def main():
'optional arguments', 'optional arguments',
'optional arguments to parse for running ' + os.path.basename(__file__)) 'optional arguments to parse for running ' + os.path.basename(__file__))
group_optional.add_argument( group_optional.add_argument(
'--record_dir', type=str, default='code_size_records', '--record-dir', type=str, default='code_size_records',
help='directory where code size record is stored. ' help='directory where code size record is stored. '
'(Default: code_size_records)') '(Default: code_size_records)')
group_optional.add_argument( group_optional.add_argument(
'-r', '--comp-dir', type=str, default='comparison', '--comp-dir', type=str, default='comparison',
help='directory where comparison result is stored. ' help='directory where comparison result is stored. '
'(Default: comparison)') '(Default: comparison)')
group_optional.add_argument( group_optional.add_argument(
@ -858,9 +858,14 @@ def main():
else: else:
logger.setLevel(logging.DEBUG if comp_args.verbose else logging.INFO) logger.setLevel(logging.DEBUG if comp_args.verbose else logging.INFO)
if os.path.isfile(comp_args.record_dir):
logger.error("record directory: {} is not a directory"
.format(comp_args.record_dir))
sys.exit(1)
if os.path.isfile(comp_args.comp_dir): if os.path.isfile(comp_args.comp_dir):
logger.error("{} is not a directory".format(comp_args.comp_dir)) logger.error("comparison directory: {} is not a directory"
parser.exit() .format(comp_args.comp_dir))
sys.exit(1)
comp_args.old_rev = CodeSizeCalculator.validate_git_revision( comp_args.old_rev = CodeSizeCalculator.validate_git_revision(
comp_args.old_rev) comp_args.old_rev)