Skip to content

Skip tests requiring to load dl_test dynamically #16094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Sep 28, 2024

We have a couple of test cases which are useless, if the dl_test extension is already loaded, since they test the behavior of dl(). However, they are currently failing if dl_test is already loaded; we skip these tests now instead.


If we want to ensure that these tests are exercised, we should make sure that the extension cannot be built statically (currently at least configure would be fine with this on Windows), and we should ensure that the extension cannot be loaded via php.ini and friends. And for Windows, we should probably adapt --enable-test-ini accordingly.

@arnaud-lb, thoughts?

We have a couple of test cases which are useless, if the dl_test
extension is already loaded, since they test the behavior of `dl()`.
However, they are currently failing if dl_test is already loaded; we
skip these tests now instead.
@arnaud-lb
Copy link
Member

arnaud-lb commented Sep 28, 2024

Is this an issue currently?

These tests are designed to ensure that test churn is noticed, which will not be the case if we skip them instead.

This relies on the CI / test environment to not load the extension, but it seems reasonable to me. There are many ways in which the test suite would break if the environment did unexpected things.

Currently the dl_test extension can not be built statically (both config.m4 and config.w32 never enable the extension statically). make test on unixes load all shared extensions by default except dl_test. I believe that on windows it does not load any shared extension by default?

we should ensure that the extension cannot be loaded via php.ini and friends

Agreed (although I'm not a fan of adding a special case just for that outside of the test / build infrastructure).

Regarding php.ini, I think that we should not load any ini file implicitly in tests. I know we do currently, and this leads to unexpected results or difficulties when trying to reproduce a failing test. I've been hit by this a few times. Ini settings can be passed on the run-tests.php command line.

Edit: I see that --enable-test-ini may be the culprit. I agree we should adapt it to ignore dl_test.

@cmb69
Copy link
Member Author

cmb69 commented Sep 28, 2024

This relies on the CI / test environment to not load the extension, but it seems reasonable to me. There are many ways in which the test suite would break if the environment did unexpected things.

Yeah, sure, but we should try to minimize such issues since we cannot control the test environment. It seems very common to me to skip tests if some required dependency is not available (such as a database server, some executable, etc.) Although skipping is not perfect in this case, it is likely better than to have a test fail, what is just confusing to users running the test suite. But see below regarding this issue.

Currently the dl_test extension can not be built statically (both config.m4 and config.w32 never enable the extension statically).

Oh, right; I didn't check this properly.

I believe that on windows it does not load any shared extension by default?

In CI we only load opcache (if configured) and openssl via php.ini:

rem generate php.ini
echo extension_dir=%PHP_BUILD_DIR% > %PHP_BUILD_DIR%\php.ini
echo opcache.file_cache=%PHP_BUILD_DIR%\test_file_cache >> %PHP_BUILD_DIR%\php.ini
if "%OPCACHE%" equ "1" echo zend_extension=php_opcache.dll >> %PHP_BUILD_DIR%\php.ini
rem work-around for some spawned PHP processes requiring OpenSSL
echo extension=php_openssl.dll >> %PHP_BUILD_DIR%\php.ini

I see that --enable-test-ini may be the culprit. I agree we should adapt it to ignore dl_test.

Yes. It's pretty common to configure --with-php-dir=<path> --enable-snapshot-build on Windows, and the generated tmp-php.ini is quite useful. I'm fine to ignore dl_test there; see PR #16098.

@cmb69 cmb69 closed this Sep 28, 2024
@cmb69 cmb69 deleted the cmb/skip-dl-tests branch September 28, 2024 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants