Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8a90927
Add support for macos test_c run
bwoebi May 11, 2026
b3278c7
Handle MacOS EMSGSIZE
bwoebi May 13, 2026
7ac0c5a
codesign ddtrace.so after build on macOS
bwoebi May 15, 2026
c2b47e7
Run with timeout for artifacts
bwoebi Jun 19, 2026
b0a1650
fix: update datadog-live-debugger references after libdatadog rename
bwoebi Sep 4, 2026
4296dbf
ci: switch macos test_c to Tart virtualized runner
bwoebi Sep 4, 2026
b78b708
fix(tests): pin DD_TRACE_RATE_LIMIT for test determinism
bwoebi Sep 5, 2026
94eef2c
fix(tests): always ignore agent sampling rates and pin rate limit for…
bwoebi Sep 5, 2026
e8f343f
debug: temporary instrumentation for agent-info env override + CI env…
bwoebi Sep 5, 2026
124b5d5
fix(ci): unset host-injected DD_AGENT_HOST/DD_TRACE_AGENT_PORT on mac…
bwoebi Sep 5, 2026
bcc4e7f
fix: macOS test_c CI flakiness (env leakage, log noise, SKIPIF gap)
bwoebi Sep 5, 2026
b7c10cc
Cleanup comments
bwoebi Sep 7, 2026
8679cbd
fix(ci): scope macOS-only test env overrides to Darwin, fix clippy CI…
bwoebi Sep 8, 2026
cb02958
Skip test
bwoebi Sep 11, 2026
f3e9991
fix(ci): address Codex review of macOS test_c job
bwoebi Sep 12, 2026
8583c38
chore: bump libdatadog for the macOS recv-liveness fix
bwoebi Sep 12, 2026
3a485a5
fix(tests): skip extract_server_values.phpt on macOS
bwoebi Sep 12, 2026
e819c74
fix(ci): resolve thread-mode sidecar shutdown hang on macOS
bwoebi Sep 12, 2026
ef5311c
ci(macos): run request-replayer natively to enable dev-env tests
bwoebi Sep 12, 2026
b15b113
fix(ci): use sudo -b to background request-replayer, not shell &
bwoebi Sep 12, 2026
5b6db49
fix(tests): skip crashtracker and /proc-based re-exec tests on macOS
bwoebi Sep 12, 2026
fcaf2fe
fix(ci): explicitly kill request-replayer instead of relying on detach
bwoebi Sep 12, 2026
1b0206e
fix(ci): kill request-replayer inside script:, not only after_script
bwoebi Sep 12, 2026
21ae6be
ci(macos): add curl, sockets, ffi to unlock more test coverage
bwoebi Sep 12, 2026
dd1480e
ci(macos): bump PHP to 8.5.9, fixing a tailcall-VM vm_interrupt crash
bwoebi Sep 12, 2026
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
94 changes: 93 additions & 1 deletion .gitlab/generate-tracer.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function windows_test_c_job($job_name, $thread_safety, $targets) {
docker exec ${CONTAINER_NAME} powershell.exe "cd app; switch-php <?= $thread_safety ?>; C:\php\SDK\phpize.bat; .\configure.bat --enable-debug-pack; nmake"

# Set test environment variables
docker exec ${CONTAINER_NAME} powershell.exe "setx DD_AUTOLOAD_NO_COMPILE true; setx DATADOG_HAVE_DEV_ENV 1; setx DD_TRACE_GIT_METADATA_ENABLED 0"
docker exec ${CONTAINER_NAME} powershell.exe "setx DD_AUTOLOAD_NO_COMPILE true; setx DATADOG_HAVE_DEV_ENV 1; setx DD_TRACE_GIT_METADATA_ENABLED 0; setx DD_TRACE_IGNORE_AGENT_SAMPLING_RATES 1; setx DD_TRACE_RATE_LIMIT 1000000"

# Exclude tests that deadlock the php-cgi SKIPIF skip-task on Windows.
<?php foreach ([
Expand Down Expand Up @@ -197,6 +197,98 @@ function windows_test_c_job($job_name, $thread_safety, $targets) {
]);
?>

"macos test_c":
stage: test
tags: ["macos:tart"]
image: "486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/ci-platform-machine-images/tart-vm:shared-sonoma-latest"
variables:
PHP_MACOS_VERSION: "8.5.9"
PHP_INSTALL_DIR: "/tmp/php-macos-${PHP_MACOS_VERSION}"
_DD_DEBUG_SIDECAR_LOG_LEVEL: trace
_DD_DEBUG_SIDECAR_LOG_METHOD: "file://${CI_PROJECT_DIR}/artifacts/sidecar.log"
# Enables tests gated by tests/ext/includes/skipif_no_dev_env.inc (see request-replayer
# setup below), matching the Linux/Windows jobs' dev-env-dependent test coverage.
DATADOG_HAVE_DEV_ENV: 1
PHP_CLI_SERVER_WORKERS: "16"
DD_REQUEST_DUMPER_FILE: dump.json
before_script:
# Strip the noisy DD_* env vars from the locally installed agent
- unset DD_SERVICE DD_ENV DD_TAGS DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED DD_AGENT_HOST DD_TRACE_AGENT_PORT DD_DOGSTATSD_PORT
- brew install pkg-config openssl re2c bison libxml2 oniguruma libzip libsodium php
- mkdir -p /tmp/php-build "${CI_PROJECT_DIR}/artifacts/tests"
- curl -fL "https://github.com/php/php-src/archive/refs/tags/php-${PHP_MACOS_VERSION}.tar.gz" | tar xz -C /tmp/php-build
- cd "/tmp/php-build/php-src-php-${PHP_MACOS_VERSION}"
- ./buildconf --force
- |
export PATH="$(brew --prefix bison)/bin:$(brew --prefix libxml2)/bin:${PATH}"
export PKG_CONFIG_PATH="$(brew --prefix libxml2)/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
export LDFLAGS="-L$(brew --prefix libxml2)/lib ${LDFLAGS:-}"
export CPPFLAGS="-I$(brew --prefix libxml2)/include ${CPPFLAGS:-}"
./configure \
--prefix="${PHP_INSTALL_DIR}" \
--enable-debug \
--enable-zts \
--enable-pcntl \
--without-iconv \
--with-openssl="$(brew --prefix openssl)" \
--with-libxml \
--enable-mbstring \
--with-sodium \
--with-curl \
--enable-sockets \
--with-ffi
- make -j"$(sysctl -n hw.ncpu)"
- make install
- cd "${CI_PROJECT_DIR}"
- rustup update stable && rustup default stable
- |
# There's no Docker service network on the macOS Tart runner (unlike the Linux/Windows
# jobs' "request-replayer" service container), so run request-replayer as a native
# background process on loopback instead, and alias its hostname via /etc/hosts so
# tests that hardcode "request-replayer" (see tests/Common/TracerTestTrait.php et al.)
# resolve it the same way. Uses brew's php (bundles curl + gmp, both required -- see
# dockerfiles/services/request-replayer/linux.Dockerfile and index.php's
# UnpackOptions::BIGINT_AS_GMP) rather than our from-source test build, which has
# neither and is a separate, unrelated PHP install.
grep -q '[[:space:]]request-replayer$' /etc/hosts || sudo bash -c 'echo "127.0.0.1 request-replayer" >> /etc/hosts'
REQUEST_REPLAYER_PHP="$(brew --prefix php)/bin/php"
"${REQUEST_REPLAYER_PHP}" -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');"
"${REQUEST_REPLAYER_PHP}" /tmp/composer-setup.php --install-dir=/tmp --filename=composer.phar
(cd dockerfiles/services/request-replayer/src && "${REQUEST_REPLAYER_PHP}" /tmp/composer.phar install --no-interaction)
# `sudo -b` (not `sudo ... &`): a non-interactive shell's `&` doesn't put the
# backgrounded job in its own process group, so it stays in sudo's -- and sudo,
# with pty allocation (common on macOS), waits for the whole process group to exit
# before returning. `-b` is sudo's own flag for backgrounding the command, so sudo
# itself returns immediately instead of waiting on this long-lived server. Even so,
# explicitly kill the server in after_script below (via its captured PID) rather than
# relying purely on detachment: the job still hung once even with -b, most likely
# some other inherited handle back to the runner's own output pipe, and killing it
# outright sidesteps whatever that is rather than chasing it further.
sudo -b bash -c "cd '${CI_PROJECT_DIR}/dockerfiles/services/request-replayer/src' && PHP_CLI_SERVER_WORKERS='${PHP_CLI_SERVER_WORKERS}' DD_REQUEST_DUMPER_FILE='${DD_REQUEST_DUMPER_FILE}' nohup '${REQUEST_REPLAYER_PHP}' -S 127.0.0.1:80 index.php < /dev/null > '${CI_PROJECT_DIR}/artifacts/request-replayer.log' 2>&1 & echo \$! > '${CI_PROJECT_DIR}/artifacts/request-replayer.pid'"
script:
- export PATH="${PHP_INSTALL_DIR}/bin:${PATH}"
- export TEST_PHP_JUNIT="${CI_PROJECT_DIR}/artifacts/tests/php-tests.xml"
- php --version
- make -j"$(sysctl -n hw.ncpu)"
- timeout 20m make test_c
# GitLab's "step_script" (before_script + script) itself doesn't return while
# request-replayer is still alive -- confirmed by a run where the test suite finished
# cleanly (0 failures) but the job then sat idle until GitLab's own 1h job timeout
# killed it, with after_script never even starting. So kill it here, at the end of
# script itself, not only in after_script (kept below as a backstop for a failing
# script: that never reaches this line).
- test -f "${CI_PROJECT_DIR}/artifacts/request-replayer.pid" && sudo kill -9 "$(cat "${CI_PROJECT_DIR}/artifacts/request-replayer.pid")" || true
after_script:
- mkdir -p "${CI_PROJECT_DIR}/artifacts/diffs"
- find . -type f \( -name '*.diff' -o -name '*.mem' \) -not -path '*/vendor/*' -exec cp '{}' "${CI_PROJECT_DIR}/artifacts/diffs/" \; || true
- test -f "${CI_PROJECT_DIR}/artifacts/request-replayer.pid" && sudo kill -9 "$(cat "${CI_PROJECT_DIR}/artifacts/request-replayer.pid")" || true
artifacts:
when: always
reports:
junit: "artifacts/tests/php-tests.xml"
paths:
- "artifacts/"


"Prepare code":
stage: compile
Expand Down
Empty file added .gitlab/macos.yml
Empty file.
70 changes: 19 additions & 51 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading