Skip to content

Commit

Permalink
Fix OpenTelemetry makefile conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Bob Weinand <[email protected]>
  • Loading branch information
bwoebi committed Feb 19, 2025
1 parent fbfbccd commit cb41689
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 57 deletions.
37 changes: 1 addition & 36 deletions Cargo.lock

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

26 changes: 11 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1152,10 +1152,13 @@ define run_benchmarks_with_ddprof
endef

define run_composer_with_lock
rm $1/composer.lock-php* 2>/dev/null || true
rm $1/$(if $2,$(2:.json=.lock),composer.lock)-php* 2>/dev/null || true
$(eval CURRENT_COMPOSER:=$(COMPOSER))
$(if $(2), $(eval COMPOSER:=COMPOSER=$2 $(COMPOSER)))
$(call run_composer_with_retry,$1,)
$(eval COMPOSER:=$(CURRENT_COMPOSER))
find $1/vendor* \( -name Tests -prune -o -name tests -prune \) -exec rm -rf '{}' \;
touch $1/composer.lock-php$(PHP_MAJOR_MINOR)
touch $1/$(if $2,$(2:.json=.lock),composer.lock)-php$(PHP_MAJOR_MINOR)
endef

# use this as the first target if you want to use uncompiled files instead of the _generated_*.php compiled file.
Expand Down Expand Up @@ -1240,26 +1243,19 @@ benchmarks: benchmarks_run_dependencies call_benchmarks

benchmarks_opcache: benchmarks_run_dependencies call_benchmarks_opcache

define setup_opentelemetry
cp $(1) $(dir $(1))/composer.json
endef

define run_opentelemetry_tests
$(eval TEST_EXTRA_ENV=$(shell [ $(PHP_MAJOR_MINOR) -ge 81 ] && echo "OTEL_PHP_FIBERS_ENABLED=1" || echo '') DD_TRACE_OTEL_ENABLED=1 DD_TRACE_GENERATE_ROOT_SPAN=0)
$(eval TEST_EXTRA_ENV=$(shell [ $(PHP_MAJOR_MINOR) -ge 81 ] && echo "OTEL_PHP_FIBERS_ENABLED=1" || echo '') DD_TRACE_OTEL_ENABLED=1 DD_TRACE_GENERATE_ROOT_SPAN=0 $1)
$(call run_tests,--testsuite=opentelemetry1 $(TESTS))
$(eval TEST_EXTRA_ENV=)
endef

_test_opentelemetry_beta_setup: global_test_run_dependencies
$(call setup_opentelemetry,tests/OpenTelemetry/composer-beta.json)

test_opentelemetry_beta: _test_opentelemetry_beta_setup tests/Frameworks/Custom/OpenTelemetry/composer.lock-php$(PHP_MAJOR_MINOR) tests/OpenTelemetry/composer.lock-php$(PHP_MAJOR_MINOR)
$(call run_opentelemetry_tests)
test_opentelemetry_beta: tests/Frameworks/Custom/OpenTelemetry/composer.lock-php$(PHP_MAJOR_MINOR) tests/OpenTelemetry/composer-beta.lock-php$(PHP_MAJOR_MINOR)
$(call run_opentelemetry_tests, TESTSUITE_VENDOR_DIR=vendor-beta)

_test_opentelemetry_1_setup: global_test_run_dependencies
$(call setup_opentelemetry,tests/OpenTelemetry/composer-1.json)
tests/OpenTelemetry/composer-beta.lock-php$(PHP_MAJOR_MINOR): tests/OpenTelemetry/composer-beta.json
$(call run_composer_with_lock,tests/OpenTelemetry,composer-beta.json)

test_opentelemetry_1: _test_opentelemetry_1_setup tests/Frameworks/Custom/OpenTelemetry/composer.lock-php$(PHP_MAJOR_MINOR) tests/OpenTelemetry/composer.lock-php$(PHP_MAJOR_MINOR)
test_opentelemetry_1: tests/Frameworks/Custom/OpenTelemetry/composer.lock-php$(PHP_MAJOR_MINOR) tests/OpenTelemetry/composer.lock-php$(PHP_MAJOR_MINOR)
$(call run_opentelemetry_tests)

test_opentracing_10: global_test_run_dependencies tests/OpenTracer1Unit/composer.lock-php$(PHP_MAJOR_MINOR) tests/Frameworks/Custom/OpenTracing/composer.lock-php$(PHP_MAJOR_MINOR)
Expand Down
1 change: 1 addition & 0 deletions dockerfiles/ci/xfail_tests/8.2.list
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ ext/mbstring/tests/zend_multibyte-01.phpt
ext/mbstring/tests/zend_multibyte-02.phpt
ext/mbstring/tests/zend_multibyte-06.phpt
ext/mysqli/tests/ghsa-h35g-vwh6-m678-stmt-row-double.phpt
ext/mysqli/tests/protocol_stmt_row_fetch_data.phpt
ext/openssl/tests/bug46127.phpt
ext/openssl/tests/bug48182.phpt
ext/openssl/tests/bug54992.phpt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ OTEL_PHP_FIBERS_ENABLED=1
<?php
use OpenTelemetry\Context\Context;

require_once './tests/OpenTelemetry/vendor/autoload.php';
$vendorDir = getenv("TESTSUITE_VENDOR_DIR") ?: "vendor";
require_once "./tests/OpenTelemetry/$vendorDir/autoload.php";

$key = Context::createKey('-');
$scope = Context::getCurrent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ OTEL_PHP_FIBERS_ENABLED=1
<?php
use OpenTelemetry\Context\Context;

require_once './tests/OpenTelemetry/vendor/autoload.php';
$vendorDir = getenv("TESTSUITE_VENDOR_DIR") ?: "vendor";
require_once "./tests/OpenTelemetry/$vendorDir/autoload.php";

$key = Context::createKey('-');

Expand Down
5 changes: 4 additions & 1 deletion tests/OpenTelemetry/composer-beta.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"open-telemetry/extension-propagator-b3": "@beta",
"open-telemetry/opentelemetry-logger-monolog": "@beta"
},
"minimum-stability": "beta"
"minimum-stability": "beta",
"config": {
"vendor-dir": "vendor-beta/"
}
}
File renamed without changes.
5 changes: 3 additions & 2 deletions tests/bootstrap_common.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,15 @@ function update_test_agent_session_token($token) {

// ensure the integration-specific autoloader is loaded
$hook = function ($object, $scope, $args) {
$vendorDir = getenv("TESTSUITE_VENDOR_DIR") ?: "vendor";
$path = dirname($args[0]);
if (strpos($path, "vendor")) {
return; // No nested vendor
}
while (strlen($path) > strlen(__DIR__)) {
if (file_exists("$path/vendor/autoload.php")) {
if (file_exists("$path/$vendorDir/autoload.php")) {
putenv("COMPOSER_ROOT_VERSION=1.0.0"); // silence composer
\DDTrace\Tests\Common\IntegrationTestCase::$autoloadPath = "$path/vendor/autoload.php";
\DDTrace\Tests\Common\IntegrationTestCase::$autoloadPath = "$path/$vendorDir/autoload.php";
require_once \DDTrace\Tests\Common\IntegrationTestCase::$autoloadPath;
return;
} elseif (file_exists("$path/composer.json")) {
Expand Down

0 comments on commit cb41689

Please sign in to comment.