Skip to content

Unit & feature tests infrastructure - #12199

Merged
lumachad merged 1 commit into
developfrom
users/arikalo/rocdbgapi/unit_feature_tests
Oct 28, 2026
Merged

lumachad merged 1 commit into
developfrom
users/arikalo/rocdbgapi/unit_feature_tests

Conversation

@motokultivator

@motokultivator motokultivator commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Introduces the build system plumbing required to host a GoogleTest-based unit and feature test suite for rocdbgapi.

  • ENABLE_TESTS is a master switch enabling all test tiers; ENABLE_UNIT_TESTS enables just the unit tier and can be toggled independently, matching the pattern already used by rocr-debug-agent. Both default OFF so downstream consumers (e.g. the TheRock superbuild) are not forced to pick up GoogleTest/GMock until they opt in with -DENABLE_TESTS=ON.
  • Reusable CMake helpers register unit test executables uniformly. GoogleTest resolution prefers GTest::* targets already provided by a parent project (e.g. the TheRock superbuild), falling back to find_package(GTest CONFIG) for a system installation. All four targets (gtest, gtest_main, gmock, gmock_main) must be present; incomplete installations fail with clear error messages and installation instructions.
  • test/CMakeLists.txt and test/unit/CMakeLists.txt define the test tree skeleton and per-target registration scaffolding. A minimal smoke test exercises both GoogleTest and GMock as a usage example.
  • Built unit test binaries install under tests/rocdbgapi relative to CMAKE_INSTALL_PREFIX.
  • All new CMake files use SPDX license headers (MIT).

Building the test suite requires GoogleTest and GMock, only when opted in with -DENABLE_TESTS=ON. The main README documents this as a build prerequisite with per-distro package names, and test/README.md documents the test tree layout, build switches, and usage without duplicating that material. The CHANGELOG records the new dependency and options.

ISSUE ID : AIROCGDB-634

Test plan

  • Configure with default options and confirm no test targets are built (tests off by default)
  • Configure with ENABLE_TESTS=ON and confirm the smoke test builds and passes
  • Configure with ENABLE_TESTS=ON -DENABLE_UNIT_TESTS=OFF and confirm behavior matches rocr-debug-agent's pattern
  • Verify build fails with a clear error message when GTest/GMock are not installed and tests are enabled
  • Verify install places unit test binaries under tests/rocdbgapi

🤖 Generated with Claude Code

@therock-pr-bot

therock-pr-bot Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

✅ All Policy Checks Passed

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ✅ Pass PR does not contain code files — Unit Test auto-passed
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —

🎉 All policy checks passed!

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ PR Description

The Not ready to Review label has been added to this PR.
Once all policies pass, the label will be removed automatically.

@lumachad

Copy link
Copy Markdown
Contributor

Thanks. I'll start going through this one.

@lumachad lumachad left a comment

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.

Left some high level comments of what we should change. Mostly cleaning up the license headers and polishing up the GoogleTest/GMock/etc dependency discovery.

Downloading these dependencies wouldn't be acceptable I'm afraid.

Comment thread projects/rocdbgapi/test/README.md Resolved
Comment thread projects/rocdbgapi/test/README.md Resolved
Comment thread projects/rocdbgapi/test/README.md Resolved
Comment thread projects/rocdbgapi/test/README.md Resolved
@motokultivator
motokultivator force-pushed the users/arikalo/rocdbgapi/unit_feature_tests branch from 4f83147 to 698323b Compare October 1, 2026 12:46
@lumachad

lumachad commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Looks like we have conflicts.

@lumachad

lumachad commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@motokultivator FTR, I'm waiting for these conflicts to be cleaned up before I do another review.

@motokultivator
motokultivator force-pushed the users/arikalo/rocdbgapi/unit_feature_tests branch from 698323b to 6cf87ce Compare October 6, 2026 12:00
@motokultivator

Copy link
Copy Markdown
Contributor Author

@motokultivator FTR, I'm waiting for these conflicts to be cleaned up before I do another review.

Done. Sorry for the delay, I was OOO.

@lumachad
lumachad marked this pull request as ready for review October 6, 2026 13:42
@lumachad
lumachad requested a review from a team as a code owner October 6, 2026 13:42
@lumachad lumachad assigned lumachad and unassigned motokultivator Oct 6, 2026
@lumachad

lumachad commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

@motokultivator Let's skip commit 2. What we want is just a clean cmake change that provides a way to build tests and then dummy examples of those tests in a second commit.

After that is in, then we can start adapting dbgapi's code to be testable.

For instance, the rocr-debug-agent unit testing effort: #12460

@lumachad lumachad assigned motokultivator and unassigned lumachad Oct 6, 2026
@motokultivator
motokultivator force-pushed the users/arikalo/rocdbgapi/unit_feature_tests branch from 6cf87ce to b202464 Compare October 7, 2026 13:36
@lumachad

lumachad commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

This is still adding much more than required for smoke tests. We need just the cmake changes and a dummy smoke test.

@motokultivator
motokultivator force-pushed the users/arikalo/rocdbgapi/unit_feature_tests branch from b202464 to 0f75900 Compare October 8, 2026 11:12
@motokultivator

Copy link
Copy Markdown
Contributor Author

This is still adding much more than required for smoke tests. We need just the cmake changes and a dummy smoke test.

How about this: CMake, a project skeleton, a README, and a smoke test as an example?
Still 9 files :(

@motokultivator
motokultivator force-pushed the users/arikalo/rocdbgapi/unit_feature_tests branch from 0f75900 to d131d6c Compare October 9, 2026 14:21
@lumachad
lumachad force-pushed the users/arikalo/rocdbgapi/unit_feature_tests branch from d131d6c to 995db06 Compare October 12, 2026 16:33
@lumachad lumachad added the ci:skip Skip all CI builds/tests for this PR label Oct 12, 2026
@lumachad

Copy link
Copy Markdown
Contributor

Labelling ci:skip until we pick up ROCm/TheRock#8943

@amd-bfilipov amd-bfilipov left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gave this to my claude to compare this with similar PR that I have merged, by comparing comments on that PR and if any of those are applicable to this PR. None of them apply here and (or they have been addressed).
From my perspective, looks good, approved.

@lumachad

Copy link
Copy Markdown
Contributor

Blocked by ROCm/TheRock#8943.

Introduce the build system plumbing required to host a GoogleTest
based unit and feature test suite for rocdbgapi.

ENABLE_TESTS is a master switch that enables all test tiers.
ENABLE_UNIT_TESTS enables just the unit tier and can be toggled
independently, matching the pattern used by rocr-debug-agent's
ENABLE_TESTS and ENABLE_UNIT_TESTS options. Both default OFF so
downstream consumers (e.g. TheRock superbuild) are not forced to pick
up GoogleTest/GMock until they opt in with -DENABLE_TESTS=ON.

Reusable helpers register unit test executables uniformly. GoogleTest
resolution prefers GTest::* targets already provided by a parent
project (e.g. TheRock superbuild) and otherwise uses find_package(GTest
CONFIG) to locate a system installation. All four targets (gtest,
gtest_main, gmock, gmock_main) must be present. Incomplete
installations fail with clear error messages and installation
instructions.

test/CMakeLists.txt and test/unit/CMakeLists.txt define the test tree
skeleton and per target registration scaffolding. A minimal smoke test
exercises both GoogleTest and GMock as an example for usage. Built
unit test binaries install under tests/rocdbgapi relative to
CMAKE_INSTALL_PREFIX. All new CMake files use SPDX license headers
(MIT).

Building the test suite requires GoogleTest and GMock, only when
opted in. The main README documents this as a build prerequisite with
per distro package names, and test/README.md documents the test tree
layout, build switches, and usage without repeating that material.
The CHANGELOG records the new dependency and options.

Co-Authored-By: Luis Machado <luis.machado@amd.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@lumachad
lumachad force-pushed the users/arikalo/rocdbgapi/unit_feature_tests branch from 995db06 to 6d23843 Compare October 28, 2026 10:32
@lumachad lumachad removed the ci:skip Skip all CI builds/tests for this PR label Oct 28, 2026
@lumachad
lumachad merged commit f9a7ae7 into develop Oct 28, 2026
80 of 84 checks passed
@lumachad
lumachad deleted the users/arikalo/rocdbgapi/unit_feature_tests branch October 28, 2026 11:15
@lumachad

Copy link
Copy Markdown
Contributor

Disabled tests by default and merged, so we don't stay blocked by #8943.

systems-assistant Bot pushed a commit to ROCm/ROCdbgapi that referenced this pull request Oct 28, 2026
Introduce the build system plumbing required to host a GoogleTest
based unit and feature test suite for rocdbgapi.

ENABLE_TESTS is a master switch that enables all test tiers.
ENABLE_UNIT_TESTS enables just the unit tier and can be toggled
independently, matching the pattern used by rocr-debug-agent's
ENABLE_TESTS and ENABLE_UNIT_TESTS options. Both default OFF so
downstream consumers (e.g. TheRock superbuild) are not forced to pick
up GoogleTest/GMock until they opt in with -DENABLE_TESTS=ON.

Reusable helpers register unit test executables uniformly. GoogleTest
resolution prefers GTest::* targets already provided by a parent
project (e.g. TheRock superbuild) and otherwise uses find_package(GTest
CONFIG) to locate a system installation. All four targets (gtest,
gtest_main, gmock, gmock_main) must be present. Incomplete
installations fail with clear error messages and installation
instructions.

test/CMakeLists.txt and test/unit/CMakeLists.txt define the test tree
skeleton and per target registration scaffolding. A minimal smoke test
exercises both GoogleTest and GMock as an example for usage. Built
unit test binaries install under tests/rocdbgapi relative to
CMAKE_INSTALL_PREFIX. All new CMake files use SPDX license headers
(MIT).

Building the test suite requires GoogleTest and GMock, only when
opted in. The main README documents this as a build prerequisite with
per distro package names, and test/README.md documents the test tree
layout, build switches, and usage without repeating that material.
The CHANGELOG records the new dependency and options.

Co-Authored-By: Luis Machado <luis.machado@amd.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
[rocm-systems] ROCm/rocm-systems#12199 (commit f9a7ae7)
@systems-assistant

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

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.

3 participants