⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

[miopen] Users/randyspauldingamd/gtest fixturemap#3706

Closed
randyspauldingamd wants to merge 4 commits intodevelopfrom
users/randyspauldingamd/gtest_fixturemap
Closed

[miopen] Users/randyspauldingamd/gtest fixturemap#3706
randyspauldingamd wants to merge 4 commits intodevelopfrom
users/randyspauldingamd/gtest_fixturemap

Conversation

@randyspauldingamd
Copy link

@randyspauldingamd randyspauldingamd commented Feb 3, 2026

Proposed changes

This is the 2nd step in applying the dependency parser to MIOpen (and by extension, all mathlibs in TheRock). It started from #3686. I wasn't able to get a clean diff, so this includes those changes as well.

The scenario is a repo that combines many (hundreds of) individual gtest files into a single test binary. The existing change detection can be adapted by using --gtest_filter and re-mapping from "a list of test files that need to be ran" to "a list of gtest fixtures that need to be ran." In theory, this can be done statically by parsing all of the test files and extracting the fixture names directly from the TEST, TEST_F, and INSTANTIATE_TEST_SUITE_P macros. However, this isn’t straightforward in MIOpen, because many of the test names are built up with helper macros.

Another option would be to use gtest internals to extract them at runtime. This is not ideal because these can change without warning.

Setting those solutions aside for now, another alternative is to build the discrete tests and run them all with --gtest_list_tests. This requires much less lead effort since MIOpen does have this capability. This PR enables collection of the data, definition of the mapping file, and construction of the gtest_filter.

  • Added all_gtest_fixtures.py which extracts all gtest fixtures from all executables in a single folder and constructs a flat map of executable name to the list of gtest fixtures it contains.
  • Added an optional argument to selective_test_filter.py, --fixturemap which provides the filename and enables the filter construction.
  • Assembles the gtest_filter and adds it to the output json.

Checklist

Please put an x into the boxes that apply. You can also fill these out after creating the PR. If you're not sure, please don't hesitate to ask.

  • I have added tests relevant to the introduced functionality, and the unit tests are passing locally
  • I have added the test to REGRESSION_TESTS list defined at the top of CMakeLists.txt in tests/CMakeLists.txt, IF the test takes more than 30 seconds to run.
  • I have added inline documentation which enables the maintainers with understanding the motivation
  • I have removed the stale documentation which is no longer relevant after this pull request
  • (If this change is user-facing) I have added release notes which provide the end users with a brief summary of the improvement from this pull request
  • I have run clang-format on all changed files
  • Any dependent changes have been merged

Discussion

Workflow:
0. Create a symlink to dependency parser, ala: sudo ln -s /home/<user>/repos/composable_kernel/script/dependency-parser /dep

  1. Run MIOpen CMake with MIOPEN_TEST_DISCRETE=ON (I run this in miopen/build_all)
  2. Build: <miopen/build_all># ninja tests (this produces a few hundred gtest binaries)
  3. Run: <miopen/build_all># python3 /dep/src/all_gtest_fixtures.py bin gtests.txt
  4. Create a different build folder (I use miopen/build_one), run MIOpen CMake with MIOPEN_TEST_DISCRETE=OFF, and start building the single gtest binary miopen_gtest
  5. Run the parser: <miopen/build_all># python3 /dep/main.py parse build/build.ninja
  6. Run the selector: <miopen/build_all># python3 /dep/main.py select enhanced_dependency_mapping.json <base_sha> <change_sha> --fixturemap gtests.txt
  7. I use an alias to extract the filter: alias gtf="python3 -c \"import json; print(json.load(open('tests_to_run.json'))['gtest_filter'])\""
  8. Run the tests: ../build_one/bin/miopen_gtest --gtest_filter=$(gtf)

@randyspauldingamd randyspauldingamd changed the base branch from users/randyspauldingamd/dep_parser_monorepo to develop February 3, 2026 18:47
@randyspauldingamd randyspauldingamd changed the title Users/randyspauldingamd/gtest fixturemap [miopen] Users/randyspauldingamd/gtest fixturemap Feb 3, 2026
return (
file_path.is_file()
and os.access(file_path, os.X_OK)
and not file_path.name.startswith('.') # skip hidden files
Copy link
Author

Choose a reason for hiding this comment

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

TODO: detect gtest in the binary

@ammallya
Copy link
Contributor

ammallya commented Feb 3, 2026

Imported to ROCm/rocm-libraries

@ammallya ammallya closed this Feb 3, 2026
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.

2 participants