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

Greg Bedwell via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 5 10:16:19 PDT 2018


Author: gbedwell
Date: Tue Jun  5 10:16:19 2018
New Revision: 334029

URL: http://llvm.org/viewvc/llvm-project?rev=334029&view=rev
Log:
[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.

Modified:
    llvm/trunk/utils/update_mca_test_checks.py

Modified: llvm/trunk/utils/update_mca_test_checks.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/update_mca_test_checks.py?rev=334029&r1=334028&r2=334029&view=diff
==============================================================================
--- llvm/trunk/utils/update_mca_test_checks.py (original)
+++ llvm/trunk/utils/update_mca_test_checks.py Tue Jun  5 10:16:19 2018
@@ -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))
 




More information about the llvm-commits mailing list