Skip to content

tests: Introduce platform checks #7325

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
Closed

Conversation

MaxSem
Copy link
Contributor

@MaxSem MaxSem commented Jul 31, 2021

--PLATFORM--
bits: 64
os: !Windows

vs.

--SKIPIF--
<?php
if (PHP_INT_SIZE != 64) die('skip This test is 64bit only');
if (stripos('WIN', PHP_OS) === 0) die('skip This test cannot run on Windows');
?>

This is part of overall work on test speedup by reducing the
number of SKIPIF checks. Additional benefits are the tests getting
more readable and replacing code with metadata.

This change migrates Zend tests to the new system, the rest will be
fixed in subsequent patches.

@Girgias
Copy link
Member

Girgias commented Jul 31, 2021

This is currently borked:

SKIP Test open_basedir configuration [tests/security/open_basedir_realpath.phpt] reason: only run on Windows
ERROR: Worker 2 reported unexpected E_WARNING: Undefined array key "php.Zend.tests" in /home/vsts/work/1/s/run-tests.php on line 3554

Could you also provide a patch to https://github.com/php/web-qa/blob/master/write-test.php adding the PLATFORM section?

@MaxSem MaxSem force-pushed the platform branch 2 times, most recently from 9e1ceb1 to de20a8e Compare July 31, 2021 20:14
--PLATFORM--
bits: 64
os: !Windows

vs.

--SKIPIF--
<?php
if (PHP_INT_SIZE != 64) die('skip This test is 64bit only');
if (stripos('WIN', PHP_OS) === 0) die('skip This test cannot run on Windows');
?>

This is part of overall work on test speedup by reducing the
number of SKIPIF checks. Additional benefits are the tests getting
more readable and replacing code with metadata.

This change migrates Zend tests to the new system, the rest will be
fixed in subsequent patches.
@MaxSem
Copy link
Contributor Author

MaxSem commented Aug 1, 2021

This is currently borked:
[...]

Fixed.

Could you also provide a patch to https://github.com/php/web-qa/blob/master/write-test.php adding the PLATFORM section?

Sure, as soon as we're sure that the behavior of this one will not change. Note that even my previous QA docs patch is still unmerged.

@nikic
Copy link
Member

nikic commented Aug 2, 2021

I'm not convinced that this makes sense. This is inventing a new domain specific language for something that SKIPIF checks already express in a general and easy way. --EXTENSIONS-- was valuable primarily because it allows us not to load unnecessary shared objects, which is slow on Windows. This approach also isn't going to cover more involved cases like database extension skipifs, which are probably the ones that would benefit most from not running repeatedly.

@krakjoe
Copy link
Member

krakjoe commented Aug 2, 2021

I agree with Nikita. We're never going to be able to do away with SKIPIF without extending the DSL you have created here beyond reasonable, it would have to be capable of expressing so much that it would actually only serve to complicate things, be another thing to learn and not really provide any value.

@krakjoe krakjoe closed this Aug 2, 2021
@MaxSem
Copy link
Contributor Author

MaxSem commented Aug 2, 2021

The point was not to eliminate the skipifs, but to reduce their number to reduce their influence on performance. But oh well, you da maintainerz, you decide😁

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