Commit Graph

845 Commits

Author SHA1 Message Date
Nikita Popov
1a370d3321 Skip some tests under --preload
A genuine problem here is that we sometime get different class
casing due interaction with the ZSTR CE cache. Ignore these for
now.
2021-07-30 17:26:39 +02:00
Nikita Popov
6aa08736bb Don't unlink preload file if test failed 2021-07-27 14:36:38 +02:00
Nikita Popov
bf40a933cd Add --bless option to run-tests.php
This runs bless_tests.php on all failed tests.
2021-07-16 14:39:47 +02:00
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
Tyson Andre
0461c1574a Add run-tests.php --context [n] option.
Mentioned in https://github.com/php/php-src/pull/5965#discussion_r467621123

This PR proposes 3 lines of context so the impact can be seen in tests.
Other `diff` programs show around 3 lines of context.
(This helps indicate exactly which position a test should be updated
to add a new expected line at)

Use the mapping for choosing order to display diffs

Properly include context in cases where the expected output had more lines than
the actual output, e.g.

```
--FILE--
A
A1
A
C
NEARBY
--EXPECTF--
A
B
A1
B
A
B
A
B
NEARBY
```

Closes GH-5968
2020-08-16 09:31:38 -04:00
Tyson Andre
7be61bec80 Colorize --show-diff, only on stdout
Don't add colors to the saved `.diff` file.

Related to a41cf3e1d2
2020-08-13 11:27:32 -04:00
Tyson Andre
45d69fb809 Support NO_COLOR environment variable in run-tests.php
And add a --color option for run-tests.php

See https://no-color.org/

> an informal standard is hereby proposed:
>
> All command-line software which outputs text with ANSI color added should check
> for the presence of a `NO_COLOR` environment variable that, when present
> (regardless of its value), prevents the addition of ANSI color.
2020-08-12 09:37:45 -04:00
Nikita Popov
a41cf3e1d2 Revert "Make diff section contents red(-)/green(+) in run-tests.php"
This reverts commit 58489bd3b9.

This also uses ANSI escape code coloring for .diff files, where it
is not meaningful.
2020-08-10 09:38:48 +02:00
Tyson Andre
58489bd3b9 Make diff section contents red(-)/green(+) in run-tests.php
This uses green for lines with `+` and red for lines with `-`.

Colors(Red and Green) would make the failure causes stand out visually when scrolling through errors.

Closes GH-5965
2020-08-09 20:59:43 -04:00
Tyson Andre
e79adf6381 Use short array values in run-tests.php
The run-tests.php file already requires php 7 syntax.
Done automatically with phpcbf with no other changes done/planned.

This file is already using short arrays in other places.

run-tests has already been substantially refactored in PHP 8.0
compared to PHP 7.4.

This makes merge conflicts more likely, but changes to run-tests.php on older
versions are less frequent bug fixes.
2020-08-09 16:09:55 -04:00
George Peter Banyard
5d72e40dfb Add colours to test results in run-tests.php
The test runner will attempt to colourise the result of each test

The --no-color option is introduced to disable this feature.

Closes GH-5901
2020-08-07 18:17:34 +02:00
George Peter Banyard
11274f53e7 Add type information to test-runner
Closes GH-5942
2020-08-06 20:37:36 +02:00
Tyson Andre
07db64156e [RFC] Make string length for getTraceAsString() configurable
Add a `zend.exception_string_param_max_len` ini setting.
(same suffix as `log_errors_max_len`)

Allow values between 0 and 1000000 bytes.
For example, with zend.exception_string_param_max_len=0,
"" would represent the empty string, and "..." would represent something
longer than the empty string.
Previously, this was hardcoded as exactly 15 bytes.

Discussion: https://externals.io/message/110717

Closes GH-5769
2020-07-25 09:50:57 -04:00
Dmitry Stogov
69b1f3d53d Use small counter values for testing 2020-07-08 16:49:51 +03:00
Paul Dragoonis
5d7ff25311 Removing HTML Functionality from run-tests.php
As discussed on GH-5632, the HTML functionality does not appear
to be in active use. For HTML rendering of test results, it is
suggested to instead use the JUnit integration, in combination
with your favorite JUnit viewer.

Closes GH-5705.
2020-06-19 09:59:38 +02:00
Nikita Popov
c260613c6f Optimize parallel test runner startup
Don't connect to each worker individually: First spawn all processes
and then establish connections in any order.

This avoids a ~1s wait when running on many cores.
2020-06-16 11:39:03 +02:00
Gerard Roche
d1dde094f2 run-tests: refactor 2020-05-22 09:58:04 +02:00
Gerard Roche
2ef88f517d run-tests: echo message and exit if no tests found
The test runner currently defaults to running the entire test suite if
no selected tests can be found. This can be unexpected.

For example the ext/mysqlnd/ directory has no tests, if you specify that
directory when testing the entire test suite will be run.

    run-tests.php [options] ext/mysqlnd/

Closes GH-5605.
2020-05-22 09:37:46 +02:00
Nikita Popov
0374cf08c7 Add --file-cache-prime/use options to run-tests
--file-cache-prime populates the file cache,
--file-cache-use uses the file cache.

And fix a number of tests to run under file cache or disabled
timestamp validation.
2020-05-20 15:29:32 +02:00
Nikita Popov
ec1e8540d8 Slightly deduplicate run-tests code 2020-05-20 11:58:42 +02:00
Derick Rethans
3707d75f4b Merge branch 'PHP-7.4' 2020-05-18 13:51:47 +01:00
Derick Rethans
d2797505cd Put Xdebug 3 into 'off' mode for run-tests.php 2020-05-18 13:51:40 +01:00
Derick Rethans
74a4a5ae55 Put Xdebug 3 into 'off' mode for run-tests.php 2020-05-18 13:49:12 +01:00
Gerard Roche
ecc0a87ff2 run-tests: extract usage message
Put the usage message near the top of the script,
into a separate function.

Closes GH-5558.
2020-05-13 09:54:55 +02:00
Gerard Roche
10edee7f03 run-tests: cs fixes (cleanup)
I used php-cs-fixer to do the cs fixes. The configuration I used is
posted below. The reason I disabled some of the rules is because they
create too much noise and would make it difficult to review. But please
feel free to close this PR and run the php-cs-fixer yourself.

    <?php

    $config = PhpCsFixer\Config::create();
    $config->setRiskyAllowed(false);
    $config->setRules([
        '@PSR2' => true,
        '@Symfony' => true,
        'array_syntax' => false,
        'binary_operator_spaces' => false,
        'blank_line_before_statement' => false,
        'concat_space' => false,
        'increment_style' => false,
        'phpdoc_align' => false,
        'single_quote' => false,
        'trailing_comma_in_multiline_array' => false,
        'unary_operator_spaces' => false,
        'yoda_style' => false,
    ]);

    $finder = PhpCsFixer\Finder::create();
    $finder->in(getcwd());

    $finder->exclude('Zend');
    $finder->exclude('build');
    $finder->exclude('ext');
    $finder->exclude('pear');
    $finder->exclude('sapi');
    $finder->exclude('scripts');
    $finder->exclude('win32');

    $config->setFinder($finder);

    return $config;

Closes GH-5557.
2020-05-13 09:52:44 +02:00
Gerard Roche
16f23cd159 run-tests: remove use of FILE_BINARY constant
The FILE_BINARY (and FILE_TEXT) constants are not really valid or useful
constants. It looks like they were added in 5.2.7 and have "no effect,
and are only available for forward compatibility."

See: https://www.php.net/manual/en/filesystem.constants.php

The default value of the file_put_contents() flags parameter is 0 and
FILE_BINARY is set to 0, so removing it doesn't change functionality.

P.S. Maybe those constants should be deprecated or removed in 8.0.

Closes GH-5556.
2020-05-12 16:59:25 +02:00
Christoph M. Becker
8cb237345a Revert "Show eventual output of clean sections"
This reverts commit 5eb4ab07f2.
The temporary hack has served its purpose.
2020-04-30 09:51:10 +02:00
Christoph M. Becker
daaaf2b4ff Merge branch 'PHP-7.4'
* PHP-7.4:
  Pass worker ID to clean scripts
2020-04-29 13:33:32 +02:00
Christoph M. Becker
9a98569efe Pass worker ID to clean scripts
On Windows, reusing/sharing of OPcache instances with different
configuration is not necessarily supported, so we have to make that it
does not happen for the clean scripts, by using `$orig_ini_settings`
instead of `$clean_params`.
2020-04-29 13:30:28 +02:00
Christoph M. Becker
5eb4ab07f2 Show eventual output of clean sections
This is a hack to investigate why mysqli_insert_packet_overflow.phpt
intermittently fails on AppVeyor, and will be reverted in due time.
See <https://github.com/php/php-src/pull/5447#issuecomment-620508790>.
2020-04-28 16:08:17 +02:00
Flávio Heleno
1baa58317f Fixed run-tests.php for PHP 7.2
Flexible heredoc syntax is only available since PHP 7.3.

Closes GH-5444.
2020-04-27 11:55:40 +02:00
Benjamin Eberlei
ec88bbc4c6 Enhance test failure SH script to allow gdb, valgrind, rr as alternative modes. 2020-04-18 16:14:00 +02:00
Nikita Popov
fd5dc55759 Force short_open_tag=0 in run-tests.php
Make sure we don't accidentially add tests depending on short tags.
2020-04-15 11:27:03 +02:00
Nikita Popov
a939805641 Use serialize_precision for var_dump()
var_dump() is debugging functionality, so it should print
floating-point numbers accurately. We do this by switching
to serialize_precision, which (by default) will print with
as much precision as necessary to preserve the exact value
of the float.

This also affects debug_zval_dump().

Closes GH-5172.
2020-02-25 09:51:32 +01:00
Christoph M. Becker
7d6384d1f7 Merge branch 'PHP-7.4'
* PHP-7.4:
  Create a new console for each test worker on Windows
2020-02-17 18:54:32 +01:00
Christoph M. Becker
e1de11d467 Create a new console for each test worker on Windows
The primary motivation to have each test worker running its own console
is to allow the windows_mb_path tests to run in parallel.  A nice side
effect is that this also prevents changing the code page of the
tester's console window (which can even cause its font to be changed).

To be able to do so, we introduce the `create_new_console` option for
`proc_open()`, which might occasionally be useful for other purposes
than testing.
2020-02-17 18:52:45 +01:00
Nikita Popov
169805777c Merge branch 'PHP-7.4'
* PHP-7.4:
  Apply tidy formatting
2020-02-03 13:42:08 +01:00
Nikita Popov
58b17906f5 Apply tidy formatting
Mostly reindent PHP scripts to spaces.
2020-02-03 13:41:31 +01:00
Nikita Popov
98a8ab1389 Merge branch 'PHP-7.4'
* PHP-7.4:
  Add WHITESPACE_SENSITIVE run-tests section
2020-02-03 10:08:20 +01:00
Nikita Popov
27fb0b28dd Add WHITESPACE_SENSITIVE run-tests section
This is used to indicate that the test should not be changed by
automated formatting changes.
2020-02-03 10:08:15 +01:00
Nikita Popov
1d0247db7d Merge branch 'PHP-7.4'
* PHP-7.4:
  Don't use CRLF when generating diffs
2020-01-24 12:28:54 +01:00
Nikita Popov
c6cf354a9a Don't use CRLF when generating diffs 2020-01-24 12:28:37 +01:00
Tyson Andre
0c696577eb Use smaller batch size in run-tests.php when appropriate
- When valgrind is used, communication overhead is relatively small,
  so just use a batch size of 1.
- If this is running a small enough number of tests,
  reduce the batch size to give batches to more workers.
  (Previously, if there were 90 tests and -j8,
  only 3 of 8 workers would get a batch of size 32 or less.
  After this change, the batch size is 12 or less)

Closes GH-5098
2020-01-21 20:07:08 -05:00
Tyson Andre
549f55fc3f Don't start unnecessary processes with run-tests.php -j
If there's only 2 files to test, then only start 2 workers instead of N.

If there's only 1 file, then avoid parallelism entirely.
A separate option such as `--force-parallel` could be added
if this turns out to be something developers would want to do
when debugging test failures.
2020-01-21 20:05:06 -05:00
Nikita Popov
85ea04b747 Merge branch 'PHP-7.4'
* PHP-7.4:
  Avoid some @count() suppressions in run-tests.php
2020-01-21 18:50:14 +01:00
Nikita Popov
59b3ab827a Avoid some @count() suppressions in run-tests.php 2020-01-21 18:49:59 +01:00
Christoph M. Becker
718fc4cefd Use IS_WINDOWS 2020-01-09 12:04:28 +01:00
Christoph M. Becker
10c420f84a Replace fakemail with minimal PHP script 2020-01-09 12:04:28 +01:00
Christoph M. Becker
64633044c5 Unify mail related tests for *nix and Windows
Currently mail related tests are split for *nix and Windows (if there
are even Windows versions).  The basic difference is that the *nix
variants set the INI directive sendmail_path to just write the email to
disk, while the Windows tests use ext/imap.  The latter tests are way
more verbose, and such duplicated tests are generally a pain point.
Furthermore, the Windows tests are much slower, and could not be run
without ext/imap being available.

We therefore introduce a small fakemail application, which basically
works like `tee <path> >/dev/null`, and which will be shipped with the
Windows tests packs.  fakemail.exe would also need to be added to the
PHP binary SDK, so these tests could be run during developments.

To cater to the remaining differences, we also introduce support for
`{MAIL:<path>}` placeholders in the INI sections to run-tests.php.  How
to use this can be seen in mail_basic.phpt, which is currently the only
modified test case, because these tests are yet supposed to fail on
Windows, due to the missing fakemail.exe in the PHP SDK.
2020-01-09 12:04:28 +01:00
Nikita Popov
725c2a999d Merge branch 'PHP-7.4'
* PHP-7.4:
  Set zend.exception_ignore_args=0 in run-tests.php
2019-12-10 16:16:03 +01:00
Nikita Popov
e87dc32569 Set zend.exception_ignore_args=0 in run-tests.php
Any existing tests are going to be written under this assumption...
2019-12-10 16:15:26 +01:00
Fabien Villepinte
4d529757f8 Merge branch 'PHP-7.4' 2019-11-08 20:36:55 +01:00
Fabien Villepinte
9c4b989c75 Make test runner runnable without arguments
The default PHP executable was not set when no args were provided.

Closes GH-4894.
2019-11-08 20:33:19 +01:00
Fabien Villepinte
26579db403 Define IS_WINDOWS in the test runner
Avoid code duplication

Closes GH-4866.
2019-10-28 13:14:50 +01:00
Nikita Popov
c1da10b77b Set display_startup_errors=0 when running skipif
Now that we're displaying errors in skipif, suppress this particular
category. Otherwise we get warnings in the SKIPIF of tests with
EXTENSION where the extension does not exist, and there's no way
to suppress them.
2019-10-10 10:43:21 +02:00
Christoph M. Becker
e54d2efdda Merge branch 'PHP-7.4'
* PHP-7.4:
  Bail out if JUNIT is not enabled
2019-10-07 13:22:47 +02:00
Christoph M. Becker
8cdab9b217 Bail out if JUNIT is not enabled
Otherwise we would try to access an array element of `false`, which
issues a notice as of PHP 7.4.0.  This would happen, for instance, for
bug63447_001.phpt if CGI is not available.
2019-10-07 13:22:11 +02:00
Christoph M. Becker
d37454d9f0 Merge branch 'PHP-7.4'
* PHP-7.4:
  Delete temporary .post files of run-tests.php
2019-10-07 12:18:27 +02:00
Christoph M. Becker
53077217e2 Delete temporary .post files of run-tests.php
Commit 5649267[1] changed run-tests.php to only delete .post files for
passing tests.  However, that code wouldn't be exercised at all, since
`run_test()` already returned, so we move the deletion upwards.

[1]
<http://git.php.net/?p=php-src.git;a=commit;h=5649267b257c78e46a934434c0bff894e0b5b694>
2019-10-07 12:17:41 +02:00
Nikita Popov
7d90f4864d Require a space ofter run-tests "warn"
We don't want to treat a PHP "Warning: " as a run-tests warn.
2019-10-01 17:36:42 +02:00
Fabien Villepinte
e49593a7c3 Mark test as borked when skipif produces invalid output
SKIPIF section should either output nothing, or start with a
supported keyword like "skip". Mark all tests that don't do so as
BORKED.
2019-09-30 17:52:43 +02:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Nikita Popov
279f745a60 Fix reporting of redirect test failures in junit
These were being reported under the wrong name ... which means that
they don't show up as failures on azure :(
2019-09-07 22:47:50 +02:00
Christoph M. Becker
790b0b109a Fix handling of succeeding XFAIL tests
Due to a typo in commit e1151c9[1], succeeding XFAIL test without an
EXPECTF or EXPECTREGEX section have been reported reported as passed
instead of warned.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=e1151c9549cf5a7235c1609019f79bbb1bbcdbea>
2019-08-05 11:38:47 +02:00
Levi Morrison
d758691b9b Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Remove .post files only for passing tests
2019-07-25 09:50:47 -06:00
Levi Morrison
c624a7fe43 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Remove .post files only for passing tests
2019-07-25 09:49:18 -06:00
Levi Morrison
5649267b25 Remove .post files only for passing tests
This allows the sh script for failing tests with --POST-- to work
2019-07-25 09:48:39 -06:00
George Peter Banyard
6d6d954d0d Cleanup of remaining E_STRICT in tests 2019-07-23 11:27:23 +02:00
Peter Kokot
b1643e166d Fix failed tests for phar
- when $status is boolean, E_NOTICE appears and tests fail
- opcache is never enabled on these tests anyway.
- Add opcache.revalidate_freq=0 to testing script

  Instead of checking this in the tests files it can be used directly in
  the main testing script. Also this fixes failed tests.

- Use opcache_invalidate() instead of sleep() delay in some tests. Some
  delays are still used since the opcache_invalidate seems to be buggy
  and not working as expected.

Closes GH-4392
2019-07-21 00:49:35 +02:00
rjhdby
d574df63dc Deprecate alternative array access syntax
RFC: https://wiki.php.net/rfc/deprecate_curly_braces_array_access
2019-07-19 10:06:10 +02:00
Christoph M. Becker
55d34f7023 Remove remaining lightnings from run-tests.php
The classic Windows console only supports the Unicode BMP, so it can't
handle the LIGHTNING MOOD character (U+1F5F2).  It also seems that
common fonts do not support the LIGHTNING (U+2607) character, so a
general removal is appropriate.

However, Windows is already "ready for the future"[1], but PHP for
Windows is not (yet).

[1] <https://devblogs.microsoft.com/commandline/windows-command-line-unicode-and-utf-8-output-text-buffer/>
2019-07-18 12:15:25 +02:00
Nikita Popov
562591f5eb Remove lightning
Windows is not quite ready for the future.
2019-07-18 11:16:24 +02:00
Christoph M. Becker
e2ed7e6716 Allow multiple cache instances per user/host on Windows
Formerly, there was at most a single OPcache instance per user and the
so called system ID (which is determined from the PHP version).
Sometimes multiple OPcaches might be desired, though, particularly for
unrelated CLI scripts, which may even be necessary (e.g. for our test
suite in parallel mode).

We therefore introduce a new INI directive `opcache.cache_id` which
allows to configure independent OPcache instances for the same user.

We also use `GetUserNameW()` instead of `php_win32_get_username()`,
because the latter retrieves the user name encoded in the
`default_charset`, which can obviously yield different results for
different charsets, leading to OPcache "incompatibilities".  Slightly
worse, some characters may not even be encodeable in the
`default_charset` and would be replaced by question marks, which could
result in different users sharing the same OPcache.

We also refactor, and re-use existing APIs to avoid duplicated code.
2019-07-17 19:51:07 +02:00
Peter Kokot
f5e4771824 Remove checks for always enabled spl and pcre
Closes GH-4397
2019-07-13 14:47:37 +02:00
Nikita Popov
c02dfddda3 Include test name in JUnit testcase name
Azure does not show the classname attribute in any convenient way,
and the file name is the part we usually care about.
2019-07-11 12:46:56 +02:00
Nikita Popov
3fa9f9cfae Add CONFLICTS to recognized sections
It does nothing on 7.3, but this makes it easier to write tests in
3rd party extensions.
2019-07-10 13:09:06 +02:00
Nikita Popov
54dd762f59 Set up asan+ubsan scheduled build on azure
Also adds an --asan flag to run-tests.php to setup all the necessary
environment variables. Some tests are marked as skipped because they
are incompatible with asan or too slow.

I'm basing this on the DEBUG_ZTS build, which seems to give us the
most mileage.
2019-06-28 15:00:54 +02:00
Nikita Popov
b195412bf3 run-tests: Don't pass --INI-- settings to --SKIPIF--
If we're testing ini settings that cause startup failures, we'll
never get to that SKIPIF block...

Also change settings2param to return a value instead of modifying
(to a different type no less!) in place.
2019-06-28 09:17:09 +02:00
Nikita Popov
74a7d00846 run-tests: Don't die unnecessarily
die/exit leak memory, don't use them if we don't need to.
2019-06-25 14:28:58 +02:00
Nikita Popov
3a36e68c49 Don't force USE_ZEND_ALLOC=0 in run-tests.php
USE_ZEND_ALLOC=0 is useful not just for valgrind ... we should not
force USE_ZEND_ALLOC=1 if the user explicitly disabled it.
2019-06-25 10:25:44 +02:00
Nikita Popov
da275e6214 Merge branch 'PHP-7.3' into PHP-7.4 2019-06-13 12:41:01 +02:00
Nikita Popov
ee137a7033 Merge branch 'PHP-7.2' into PHP-7.3 2019-06-13 12:38:57 +02:00
Nikita Popov
f8a68fd935 Add test for bug #78106
Also add PHP_TEST_EXTRA_ARGS environment variable, which allows
to pass on -c, -d etc flags provided by run-tests.php. Otherwise
we won't get the built-in server to run with opcache.
2019-06-13 12:35:29 +02:00
Joe Watkins
bed8ae1d0f
junit testcase classname is used as filename on azure 2019-06-05 19:27:50 +02:00
Joe Watkins
22213de179
only clear when showing in parallel runner 2019-06-01 06:13:30 +02:00
Nikita Popov
4ef7f70987 Fix NO_INTERACTION handling in parallel test runner
This printing shouldn't depend on NO_INTERACTION, the variable that
controls this is SHOW_ONLY_GROUPS.
2019-05-31 14:03:22 +02:00
Nikita Popov
dd2bf44869 Add junit support for parallel test runner 2019-05-31 12:38:06 +02:00
Nikita Popov
137747bdaf run-tests: Remove redundant 'suites' key
We don't have nestead testsuites or similar, so drop this confusing
key.
2019-05-31 12:04:23 +02:00
Joe Watkins
a3879208c5
have parallel test runner respect NO_INTERACTION 2019-05-30 07:46:31 +02:00
Nikita Popov
24e22eb31b Run sapi tests when running all tests 2019-05-29 17:07:12 +02:00
Craig Duncan
72c330f1e6 Restore the execute bit for run-tests.php
It looks like this was accidentally removed in 03f15f705a
2019-05-28 21:51:26 +01:00
Joe Watkins
979e7d0fee
fix notice in run-tests 2019-05-23 13:09:18 +02:00
Joe Watkins
e1151c9549
run-tests improvements:
Add XLEAK section, this is made necessary by the support
  for valgrind tools other than memcheck.
  XLEAK is to a leaking test what XFAIL is to a failing test.
  Tidy up summary a little to exclude Expected Fail and Expected Leak
  when there are no expected fail/leaks
2019-05-23 10:55:25 +02:00
Joe Watkins
536532c572
add support for valgrind tools to run-tests.php 2019-05-22 20:20:13 +02:00
Christoph M. Becker
ec10e191c4 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add {TMP} placeholder for PHPT INI sections
2019-05-08 19:26:02 +02:00
Christoph M. Becker
236522529c Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Add {TMP} placeholder for PHPT INI sections
2019-05-08 19:22:21 +02:00
Christoph M. Becker
3d0a0f801b Add {TMP} placeholder for PHPT INI sections
Several tests use `/tmp` in the `--INI--` section, but this is not
portable.  We therefore introduce the `{TMP}` placeholder which
evaluates to the system's temporary directory using
`sys_get_temp_dir()`.

We also remove the doubtful `strpos()` optimization.
2019-05-08 19:21:38 +02:00
Peter Kokot
434388a610 Add minimum required PHP version to run-tests.php
This integrates a simple minimum PHP version info in the tool and to
also define the minimum version that the tool syntax should support.
2019-03-26 22:31:01 +01:00
Nikita Popov
071ffa2e79 Don't use parallel testing with -j1 2019-03-25 14:15:26 +01:00
Nikita Popov
3c61972451 Drop lightning for concurrent worker count
This looked rather awkward even on terminals that have full unicode
support.
2019-03-25 14:13:10 +01:00
Tyson Andre
936356bf1e Make run-tests.php compatible with php 7.0-7.2
Motivation:
As an extension author, I want to speed up running tests in php <=7.3,
both locally and in CI (e.g. with valgrind).
This can be done by manually copying php 7.4's run-tests.php script
to replace the one generated by `phpize`

- list() doesn't work in php 7.0
- negative string offset doesn't work in php 7.2

If run-tests.php can be copied from php-src without any manual patches,
that would be the easiest.

Related to #2822 - I didn't see any discussion for/against compatibility
with older php versions
2019-03-25 13:58:22 +01:00