Commit graph

32 commits

Author SHA1 Message Date
Ilija Tovilo
ecc3fc180f
Use PDEATHSIG to kill cli-server workers if parent exists
Closes GH-9476
2022-09-08 10:48:20 +02:00
George Peter Banyard
3bf4098eee
Refactor (again) CLI SAPI server_client struct to use zend_string* (#8605)
This time in a way which works under a RC Debug build.
2022-05-30 13:03:23 +01:00
Nikita Popov
82d407b7e0 Revert "Refactor CLI SAPI php_cli_server_client struct to use zend_string (#8522)"
This reverts commit 9b19d90432.

This has broken the ZEND_RC_DEBUG build.
2022-05-21 16:52:21 +02:00
George Peter Banyard
9b19d90432
Refactor CLI SAPI php_cli_server_client struct to use zend_string (#8522)
This is a stepping stone in converting more pairs of ``char*`` and ``size_t`` to ``zend_string*`` across the CLI SAPI.

Also amend the CLI SAPI test setup to output it's content when it crashes/errors so that one can debug ASAN/UBSAN/MSAN violations.

Drive-by MSAN fix.

Co-authored-by: Arnaud Le Blanc <arnaud.lb@gmail.com>
2022-05-15 21:11:13 +01:00
Nikita Popov
62503236d5 Make it easier to run CLI server tests standalone 2021-09-17 10:15:35 +02:00
Nikita Popov
6ab4e330ac Use ephemeral port in more server tests
Port the main php_cli_server.inc to use ephemeral ports, thus
allowing CLI server tests to be parallelized.

A complication here is that we also need to give each test a
separate doc root, to avoid index.php files writing over each
other.

Closes GH-6375.
2020-10-23 14:26:34 +02:00
Nikita Popov
b0d8f012f9 Merge branch 'PHP-7.4'
* PHP-7.4:
  Add php_cli_server_connect() helper
2020-04-08 17:11:50 +02:00
Nikita Popov
1327491224 Add php_cli_server_connect() helper
To encapsulate the repeated fsockopen() code.

This gives us a chance to control the timeout in one place:
Raise it to one second.
2020-04-08 17:10:20 +02:00
Nikita Popov
f8d795820e Reindent phpt files 2020-02-03 22:52:20 +01:00
Nikita Popov
17f7fb7605 Switch to using shell-less proc_open() in various server tests 2019-07-11 15:48:10 +02:00
Christoph M. Becker
94df6dc3fd Split test case
This test is failing on AppVeyor almost all of the time, so splitting
it seems appropriate.  This also allows us to rid php_cli_server_stop()
which was only used by this test case.
2019-06-24 14:08:11 +02:00
Joe Watkins
eda5d8afcf
refactor a little more to add some more useful error messages and raise the limits on waiting for slow machines 2019-06-19 11:41:24 +02:00
Joe Watkins
d6480fa231
Separate check for process creation and ability to accept connections 2019-06-19 11:09:26 +02:00
Peter Kokot
1ad08256f3 Sync leading and final newlines in source code files
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-14 12:56:38 +02:00
Anatol Belski
ee0ca6470d Fix cli server test fails after recent AppVeyor image update 2018-05-18 13:38:53 +02:00
Mitch Hagstrand
fd92b91188
Increase wait time for tests involving sockets to improve Travis relability
1. Increased sleep time from 25ms to 50ms
2. Added sleep to shutdown handlers
2017-01-13 06:45:04 +00:00
Mitch Hagstrand
2d51267c07 Makes the sapi web server and curl tests more reliable
1. Increased the time for the sapi/cli/tests/php_cli_server.inc to accept connections.
2. sapi/cli/tests/php_cli_server.inc has errors messages and a `stop` function.
3. bug67429.phpt uses the `stop` function to shutdown the webserver before starting a new one.
4. Removed ext/curl/tests/bug48203_multi-win32.phpt test now that ext/curl/tests/bug48203_multi.phpt
   runs on Windows also.
2016-12-27 21:52:05 +01:00
Adam Harvey
27ff425b78 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Handle NULL strings in sapi_cli_server_register_variable().
  Allow CLI server test scripts to specify the name of the router file.

Conflicts:
	sapi/cli/tests/php_cli_server.inc
2015-01-06 01:27:37 +00:00
Adam Harvey
0cc2810498 Allow CLI server test scripts to specify the name of the router file.
This is required to write tests that behave differently when an index.php isn't
present in the document root. (Such as the one I'm about to commit.)
2015-01-06 01:22:59 +00:00
Michael Wallner
4a9d7c1f00 add NEWS entry; add simple test 2013-08-06 22:51:58 +02:00
Xinchen Hui
36100060b3 Sleep a little bit more, in some slow machine (like gcov), it will take a little more time to setup server 2012-08-01 23:54:01 +08:00
Xinchen Hui
7b2ab56997 Fix test failed, the fsockopen will be refused immediately if the server is not set up. 2012-05-09 11:21:24 +08:00
Matt Ficken
87a011d372 Fix bug 61769 Random failure of php_cli_server*phpt tests 2012-05-06 18:05:02 +02:00
Xinchen Hui
e1931dd1ad Minor change, test using php mail address as account 2012-03-20 15:41:43 +08:00
Pierrick Charron
3bfd03b6b6 Don't load php.ini file to test the built-in web server 2011-11-18 06:15:25 +00:00
Xinchen Hui
f2c6e116d2 revert my previous change, tests hangs on windows 2011-11-17 02:32:21 +00:00
Xinchen Hui
347876158c improve the test, let it say about errors 2011-11-17 02:22:06 +00:00
Xinchen Hui
f42ea8557c MFH, fix test 2011-11-15 03:19:54 +00:00
Xinchen Hui
67ae60f4f5 Fix test, now can run on windows 2011-10-25 10:54:39 +00:00
Xinchen Hui
7c1e64e2a6 add tests for PATH_INFO
update php_cli_server.inc to support no router server
2011-10-23 13:57:25 +00:00
Shein Alexey
3c365dc3ef Refactored and speeded up php_cli_server tests, also get rid of test hanging on ubuntu:
1) Prepended starting the server with "exec" so proc_terminate can correctly close it (see also this note http://www.php.net/manual/en/function.proc-get-status.php#93382 for details)
2) Moved putting down the server to the shutdown function to make it independent from tests (fatal) errors
3) Moved php cli executable into the function to make tests more readable 
4) changed sleep(1) to usleep(50000) (50 ms) to make tests faster - this needs more testing and if timeout is too small should be increased
2011-09-20 14:53:46 +00:00
Xinchen Hui
00bab0493e Add tests for built-in webserver 2011-09-20 07:10:46 +00:00