From a9a6d54146f83d2c0354dcf61f5919bfedcc0a99 Mon Sep 17 00:00:00 2001 From: Greg Bedwell Date: Tue, 5 Jun 2018 17:16:19 +0000 Subject: [PATCH] [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 --- llvm/utils/update_mca_test_checks.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/llvm/utils/update_mca_test_checks.py b/llvm/utils/update_mca_test_checks.py index dcd52f6e913c..18de299f1ce7 100755 --- a/llvm/utils/update_mca_test_checks.py +++ b/llvm/utils/update_mca_test_checks.py @@ -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))