OSDN Git Service

[UpdateTestChecks] Error if --llvm-mca-binary gets an empty string
authorGreg Bedwell <greg_bedwell@sn.scee.net>
Tue, 5 Jun 2018 17:16:19 +0000 (17:16 +0000)
committerGreg Bedwell <greg_bedwell@sn.scee.net>
Tue, 5 Jun 2018 17:16:19 +0000 (17:16 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334029 91177308-0d34-0410-b5e6-96231b3b80d8

utils/update_mca_test_checks.py

index dcd52f6..18de299 100755 (executable)
@@ -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))