Skip to content

Commit 5bc467b

Browse files
authored
fix(ci): update laravel assertions, skip bailout under valgrind, fix grep (#3769)
* fix(ci): update laravel test assertions and skip bailout test under valgrind - Laravel Octane/Latest CommonScenariosTest: update two resource name assertions introduced by 1111e80 (unnamed routes now use route URI instead of 'unnamed_route' suffix): simple_view and error routes now produce 'simple_view' and 'error' respectively. - Laravel V4 CommonScenariosTest: update dynamic route resource name assertion for the same reason — Laravel 4.2 has a uri() method so it hits the new elseif branch; expected value is now 'dynamic_route/{param01}/static/{param02?}'. - bailout_double_hook_clear.phpt: add --SKIPIF-- to skip under valgrind (USE_ZEND_ALLOC=0). The test triggers a PHP fatal bailout inside a posthook which bypasses normal span/hook cleanup, causing an expected valgrind LEAKED TEST SUMMARY. The test still runs in the normal (non-valgrind) pass. Pattern matches the guard added in 856068a for background-sender tests. * fix(ci): anchor LEAKED TEST SUMMARY grep to line start The check `! grep -e 'LEAKED TEST SUMMARY'` was too broad: it matched the phrase as a substring anywhere in valgrind-run-tests.out, including inside the PHPINFO section where run-tests.php writes phpinfo() output. Before this fix, the check was masked on PHP 7.0/7.1 because `bailout_double_hook_clear.phpt` leaked under valgrind, causing run-tests.php to exit 1, which short-circuited the && and skipped grep. After adding the SKIPIF to that test, run-tests.php exits 0 and grep runs, finding 6 embedded occurrences that were always there. The actual section header written by run-tests.php is: LEAKED TEST SUMMARY at line start with no leading spaces. The false-positive lines look like: " valgrind LEAKED TEST SUMMARY. The test still runs in the normal" with leading spaces — clearly not the section header. Anchoring with ^ matches only the real header.
1 parent 5031f38 commit 5bc467b

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ test_extension_ci: $(SO_FILE) $(TEST_FILES) $(TEST_STUB_FILES) $(BUILD_DIR)/run-
211211
\
212212
export TEST_PHP_JUNIT=$(JUNIT_RESULTS_DIR)/valgrind-extension-test.xml; \
213213
export TEST_PHP_OUTPUT=$(JUNIT_RESULTS_DIR)/valgrind-run-tests.out; \
214-
$(ALL_TEST_ENV_OVERRIDE) $(RUN_TESTS_CMD) -d extension=$(SO_FILE) -m -s $$TEST_PHP_OUTPUT $(BUILD_DIR)/$(TESTS) && ! grep -e 'LEAKED TEST SUMMARY' $$TEST_PHP_OUTPUT; \
214+
$(ALL_TEST_ENV_OVERRIDE) $(RUN_TESTS_CMD) -d extension=$(SO_FILE) -m -s $$TEST_PHP_OUTPUT $(BUILD_DIR)/$(TESTS) && ! grep -e '^LEAKED TEST SUMMARY' $$TEST_PHP_OUTPUT; \
215215
)
216216

217217
build_tea: TEA_BUILD_TESTS=ON

tests/Integrations/Laravel/Octane/Latest/CommonScenariosTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public function testScenarioGetWithView()
169169
'laravel.request',
170170
'swoole_test_app',
171171
'web',
172-
'App\Http\Controllers\CommonSpecsController@simple_view unnamed_route'
172+
'App\Http\Controllers\CommonSpecsController@simple_view simple_view'
173173
)->withExactTags([
174174
Tag::HTTP_METHOD => 'GET',
175175
Tag::HTTP_URL => 'http://localhost/simple_view?key=value&<redacted>',
@@ -258,7 +258,7 @@ public function testScenarioGetWithException()
258258
'laravel.request',
259259
'swoole_test_app',
260260
'web',
261-
'App\Http\Controllers\CommonSpecsController@error unnamed_route'
261+
'App\Http\Controllers\CommonSpecsController@error error'
262262
)->withExactTags([
263263
Tag::HTTP_METHOD => 'GET',
264264
Tag::HTTP_URL => 'http://localhost/error?key=value&<redacted>',

tests/Integrations/Laravel/V4/CommonScenariosTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function provideSpecs()
186186
]),
187187
],
188188
'A GET request to a dynamic route returning a string' => [
189-
SpanAssertion::build('laravel.request', 'laravel', 'web', 'HomeController@dynamicRoute unnamed_route')
189+
SpanAssertion::build('laravel.request', 'laravel', 'web', 'HomeController@dynamicRoute dynamic_route/{param01}/static/{param02?}')
190190
->withExactTags([
191191
'laravel.route.name' => 'unnamed_route',
192192
'laravel.route.action' => 'HomeController@dynamicRoute',

tests/ext/bailout_double_hook_clear.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
--TEST--
22
Bailout during hook END should not cause double-clear of span (internal function)
3+
--SKIPIF--
4+
<?php
5+
if (getenv('USE_ZEND_ALLOC') === '0' && !getenv('SKIP_ASAN')) die('skip valgrind: bailout path bypasses normal cleanup, causing expected leaks');
6+
?>
37
--FILE--
48
<?php
59

0 commit comments

Comments
 (0)