Skip to content

Commit 1c1dfaa

Browse files
committed
Fix iwyu integration test by creating compile_commands.json
The iwyu integration test was passing when it should fail because include-what-you-use needs a compilation database (compile_commands.json) to properly analyze files. The integration_test function was not creating compile_commands.json before running pre-commit, so iwyu couldn't detect unused includes. Added call to set_compilation_db() to create the compilation database for integration tests, matching the shell command test setup.
1 parent ecba2e5 commit 1c1dfaa

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

tests/test_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ def integration_test(cmd_name, files, args, test_dir):
113113
if test_file_base in test_file_strs:
114114
with open(test_file, "w") as fd:
115115
fd.write(test_file_strs[test_file_base])
116+
# Create compilation database for clang-tidy and iwyu
117+
set_compilation_db(files)
116118
# Add only the files we are testing
117119
run_in(["git", "reset"], test_dir)
118120
run_in(["git", "add"] + files, test_dir)

0 commit comments

Comments
 (0)