Skip to content

Rename zend-test to zend_test #6613

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 2 commits into from
Closed

Rename zend-test to zend_test #6613

wants to merge 2 commits into from

Conversation

nikic
Copy link
Member

@nikic nikic commented Jan 18, 2021

The extension name should match the name of the ext/ directory,
otherwise it will not get picked up by run-tests. It would be possible
to remap this in run-tests, but I think it's better to rename the
extension to follow the standard format. Other extensions also
use underscore instead of hyphen (e.g. pdo_mysql and not pdo-mysql).
Of course, ./configure options are always hyphenated.

@nikic nikic mentioned this pull request Jan 18, 2021
@nikic
Copy link
Member Author

nikic commented Jan 18, 2021

Ugh, there are some observer test failures when JIT is enabled (cc @SammyK)

@nikic
Copy link
Member Author

nikic commented Jan 18, 2021

I think all the test failures have the same root cause though. The "get return value even if not used" part doesn't work under JIT.

@nikic
Copy link
Member Author

nikic commented Jan 18, 2021

Okay, the reason why those tests fail is actually not related to the JIT (though I believe that problem also exists), but to the fact that opcache inlines calls to functions that contain only return constant;.

My question would then be what the expected behavior is in that case. If ZEND_OBSERVER_ENABLED, should this optimization be disabled? Or should rather optimizations be disabled only for the tests (under the assumption that the observer should only see calls that would normally happen as well)?

@morrisonlevi
Copy link
Contributor

morrisonlevi commented Jan 18, 2021

At what point does opcache do this optimization? Can it know if the function is being observed before inlining?

If not, then I think it would be ideal for extensions to disable this optimization, and not just do it unconditionally whenever an observer is attached. This is because for APM you wouldn't want to disable this optimization (probably), but for a debugger or some other kind of debugger observer you might, so let the observer choose.

@nikic
Copy link
Member Author

nikic commented Jan 18, 2021

At what point does opcache do this optimization?

static void zend_try_inline_call(zend_op_array *op_array, zend_op *fcall, zend_op *opline, zend_function *func)

Can it know if the function is being observed before inlining?

As that is only determined on first call, no.

If not, then I think it would be ideal for extensions to disable this optimization, and not just do it unconditionally whenever an observer is attached. This is because for APM you wouldn't want to disable this optimization (probably), but for a debugger or some other kind of debugger you might, so let the observer choose.

Yes, I think I agree your reasoning here. In that case I'd tag the relevant tests with opcache.optimization_level=0.

@nikic
Copy link
Member Author

nikic commented Jan 19, 2021

Tests should be fixed by dd7d829 and fbd8e20.

@nikic
Copy link
Member Author

nikic commented Jan 19, 2021

Tests pass on azure now, but fail on windows due to path separators.

nikic added 2 commits January 19, 2021 11:09
The extension name should match the name of the ext/ directory,
otherwise it will not get picked up by run-tests. It would be possible
to remap this in run-tests, but I think it's better to rename the
extension to follow the standard format. Other extensions also
use underscore instead of hyphen (e.g. pdo_mysql and not pdo-mysql).
Of course, ./configure options are always hyphenated.
@SammyK
Copy link
Contributor

SammyK commented Jan 19, 2021

Thanks for the investigation and fix on this @nikic. 🙇

@mvorisek
Copy link
Contributor

What about renaming extension names Zend OPcache and PDO_OCI too?

@nikic
Copy link
Member Author

nikic commented Jan 28, 2021

Renaming those would break extension_loaded checks, doesn't seem worthwhile. (The same applies to zend_test, but as it's an internal testing extension, it does not matter.)

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.

4 participants