Index: test/clang-tidy/check_clang_tidy.py =================================================================== --- test/clang-tidy/check_clang_tidy.py +++ test/clang-tidy/check_clang_tidy.py @@ -25,6 +25,7 @@ """ import argparse +import os import re import subprocess import sys @@ -41,6 +42,7 @@ parser.add_argument('input_file_name') parser.add_argument('check_name') parser.add_argument('temp_file_name') + parser.add_argument('--bin-dir', '-b', default='.', help='Directory containing clang-tidy and FileCheck executables') args, extra_args = parser.parse_known_args() @@ -48,6 +50,7 @@ input_file_name = args.input_file_name check_name = args.check_name temp_file_name = args.temp_file_name + bin_dir = args.bin_dir extension = '.cpp' if (input_file_name.endswith('.c')): @@ -83,7 +86,8 @@ original_file_name = temp_file_name + ".orig" write_file(original_file_name, cleaned_test) - args = ['clang-tidy', temp_file_name, '-fix', '--checks=-*,' + check_name] + \ + executable = os.path.join(bin_dir, 'clang-tidy') + args = [executable, temp_file_name, '-fix', '--checks=-*,' + check_name] + \ clang_tidy_extra_args print('Running ' + repr(args) + '...') try: @@ -108,10 +112,11 @@ diff_output.decode() + '\n------------------------------------------------------------------') + file_check_exe = os.path.join(bin_dir, 'FileCheck') if has_check_fixes: try: subprocess.check_output( - ['FileCheck', '-input-file=' + temp_file_name, input_file_name, + [file_check_exe, '-input-file=' + temp_file_name, input_file_name, '-check-prefix=CHECK-FIXES', '-strict-whitespace'], stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: @@ -123,7 +128,7 @@ write_file(messages_file, clang_tidy_output) try: subprocess.check_output( - ['FileCheck', '-input-file=' + messages_file, input_file_name, + [file_check_exe, '-input-file=' + messages_file, input_file_name, '-check-prefix=CHECK-MESSAGES', '-implicit-check-not={{warning|error}}:'], stderr=subprocess.STDOUT)