Skip to content

Add source file filtering support for GoogleTest - #5139

Open
theutpal01 wants to merge 1 commit into
google:mainfrom
theutpal01:utpal/feature
Open

theutpal01 wants to merge 1 commit into
google:mainfrom
theutpal01:utpal/feature

Conversation

@theutpal01

Copy link
Copy Markdown

Title: Add source file filtering for tests

Description:

Closes #4771.

This adds --sourceFileFilter to select tests by their recorded source path. It supports * and ? wildcards and can be combined with --gtest_filter.

The changes:

  • googletest/src/gtest.cc — defines and parses the flag, filters tests by source path, and includes the source filter in the no-match warning.
  • googletest/test/googletest-filter-unittest.py — covers exact and wildcard path matching, combined filters, no matches, missing values, and the -- argument separator.
  • googletest/test/googletest-filter-unittest-extra_.cc — adds a test from a separate source file for the filter tests.
  • googletest/CMakeLists.txt and googletest/test/BUILD.bazel — add the extra source file to the CMake and Bazel test targets.
  • docs/advanced.md — documents the option and its wildcard behavior.

Testing:

  • CMake: googletest-filter-unittest passed on Linux.
  • Bazel: //googletest/test:googletest-filter-unittest passed on Linux.
  • I couldn’t run the tests on Windows.

- Introduced `--sourceFileFilter` option to filter tests by their source file.
- Updated `gtest.cc` to handle the new filter and modified test execution logic.
- Added tests for source file filtering in `googletest-filter-unittest.py`.
- Included additional source file in the build configuration for unit tests.

This branch has not been deployed

No deployments
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.

[FR]: Some way to filter by source file name defining the tests

1 participant