# run-tests.php and dynamic extension dependencies

- Thread: https://externals.io/message/88928
- Original archive: https://news-web.php.net/php.internals/88928
- Started by francois@php.net on 2015-10-24T01:04:26+00:00
- Messages: 5
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #88928 — francois@php.net — 2015-10-24T01:04:26+00:00

URL: https://externals.io/message/88928#88928

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

---

## #88930 — Kalle Sommer Nielsen — 2015-10-24T05:48:18+00:00

URL: https://externals.io/message/88928#88930 · In reply to: #88928

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

---

## #88931 — Derick Rethans — 2015-10-24T10:56:34+00:00

URL: https://externals.io/message/88928#88931 · In reply to: #88928

> 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

---

## #88932 — francois@php.net — 2015-10-24T15:18:26+00:00

URL: https://externals.io/message/88928#88932 · In reply to: #88931

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

---

## #88933 — francois@php.net — 2015-10-24T18:20:09+00:00

URL: https://externals.io/message/88928#88933 · In reply to: #88931

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
