123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- [IMPORTANT NOTICE]
- ------------------
- Failed tests usually indicate a problem with your local system setup
- and not within PHP itself (at least for official PHP release versions).
- You may decide to automatically submit a test summary to our QA workflow
- at the end of a test run.
- Please do *not* submit a failed test as a bug or ask for help on why
- it failed on your system without providing substantial backup information
- on *why* the test failed on your special setup. Thank you :-)
- [Testing Basics]
- ----------------
- The easiest way to test your PHP build is to run "make test" from the
- command line after successfully compiling. This will run the complete
- tests for all enabled functionalities and extensions using the PHP
- CLI binary.
- To execute test scripts, you must build PHP with some SAPI, then you
- type "make test" to execute all or some test scripts saved under
- "tests" directory under source root directory.
- Usage:
- make test
- "make test" basically executes "run-tests.php" script
- under the source root (parallel builds will not work). Therefore you
- can execute the script as follows:
- TEST_PHP_EXECUTABLE=sapi/cli/php \
- sapi/cli/php [-c /path/to/php.ini] run-tests.php [ext/foo/tests/GLOB]
- [Which "php" executable "make test" look for]
- ---------------------------------------------
- If you are running the run-tests.php script from the command line (as above)
- you must set the TEST_PHP_EXECUTABLE environment variable to explicitly
- select the PHP executable that is to be tested, that is, used to run the test scripts.
- If you run the tests using make test, the PHP CLI and CGI executables are
- automatically set for you. "make test" executes "run-tests.php" script with the CLI binary. Some
- test scripts such as session must be executed by CGI SAPI. Therefore,
- you must build PHP with CGI SAPI to perform all tests.
- NOTE: PHP binary executing "run-tests.php" and php binary used for
- executing test scripts may differ. If you use different PHP binary for
- executing "run-tests.php" script, you may get errors.
- [Which php.ini is used]
- -----------------------
- "make test" uses the same php.ini file as it would once installed.
- The tests have been written to be independent of that php.ini file,
- so if you find a test that is affected by a setting, please report
- this, so we can address the issue.
- [Which test scripts are executed]
- ---------------------------------
- "run-tests.php" ("make test"), without any arguments executes all
- test scripts by extracting all directories named "tests"
- from the source root and any subdirectories below. If there are files,
- which have a "phpt" extension, "run-tests.php" looks at the sections
- in these files, determines whether it should run it, by evaluating
- the 'SKIP' section. If the test is eligible for execution, the 'FILE'
- section is extracted into a ".php" file (with the same name besides
- the extension) and gets executed.
- When an argument is given or TESTS environment variable is set, the
- GLOB is expanded by the shell and any file with extension "*.phpt" is
- regarded as a test file.
- Tester can easily execute tests selectively with as follows.
- Examples:
- ./sapi/cli/php run-tests.php ext/mbstring
- $str = "XYZABCD";
- echo substr($str,3,7);
- ?>
|