Skip to content

chore(profiling): implement native test install subdirs (PROF-14200)#18488

Closed
vlad-scherbich wants to merge 1 commit into
chore/315-wrapping-contextfrom
vlad/profiling-native-test-install-subdir
Closed

chore(profiling): implement native test install subdirs (PROF-14200)#18488
vlad-scherbich wants to merge 1 commit into
chore/315-wrapping-contextfrom
vlad/profiling-native-test-install-subdir

Conversation

@vlad-scherbich

@vlad-scherbich vlad-scherbich commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

← Gab's #17849 | Next → #17624

Description

Adds an optional INSTALL_SUBDIR keyword argument to the dd_wrapper_add_test CMake
function in ddtrace/internal/datadog/profiling/stack/test/CMakeLists.txt.

When specified, the test binary is installed to test/<subdir>/ instead of the shared
test/ directory. Without the keyword, behavior is identical to before.

Motivation: build_base_venvs in GitLab CI runs as a parallel matrix across all Python
versions, and GitLab merges all job artifacts into a single directory for downstream jobs.
A version-specific test binary (e.g. one compiled against libpython3.15) placed in the
shared test/ directory will be picked up by the pytest gtest plugin in a py3.10 test
environment and crash immediately — reported as a silent "C++ failure" with no test output.

INSTALL_SUBDIR py315 (used in the next PR in the stack) isolates py3.15-only test
binaries so this collision cannot happen.

Also adds cmakeformat_fix script to hatch.toml (needed by the 07-run-cmake-format
pre-commit hook) and updates hooks/README.md to document the in-place formatting +
re-stage behavior.

Part of the Python 3.15 support stack. Relates to #17809.

Testing

  • No behavior change for existing tests (test_thread_span_links, test_cpython_layout_contracts) — they call dd_wrapper_add_test without INSTALL_SUBDIR and install to the same test/ path as before.
  • The INSTALL_SUBDIR keyword is exercised in the next PR (vlad/ddtracepy-315-profiling-only), where test_frame_state_315 uses INSTALL_SUBDIR py315.

Risks

None. The CMake function change is backward-compatible: INSTALL_SUBDIR is optional and the default path is unchanged.

Additional Notes

  • cmake_parse_arguments separates the keyword from source file arguments via _ARG_UNPARSED_ARGUMENTS, so adding the keyword does not affect how source files are passed to add_executable.
  • This pattern can be extended to dd_wrapper/test/CMakeLists.txt if that test directory ever needs similar isolation.

@vlad-scherbich
vlad-scherbich changed the base branch from main to chore/315-wrapping-context June 5, 2026 20:02
@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Codeowners resolved as

ddtrace/internal/datadog/profiling/stack/test/CMakeLists.txt            @DataDog/profiling-python

@datadog-official

datadog-official Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 4 Pipeline jobs failed

Changelog | Validate changelog   View in Datadog   GitHub Actions

DataDog/apm-reliability/dd-trace-py | build_base_venvs: [3.15]   View in Datadog   GitLab

DataDog/apm-reliability/dd-trace-py | check_requirements_lockfiles   View in Datadog   GitLab

View all 4 failed jobs.

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 3f47516 | Docs | Datadog PR Page | Give us feedback!

Allows version-specific native test binaries to install into a subdir
of the shared test/ directory (e.g. INSTALL_SUBDIR py315 -> test/py315/).

build_base_venvs runs in parallel across all Python versions and GitLab
merges all artifacts into a single directory for downstream jobs. Without
isolation a binary compiled for pyX.Y (RPATH -> libpythonX.Y) lands in
the shared test/ directory and crashes when the pytest gtest plugin tries
to run it against a different Python runtime.

Callers that do not pass INSTALL_SUBDIR are unaffected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vlad-scherbich
vlad-scherbich force-pushed the vlad/profiling-native-test-install-subdir branch from ee85127 to 3f47516 Compare June 5, 2026 20:11
@vlad-scherbich vlad-scherbich changed the title Vlad/profiling native test install subdir chore(profiling): implement native test install subdirs Jun 5, 2026
@github-actions github-actions Bot added the stale label Jul 7, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed after a period of inactivity.
After this much time, it will likely be easier to open a new pull request with the
same changes than to update this one from the base branch. Please comment or reopen
if you think this pull request was closed in error.

@github-actions github-actions Bot closed this Jul 9, 2026
@vlad-scherbich vlad-scherbich changed the title chore(profiling): implement native test install subdirs chore(profiling): implement native test install subdirs (PROF-14200) Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant