Skip to content

fix(ci): patch run-tests.php getTimer() to return float instead of comma-formatted string#3856

Draft
Leiyks wants to merge 1 commit intomasterfrom
leiyks/fix-ci-run-tests-number-format
Draft

fix(ci): patch run-tests.php getTimer() to return float instead of comma-formatted string#3856
Leiyks wants to merge 1 commit intomasterfrom
leiyks/fix-ci-run-tests-number-format

Conversation

@Leiyks
Copy link
Copy Markdown
Contributor

@Leiyks Leiyks commented May 5, 2026

What

  • Add a second sed patch to $(BUILD_DIR)/run-tests.php at build time, replacing number_format( with round( inside getTimer()

Why

PHP's run-tests.php getTimer() returns number_format($elapsed, 4), which produces a comma-formatted string (e.g. "1,500.0000") when a test takes ≥1000 seconds. PHP 8.0+ raises E_WARNING: A non-numeric value encountered when that string is used in += arithmetic inside record(). The main test runner process treats this as a fatal worker error and exits with code 2.

This started surfacing ~1 week ago because commit fdbad29 moved DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED=0 from ALL_TEST_ENV_OVERRIDE (covers all test targets, including valgrind) into ENV_OVERRIDE (covers only the non-valgrind run). The valgrind run now executes with process tags enabled, making live-debugger and sidecar-related tests 5–20× slower under valgrind's instrumentation, pushing some past the 1000s threshold.

How

We already patch run-tests.php at build time for an unrelated dl() issue. This adds a second patch in the same $(BUILD_DIR)/run-tests.php Makefile target:

sed -i 's/return number_format($$this->rootSuite/return round($$this->rootSuite/' $(BUILD_DIR)/run-tests.php

round($elapsed, 4) returns a float (e.g. 1999.5678) instead of a comma-formatted string, which is safe for += arithmetic. The JUnit XML time='...' attribute also benefits — 1999.5678 is more spec-compliant than 1,999.5678.

Verified the sed pattern matches both PHP 8.4.19 (line 3441) and PHP 8.5.0 (line 3433).

Testing

  • CI: test_extension_ci: [8.4] and test_extension_ci: [8.5] valgrind runs no longer abort with E_WARNING: A non-numeric value encountered in run-tests.php

@datadog-datadog-prod-us1-2
Copy link
Copy Markdown

datadog-datadog-prod-us1-2 Bot commented May 5, 2026

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 60.68% (-0.01%)

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

…d runs

PHP's run-tests.php getTimer() returns number_format($elapsed, 4) which
produces a comma-formatted string (e.g. "1,500.0000") when a test takes
>=1000 seconds. PHP 8.0+ raises E_WARNING when that string is used in +=
arithmetic inside record(), causing the test runner to abort with exit code 2.

Patch getTimer() at build time (replacing number_format with round) so it
returns a float instead. This is triggered on valgrind runs where tests are
5-20x slower; commit fdbad29 (Apr 27) inadvertently removed
DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED=0 from ALL_TEST_ENV_OVERRIDE
(which covers valgrind runs), enabling process tags there and pushing some
tests past the 1000s threshold.
@Leiyks Leiyks force-pushed the leiyks/fix-ci-run-tests-number-format branch from 6b764c8 to 2fed8f4 Compare May 5, 2026 15:46
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.

1 participant