Commit Graph

742 Commits

Author SHA1 Message Date
Nikita Popov
748568268a Make LDAPCONF test work on windows
Rather than using putenv(), use the ENV section. This also
required adding {PWD} support for it.
2021-06-14 10:40:18 +02:00
Nikita Popov
ea126c5204 Fix EXTENSIONS for cgi tests
The extension information needs to be fetched using the cli binary,
not the cgi binary.
2021-06-11 14:42:58 +02:00
Bob Weinand
0dbbf9ec47 Merge branch 'PHP-8.0' 2021-06-04 16:29:40 +02:00
Bob Weinand
c916613f13 Fix null handling in test runner when printing env 2021-06-04 16:29:14 +02:00
Bob Weinand
13d396bb59 Merge branch 'PHP-8.0' 2021-05-31 10:48:11 +02:00
Bob Weinand
76a4ea5e2a Export ENV in .sh file generated by run-tests 2021-05-31 10:47:14 +02:00
Nikita Popov
ea256a218b Add %0 format to run-tests.php
This format matches against null bytes, and prevents the test
expectation from being interpreted as binary data.

bless_tests.php will automatically replace \0 with %0 as well.
2021-05-29 11:33:13 +02:00
Christoph M. Becker
6f89da78d0
Adjust run-tests.php to dynamic extension loading
PR #6787 changed the behavior of the `--EXTENSIONS--` section, so that
not yet loaded extensions are dynamically loaded if possible.  However,
when no tests are specified for the runner, only tests for already
loaded extensions are run, what defeats the purpose of the improvement
of the `--EXTENSIONS--` behavior.  We cater to that by detecting
loadable extensions, and also run their tests.
2021-05-27 11:33:36 +02:00
Nikita Popov
b8e4d9f387 Use shell-free proc_open() in parallel run-tests.php 2021-05-19 20:46:50 +02:00
Michael Voříšek
3ccc0409ce Remove no longer used "log_errors_max_len" ini directive (#6838)
This is a re-application of the original match against master.
The patch was originally applied to master, then reverted from
there, incorrectly applied to PHP-8.0, reverted from there due
to ABI break, and now lands on master again. We can only hope
that it does not get reverted again ;)
2021-05-10 19:26:33 +02:00
Nikita Popov
090627048c Revert "Remove no longer used "log_errors_max_len" ini directive (#6838)"
This reverts commit d2d227e547.

This is an ABI break.
2021-05-08 20:54:53 +02:00
Ben Ramsey
b5d5d06ff3
Revert "Remove no longer used "log_errors_max_len" ini directive (#6838)"
This reverts commit cc2c810dcf.
2021-05-08 13:23:58 -05:00
Michael Voříšek
d2d227e547
Remove no longer used "log_errors_max_len" ini directive (#6838) 2021-05-08 13:05:13 -05:00
Michael Voříšek
cc2c810dcf
Remove no longer used "log_errors_max_len" ini directive (#6838) 2021-05-07 19:07:35 -05:00
Mark Gallagher
39876ba1c6 run-tests: Fix warning when specifying xdebug as a required extension 2021-04-25 22:07:00 +02:00
Max Semenik
bd9f4fa676 Migrate skip checks to --EXTENSIONS--, p2
For rationale, see https://github.com/php/php-src/pull/6787

Make extension checks lowercase, add a special case for opcache
that has internal name not matching .so filename.

Extensions migrated in part 2:
* dom
* exif
* fileinfo
* ffi
2021-04-01 12:08:24 +01:00
Nuno Maduro
e44f610443 Removes 'Parallel Edition' output in tests
Closes GH-6806.
2021-03-29 00:49:40 +02:00
Max Semenik
6c9a05667b run-tests: use the EXTENSIONS section for skipping
Currently, most skip checks are just for making sure an extension is
available. Even with recent addition of skip caching, this makes tests
needlessly slow:
* Checks for the same extension in its tests can have small differences
  impacting cacheability.
* Even identical skip checks in two tests can still be executed twice if
  they're run by different workers.

To remedy this, I'm repurposing the existing --EXTENSIONS-- section of
.phpt files to specify wjich extensions are required for current test to
run. Current behavior:
1) If the extension is already visible to PHP, all is good
2) If it isn't, assume it's present as a shared module and attempt to add
   it via a command line parameter
3) If that works, all is good
4) If it doesn't, PHP fails with a cryptic error message trying to
   execute the test itself

After this commit:
1) and 2) are kept unchanged
3) Check if shared extension file from 2) is actually present
4) Skip the test if it isn't

Other benefits include clear skip reasons (vs. sometimes none in many
current skip checks) and moving test information from code to metadata,
opening more opportunities for search and analysis.

Since --EXTENSIONS-- is barely ever used, this change poses no risk of
hidden failures.

As a demonstration of the new approach, this commit migrates one
extension to it. If merged, I will migrate other extensions in
subsequent PRs.

Closes GH-6787.
2021-03-22 09:53:38 +01:00
Max Semenik
9140c9038a run-tests.php: class for test file loading
This moves a bunch of code outside of run_tests(), making it a bit
more manageable. Additionally, accessors provide better readability
than isset() and friends.

This is a minimal patch that moves the code but does not refactor
much. For the sake of reviewing experience, it does not involve
further refactoring which could include:
* Removing setSection()
* Fixing up the mess with hasSection() vs. sectionNotEmpty(), only
  one of which is really needed.
* Moving more repetitive code into the new class.
All of this will be done with later commits.

Closes GH-6678.
2021-03-16 11:51:55 +01:00
Nikita Popov
0074a1d4e3 Make the nocache tag actually work
If nocache is used, then we should return an empty string result,
so the test doesn't get marked as borked.

Also limit to an occurrence at the start, just like other skip
tags.
2021-03-04 16:34:10 +01:00
Nikita Popov
4d43cbe333 Add mechanism to skip the skipif cache
If the SKIPIF section return nocache, don't cache the result. This
is used by tests that perform complex test set in conjunction with
skip checks, and need to be evaluated every time.
2021-03-04 16:28:11 +01:00
Nikita Popov
b853201a6d run-tests.php: Preserve .php on leak in one more place 2021-03-04 16:09:29 +01:00
Max Semenik
bdd7c48764 run-tests: drop support for ancient Valgrind versions
Valgrind 3.3.0 was released in 2007, not even RHEL has crap older than
this. It could be argued that 3.8.0, released in 2012, could be a safe
cutoff too.

Closes GH-6728.
2021-03-01 11:21:30 +01:00
Christoph M. Becker
51914610ab Merge branch 'PHP-8.0'
* PHP-8.0:
  Capture Microsoft-defined HRESULT exit codes exit codes
2021-02-25 12:05:27 +01:00
Christoph M. Becker
fb683030bf Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Capture Microsoft-defined HRESULT exit codes exit codes
2021-02-25 12:03:43 +01:00
Dylan K. Taylor
a480bf8093 Capture Microsoft-defined HRESULT exit codes exit codes
The lack of such a check leads to false-passes of tests on Windows
which expect no output, but produce a segfault or similar issue. I
discovered this a while ago due to bad tests in an extension I maintain.

Closes GH-6722.
2021-02-25 12:01:04 +01:00
Max Semenik
dda0cea5cd run-tests: add skip cache
Currently every --SKIPIF-- section in every test file results in 1
extra execution of PHP, every --EXTENSIONS-- section - in 2 executions.
This is quite wasteful, as skip checking code is extremely repetitive
and extensions are fixed for every binary/ini/command parameters
combination.

This patch adds caching to all such checks.

On my machine, the gains are quite noticeable: 36s instead of 43s
with -j16, 292s instead of 337s without concurrency. Cache stats are
3780 hits, 1247 misses in the latter case. In the future, tests could
be adjusted to have more uniform skip checks to improve performance even
more.

Closes GH-6681.
2021-02-23 15:05:49 +01:00
Christoph M. Becker
b84e3b1ced Merge branch 'PHP-8.0'
* PHP-8.0:
  run-tests: fixed exit code not being set on BORKED tests
2021-02-23 13:23:22 +01:00
Christoph M. Becker
8162c3d1fd Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  run-tests: fixed exit code not being set on BORKED tests
2021-02-23 13:22:50 +01:00
Christoph M. Becker
67bb06cc9b Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  run-tests: fixed exit code not being set on BORKED tests
2021-02-23 13:15:30 +01:00
Dylan K. Taylor
729cd8bacd run-tests: fixed exit code not being set on BORKED tests
When no test paths are specified this shows up when 'make test' is used on a PECL extension without specifying tests to run (or in php-src too, I guess...)

Closes GH-6717.
2021-02-23 12:50:03 +01:00
Nikita Popov
4ea90c15de Merge branch 'PHP-8.0'
* PHP-8.0:
  Color LEAK&FAIL like a failure
2021-02-17 16:40:33 +01:00
Nikita Popov
cbdd21a22d Color LEAK&FAIL like a failure 2021-02-17 16:40:19 +01:00
Max Semenik
b11771271e Remove stray mentions of mbstring.func_overload
This feature has been completely removed.

Closes GH-6688.
2021-02-15 09:47:28 +01:00
Nikita Popov
b10416a652 Deprecate passing null to non-nullable arg of internal function
This deprecates passing null to non-nullable scale arguments of
internal functions, with the eventual goal of making the behavior
consistent with userland functions, where null is never accepted
for non-nullable arguments.

This change is expected to cause quite a lot of fallout. In most
cases, calling code should be adjusted to avoid passing null. In
some cases, PHP should be adjusted to make some function arguments
nullable. I have already fixed a number of functions before landing
this, but feel free to file a bug if you encounter a function that
doesn't accept null, but probably should. (The rule of thumb for
this to be applicable is that the function must have special behavior
for 0 or "", which is distinct from the natural behavior of the
parameter.)

RFC: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg

Closes GH-6475.
2021-02-11 21:46:13 +01:00
Max Semenik
0d3ab673aa run-tests: fix JUnit counts
In 19680f886f, I forgot about my own TODO. At least, now I understand what
this line was about :P
2021-02-11 09:47:56 +01:00
Max Semenik
19680f886f run-tests.php: move JUnit stuff into a class
This is part one of my work that was announced at
https://externals.io/message/110391

Closes GH-6671.
2021-02-08 18:28:11 +01:00
twosee
23a7b0f323 Fix environment variable not work in run-tests.php
Closes GH-6657.
2021-02-01 17:27:19 +08:00
Nikita Popov
866e3e03de Create .php and .sh on valgrind failure 2021-02-01 10:10:09 +01:00
Nikita Popov
26e0d389bc Show slow SKIPIF sections as well 2020-12-21 22:55:49 +01:00
Nikita Popov
3b4fb2ebea Determine run-tests executables consistently 2020-12-01 12:36:25 +01:00
Nikita Popov
6fdc988592 Don't pass null to strlen() 2020-12-01 12:36:18 +01:00
Nikita Popov
48725d89aa Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #80437
2020-11-30 11:42:07 +01:00
Nikita Popov
15073d8e1d Fixed bug #80437
Only chmod if the file has been created.
2020-11-30 11:40:46 +01:00
Christoph M. Becker
c3885f2316 Add --repeat flag to usage info of run-tests.php
Closes GH-6429.
2020-11-15 16:41:46 +01:00
Nikita Popov
1b3b430f47 Add --repeat testing mode
This testing mode executes the test multiple times in the same
process (but in different requests). It is primarily intended to
catch tracing JIT bugs, but also catches state leaks across
requests.

Closes GH-6365.
2020-10-30 17:29:33 +01:00
bashkarev
f17b2a75a5 Don't set xdebug.default_enable in run-tests
This throws a deprecation warning in XDebug 3.

Closes GH-6324.
2020-10-26 13:10:26 +01:00
Nikita Popov
b2700811f3 Skip arginfo test under msan
Msan is missing interceptors for some functions that result in
false positives.
2020-10-15 10:40:23 +02:00
Nikita Popov
9623756ab7 Remove unused --temp-urlbase option from run-tests.php
This was part of the removed HTML functionality.
2020-09-23 12:34:59 +02:00
Berbe
bfeb2f6abc Fix: Gracefully handle empty user input in run-tests.php
Closes GH-6016.
2020-08-24 11:46:01 +02:00