Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions build_tools/github_actions/fetch_test_configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,15 @@ def _family_matches(
"windows": 1,
},
},
"dbgapi-cpu": {
"job_name": "dbgapi-cpu",
"fetch_artifact_args": "--debug-tools --tests",
"timeout_minutes": 30,
"test_script": f"python {_get_script_path('test_dbgapi.py')}",
"platform": ["linux", "windows"],
"total_shards": 1,
"linux_cpu_runner": True,
},
"rocgdb-cpu": {
**_rocgdb_common,
"job_name": "rocgdb-cpu",
Expand Down
46 changes: 46 additions & 0 deletions build_tools/github_actions/test_executable_scripts/test_dbgapi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT

"""
Test script for the amd-dbgapi unit tests.

The test binaries are installed under tests/rocdbgapi in the unified ROCm tree.
They are plain GoogleTest executables, so each one is run directly.
"""

import logging
import os
import platform
import shlex
import subprocess
import sys
from pathlib import Path

THEROCK_BIN_DIR = os.getenv("THEROCK_BIN_DIR")
if not THEROCK_BIN_DIR:
raise RuntimeError("THEROCK_BIN_DIR environment variable is not set")

logging.basicConfig(level=logging.INFO, format="%(message)s")

test_dir = Path(THEROCK_BIN_DIR).resolve().parent / "tests" / "rocdbgapi"

is_windows = platform.system() == "Windows"
tests = sorted(
p
for p in test_dir.iterdir()
if p.is_file() and (p.suffix == ".exe" if is_windows else os.access(p, os.X_OK))
)
if not tests:
logging.error(f"No test executables found in {test_dir}")
sys.exit(1)

failed = []
for test in tests:
cmd = [str(test)]
logging.info(f"++ Exec [{test_dir}]$ {shlex.join(cmd)}")
if subprocess.run(cmd, cwd=test_dir).returncode != 0:
failed.append(test.name)

if failed:
logging.error(f"Failed tests: {', '.join(failed)}")
sys.exit(1)
11 changes: 11 additions & 0 deletions build_tools/packaging/linux/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3046,6 +3046,17 @@
]
}
]
},
{
"Artifact": "amd-dbgapi",
"Artifact_Subdir": [
{
"Name": "amd-dbgapi",
"Components": [
"test"
]
}
]
}
],
"Disable_DWZ": "True",
Expand Down
10 changes: 10 additions & 0 deletions debug-tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ if(THEROCK_ENABLE_AMD_DBGAPI)
set(EXTRA_DEBUG_TOOLS_CMAKE_ARGS "-DBUILD_SHARED_LIBS=OFF")
endif()

# Only build and link against GoogleTest when tests are requested, so
# the dependency isn't pulled in for non-testing configurations.
set(EXTRA_AMD_DBGAPI_BUILD_DEPS)
if(THEROCK_BUILD_TESTING)
list(APPEND EXTRA_AMD_DBGAPI_BUILD_DEPS therock-googletest)
endif()

therock_cmake_subproject_declare(amd-dbgapi
USE_DIST_AMDGPU_TARGETS
EXTERNAL_SOURCE_DIR "${THEROCK_AMD_DBGAPI_SOURCE_DIR}"
Expand All @@ -78,9 +85,11 @@ if(THEROCK_ENABLE_AMD_DBGAPI)
amd-llvm
CMAKE_ARGS
-DTHE_ROCK_BUILD=ON
"-DENABLE_TESTS=${THEROCK_BUILD_TESTING}"

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.

Thanks for the changes @lumachad, can ENABLE_TESTS stay off until an upstream unit test actually exercises amd-dbgapi? For my understanding: the new binary dbgapi_smoke_test only links GTest::gtest_main and GTest::gmock. It does not call amd-dbgapi. Does the follow-up add that unit test, or does it only run this smoke binary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

can ENABLE_TESTS stay off until an upstream unit test actually exercises amd-dbgapi?

I'd rather leave the ENABLE_TESTS gated on THEROCK_BUILD_TESTING, as that means we always go through the infra to build these and install the files. That way we'll always test this path when we bump rocm-systems, even though we don't have a complete set of unit tests or invoke them.

For my understanding: the new binary dbgapi_smoke_test only links GTest::gtest_main and GTest::gmock. It does not call amd-dbgapi. Does the follow-up add that unit test, or does it only run this smoke binary?

The follow-up will start running these CPU-based smoke tests first, then the set will be expanded to do real CPU-based tests. Then we will eventually have GPU-based ones.

Enablement of the unit tests is taking place in parallel, and will be done in incremental steps.

Does that answer your questions?

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.

Thank you . This explains why ENABLE_TESTS stays tied to THEROCK_BUILD_TESTING.
And reconfirms The smoke binary, the missing amd-dbgapi unit test, and the later GPU tests are expected in follow-up

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.

@lumachad at this time dbgapi_smoke_test is included in packaging, but not getting tested with CI, right?
Would you have a link to dbgapi_smoke_test test results to make sure it runs fine?

@lumachad lumachad Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@dileepr1 That's correct. I did the validation locally on Linux. The Windows runners had some hiccups that prevented running it. I think I can put up a second temporary commit to at least confirm the smoke test runs fine on both Windows and Linux. Would that be acceptable?

Once we see it working, I can drop the temporary patch and go with just building it but not running it in CI.

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.

That would be great, thanks!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Pushed a temporary commit now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

${EXTRA_DEBUG_TOOLS_CMAKE_ARGS}
BUILD_DEPS
${THEROCK_BUNDLED_LIBBACKTRACE}
${EXTRA_AMD_DBGAPI_BUILD_DEPS}
RUNTIME_DEPS
amd-comgr
INTERFACE_LINK_DIRS
Expand Down Expand Up @@ -119,6 +128,7 @@ if(THEROCK_ENABLE_AMD_DBGAPI)
dev
doc
lib
test
SUBPROJECT_DEPS
amd-comgr
amd-dbgapi
Expand Down
7 changes: 7 additions & 0 deletions debug-tools/artifact-amd-dbgapi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@
[components.lib."debug-tools/amd-dbgapi/stage"]
[components.dbg."debug-tools/amd-dbgapi/stage"]
[components.dev."debug-tools/amd-dbgapi/stage"]
exclude = [
"tests/**",
]
[components.doc."debug-tools/amd-dbgapi/stage"]
[components.test."debug-tools/amd-dbgapi/stage"]
include = [
"tests/**"
]
1 change: 1 addition & 0 deletions test_tools/therock_consumer_graph.json
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@
"therock-googletest": {
"consumers": [
"amd-comgr",
"amd-dbgapi",
"amdsmi",
"aqlprofile",
"hipblas",
Expand Down
Loading