Skip to content

tests: check: use find_program for iwyu_tool#500

Draft
jordalgo wants to merge 1 commit intofacebook:mainfrom
jordalgo:fix_iwyu
Draft

tests: check: use find_program for iwyu_tool#500
jordalgo wants to merge 1 commit intofacebook:mainfrom
jordalgo:fix_iwyu

Conversation

@jordalgo
Copy link
Copy Markdown

@jordalgo jordalgo commented Apr 7, 2026

Use find_program instead of the absolute path for iwyu. This fixes an issue where this binary can't be found in a nix shell.

Tested locally and now the iwyu tests pass and the binary can be located.

@jordalgo jordalgo requested a review from qdeslandes as a code owner April 7, 2026 12:05
@meta-cla meta-cla Bot added the cla signed label Apr 7, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

Claude review of PR #500 (f6efb07)

Clean, minimal PR that correctly replaces a hardcoded /usr/bin/iwyu_tool.py path with find_program() — matching the existing pattern for RUN_CLANG_TIDY_BIN and CLANG_FORMAT_BIN — and adds the missing LABELS "check" property for the check.iwyu test. No correctness issues found.

Suggestions

  • Silent test skip without warningtests/check/CMakeLists.txt:35 — when IWYU_TOOL_BIN is not found, check.iwyu silently disappears from the test suite; consider adding message(WARNING ...) so developers know the check is being skipped

Nits

  • Ambiguous commit message — commit title — "fix iwyu include" could be mistaken for a C #include issue; consider tests: check: use find_program for iwyu_tool
  • Test properties orderingtests/check/CMakeLists.txt:39set_tests_properties("check.iwyu") is placed after check.lint properties rather than directly after its own add_test block (pre-existing inconsistency, no action strictly required)

Workflow run

Comment thread tests/check/CMakeLists.txt
Comment thread tests/check/CMakeLists.txt Outdated
@jordalgo jordalgo changed the title tests: check: fix iwyu include tests: check: use find_program for iwyu_tool Apr 7, 2026
Comment thread tests/check/CMakeLists.txt Outdated
Copy link
Copy Markdown
Contributor

@qdeslandes qdeslandes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick nit, otherwise LGTM!

Comment thread tests/check/CMakeLists.txt Outdated
Comment on lines +35 to +49
if(IWYU_TOOL_BIN)
add_test(NAME "check.iwyu"
COMMAND
${IWYU_TOOL_BIN}
-p ${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/src/libbpfilter/cgen/program.c
)

set_tests_properties("check.iwyu" PROPERTIES
LABELS "check"
)
else()
message(WARNING "iwyu_tool not found, check.iwyu test will be skipped")
endif()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove the if(): if iwyu is not found, it should error out. Otherwise, we could miss the warning and proceed without it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had it without the if in the first iteration but I think it was causing a build failure in one or two of the CI jobs

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me try again

@jordalgo jordalgo force-pushed the fix_iwyu branch 2 times, most recently from a5083a9 to 098817d Compare April 14, 2026 13:59
@jordalgo jordalgo marked this pull request as draft April 14, 2026 15:30
@jordalgo jordalgo marked this pull request as draft April 14, 2026 15:30
@jordalgo jordalgo force-pushed the fix_iwyu branch 2 times, most recently from ef86c98 to 991d799 Compare April 14, 2026 16:17
This fixes a few issues:
- instead of running iwyu on one file, run it on the whole build if the
  WITH_IWYU flag is added
- use Cmake's native iwyu instead of relying on the path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants