Skip to content

Remove the googletest include dir from every module instead of scoping it - #268

Open
luapmartin wants to merge 1 commit into
musescore:mainfrom
luapmartin:no-gtest-in-module-includes
Open

luapmartin wants to merge 1 commit into
musescore:mainfrom
luapmartin:no-gtest-in-module-includes

Conversation

@luapmartin

@luapmartin luapmartin commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Resolves: audacity/audacity#11897

muse_create_module / declare_module add the googletest include directory to every module unconditionally, so any production TU can include gtest headers — in the Audacity build that was 407 non-test TUs across all modules.

The only production code that needed it was logremover.h's FRIEND_TEST(Global_LogRemoverTests, ParseDate). parseDate is a pure, stateless parser, so making it public removes the need for FRIEND_TEST / gtest_prod.h entirely — no test-only friend declaration, no conditional include. That removes the last reason any module needs the gtest include dir at build time, so the blanket injection in module setup is simply deleted, with nothing added back. Test targets are unaffected: gtest.cmake already adds the include dir to test executables.

Verified against both the Audacity and MuseScore builds: after the fix, no non-test TU in either sees the gtest include dir (only googletest's own targets do); muse_global_tests builds and passes, including Global_LogRemoverTests.ParseDate.

  • I signed the CLA
  • The title of the PR describes the problem it addresses.
  • Each commit's message describes its purpose and effects, and references the issue it resolves. If changes are extensive, there is a sequence of easily reviewable commits.
  • The code in the PR follows the coding rules.
  • I understand all aspects of the code I'm contributing and I'm able to explain it if requested.
  • The code compiles and runs on my machine, preferably after each commit individually. I have manually tested and verified that my changes fulfil their intended purpose.
  • No prior attempts to resolve this problem exist, or if they do, I listed them in my PR description and described how I avoided repeating past mistakes.
  • There are no unnecessary changes.
  • I created a unit test or vtest to verify the changes I made (if applicable).

Build configuration

audacity: audacity/audacity/master
audacity platforms: linux_x64
musescore: musescore/MuseScore/main
musescore platforms: linux_x64

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Team

Run ID: 623ae51b-b671-4d9c-8914-c754d1bdfc67

📥 Commits

Reviewing files that changed from the base of the PR and between a40d908 and b572fde.

📒 Files selected for processing (1)
  • framework/global/logremover.h

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The CMake module setup no longer retrieves or adds the GoogleTest source include path to module targets. LogRemover::parseDate is now public for direct unit testing. The friend-test declaration and related conditional includes were removed from logremover.h.

Merge Risk: ⚪ Minimal · up to b572f

GoogleTest headers are no longer injected into every module, while LogRemover date parsing remains directly testable through its public interface. No current merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The changes remove the unconditional GoogleTest include directory, but they do not meet the linked issue's stated requirement to retain that include directory for muse_global under MUSE_ENABLE_UNIT_TE… Either add the GoogleTest include directory to muse_global under MUSE_ENABLE_UNIT_TESTS while preserving the existing FRIEND_TEST arrangement, or update issue [#11897] and its acceptance criteria to explicitly approve the alternative public…
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed The LogRemover changes are directly related to removing the final production dependency on the GoogleTest include directory. No unrelated code changes are evident.
Title check ✅ Passed The title clearly identifies the primary change: removing the unconditional GoogleTest include directory from every module.
Description check ✅ Passed The description provides the issue reference, motivation, implementation details, verification results, completed checklist, and build configuration. It satisfies the required template.
Full details: Linked Issues check

Explanation

The changes remove the unconditional GoogleTest include directory, but they do not meet the linked issue's stated requirement to retain that include directory for muse_global under MUSE_ENABLE_UNIT_TESTS. Instead, they make LogRemover::parseDate public and remove FRIEND_TEST and gtest_prod.h.

Resolution

Either add the GoogleTest include directory to muse_global under MUSE_ENABLE_UNIT_TESTS while preserving the existing FRIEND_TEST arrangement, or update issue [#11897] and its acceptance criteria to explicitly approve the alternative public parseDate implementation and removal of the test-only dependency.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@luapmartin

Copy link
Copy Markdown
Contributor Author

/build

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

…g it

The only reason a production header needed it was logremover.h's
FRIEND_TEST(Global_LogRemoverTests, ParseDate). parseDate is a pure, stateless
parser, so making it public removes the need for FRIEND_TEST / gtest_prod.h
entirely, which removes the last reason any module needs the gtest include
dir at build time. Test targets are unaffected: gtest.cmake already adds the
include dir to test executables.
@luapmartin
luapmartin force-pushed the no-gtest-in-module-includes branch from a40d908 to b572fde Compare September 7, 2026 10:47
@luapmartin luapmartin changed the title Add the gtest include dir only to muse_global instead of every module Remove the googletest include dir from every module instead of scoping it Sep 7, 2026
@luapmartin
luapmartin requested review from Eism and kryksyh September 7, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove the googletest include dir from every muse module

1 participant