Hi,
4 years ago, Derick proposed a patch to add an '--EXTENSIONS--' section
in phpt files for extensions depending on another one
(http://grokbase.com/t/php/php-internals/11bwptaj78/run-tests-php-and-dynamic-extension-dependencies).
I don't know why, but it seems the patch was not commited.
So, could someone explain how I can write and run phpt tests in an
extension which depends on another dynamically loaded one ? Everything I
tried so far except directly modifying the Makefile failed. And even
modifying the Makefile is far from trivial.
I tried to look at pdo drivers but, in practice, they don't need this
because pdo is always compiled statically. They just use module
dependencies for loading order.
Thanks in advance
François
Hi François
2015-10-24 3:04 GMT+02:00 François Laupretre francois@php.net:
Hi,
4 years ago, Derick proposed a patch to add an '--EXTENSIONS--' section in
phpt files for extensions depending on another one
(http://grokbase.com/t/php/php-internals/11bwptaj78/run-tests-php-and-dynamic-extension-dependencies).
I don't know why, but it seems the patch was not commited.
I'm not sure why either, but I would only welcome such as it does make
testing some extensions much easier, like we have some extensions that
at least in the past, like ext/exif and ext/mbstring that was never
compiled statically on Windows. Meaning the only way we could test
them was by doing something like by making a php.ini with the
following content in the output directory:
[php]
extension_dir = ./
extension = php_mbstring.dll
extension = php_exif.dll
...
You can specify in a command line argument to run-tests.php which
php.ini you wish loaded, or none at all afair which should ease not
having to modify makefiles and such.
--
regards,
Kalle Sommer Nielsen
kalle@php.net
Hi,
4 years ago, Derick proposed a patch to add an '--EXTENSIONS--' section in
phpt files for extensions depending on another one
(http://grokbase.com/t/php/php-internals/11bwptaj78/run-tests-php-and-dynamic-extension-dependencies).
I don't know why, but it seems the patch was not commited.
Oh really? I thought it was :-) I think I must have hacked my local
version and promptly forgot about it. I still think this should be
committed.
cheers,
Derick
Hi Derick,
Le 24/10/2015 12:56, Derick Rethans a écrit :
Oh really? I thought it was :-) I think I must have hacked my local
version and promptly forgot about it. I still think this should be
committed.
Sorry, after investigating more, it appears that your patch was commited.
Now, I must find why it is not working in my case. If I find something
to fix, I'll send a patch.
Regards
François
Hi Derick,
I found the reason why tests are failing : the extension(s) added by the
'EXTENSION' section appear after the tested extension on the PHP
command line. So, they are loaded after when they should be loaded
before.
If the dependency between extensions is at the PHP level only, it's OK.
But, if it is at the C level (direct C function calls), it fails because
loading occurs in a wrong order.
I have posted a bug report for this
(https://bugs.php.net/bug.php?id=70781) and attached a PR. Give thoughts
and, if agreed, we'll ask for a merge, at least in 7.0.
Note that the result is not perfect yet because warning messages still
appear when displaying the information banner. They can be removed by
suppressing the $info_params in write_information() but I didn't include
that in the PR because of possible side effects in the displayed
information. Anyway, the most important is that the tests run.
Regards
François