Skip to content

Commit 0b7e378

Browse files
committed
Allow check_clang_tidy.py to be configured with tool; reenable unit test
1 parent 46e1fe2 commit 0b7e378

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

check_clang_tidy.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,14 @@ def main():
5050
parser.add_argument('-resource-dir')
5151
parser.add_argument('input_file_name')
5252
parser.add_argument('check_name')
53+
parser.add_argument('checktool', nargs='?', default="O2codecheck")
5354

5455
args, extra_args = parser.parse_known_args()
5556

5657
resource_dir = args.resource_dir
5758
input_file_name = args.input_file_name
5859
check_name = args.check_name
60+
tool = args.checktool
5961

6062
extension = '.cpp'
6163
if (input_file_name.endswith('.c')):
@@ -92,7 +94,7 @@ def main():
9294
original_file_name = temp_file_name + ".orig"
9395
write_file(original_file_name, cleaned_test)
9496

95-
args = ['O2codecheck', temp_file_name, '-fix', '--checks=-*,' + check_name] + \
97+
args = [tool, temp_file_name, '-fix', '--checks=-*,' + check_name] + \
9698
clang_tidy_extra_args
9799
print('Running ' + repr(args) + '...')
98100

test/CMakeLists.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
# testing if regex works correctly (has problem with gcc < 4.9)
22
add_executable(testregex testregex.cpp)
33
add_test(testregexcorrect testregex)
4-
#add_test(NAME aliceo2namespace COMMAND ${CMAKE_SOURCE_DIR}/check_clang_tidy.py ${CMAKE_SOURCE_DIR}/test/aliceO2-namespace-naming.cpp aliceO2-namespace-naming)
54

6-
# correctness testing of checks
5+
# we need the FileCheck program in order to execute the check_clang_tidy.py script
6+
find_program(LLVMFILECHECK FileCheck HINTS PATH)
7+
if (LLVMFILECHECK)
8+
9+
# testing namespace naming checker
10+
add_test(NAME aliceo2namespace COMMAND
11+
${CMAKE_SOURCE_DIR}/check_clang_tidy.py
12+
${CMAKE_SOURCE_DIR}/test/aliceO2-namespace-naming.cpp
13+
aliceO2-namespace-naming ${CMAKE_BINARY_DIR}/tool/O2codecheck)
14+
15+
else()
16+
message(STATUS "FileCheck not found; disabling the check_clang_tidy unit tests\n")
17+
endif(LLVMFILECHECK)
18+

0 commit comments

Comments
 (0)