[UpdateTestChecks] Error if --llvm-mca-binary gets an empty string

If the command line was mistyped like:
./update_mca_test_checks.py --llvm-mca-binary= /path/to/llvm-mca *.s
                                              ^-- extra whitespace

then /path/to/llvm-mca would get treated by argparse as a test-path
pattern and could actually be opened in write mode and overwritten.

llvm-svn: 334029
This commit is contained in:
Greg Bedwell 2018-06-05 17:16:19 +00:00
parent 757600bccb
commit a9a6d54146
1 changed files with 3 additions and 0 deletions

View File

@ -77,6 +77,9 @@ def _parse_args():
_configure_warnings(args)
if not args.llvm_mca_binary:
raise Error('--llvm-mca-binary value cannot be empty string')
if os.path.basename(args.llvm_mca_binary) != 'llvm-mca':
_warn('unexpected binary name: {}'.format(args.llvm_mca_binary))