diff options
-rw-r--r-- | CODING_STANDARDS | 2 | ||||
-rw-r--r-- | CONTRIBUTING.md | 3 | ||||
-rw-r--r-- | README.SUBMITTING_PATCH | 9 | ||||
-rw-r--r-- | README.TESTING | 181 | ||||
-rw-r--r-- | README.md | 7 | ||||
-rw-r--r-- | ext/exif/tests/exif005.phpt | 4 | ||||
-rw-r--r-- | ext/sodium/tests/installed.phpt | 3 | ||||
-rw-r--r-- | ext/standard/tests/strings/str_shuffle.phpt | 1 | ||||
-rw-r--r-- | ext/standard/tests/strings/strings001.phpt | 1 | ||||
-rw-r--r-- | ext/standard/tests/strings/strtr.phpt | 1 |
10 files changed, 13 insertions, 199 deletions
diff --git a/CODING_STANDARDS b/CODING_STANDARDS index 7e0131e9c8..4af03c6bc7 100644 --- a/CODING_STANDARDS +++ b/CODING_STANDARDS @@ -251,7 +251,7 @@ Testing ------- 1. Extensions should be well tested using *.phpt tests. Read about that - in README.TESTING. + at https://qa.php.net/write-test.php. Documentation and Folding Hooks ------------------------------- diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0b37fa499e..f71f72a1d1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -52,9 +52,6 @@ We love getting new tests! PHP is a huge project and improving code coverage is a huge win for every PHP user. [Our QA site includes a page detailing how to write test cases.](http://qa.php.net/write-test.php) -Please note that the section on submitting pull requests is outdated: in -addition to the process listed there, you can also -[submit pull requests](#pull-requests). ## Writing documentation diff --git a/README.SUBMITTING_PATCH b/README.SUBMITTING_PATCH index be14a97bc3..72725d689c 100644 --- a/README.SUBMITTING_PATCH +++ b/README.SUBMITTING_PATCH @@ -138,11 +138,10 @@ work on "master". Read CODING_STANDARDS before you start working. -After modifying the source see README.TESTING and -http://qa.php.net/write-test.php for how to test. Submitting test -scripts helps us to understand what functionality has changed. It is -important for the stability and maintainability of PHP that tests are -comprehensive. +After modifying the source see https://qa.php.net/write-test.php for +how to test. Submitting test scripts helps us to understand what +functionality has changed. It is important for the stability and +maintainability of PHP that tests are comprehensive. After testing is finished, create a patch file using the command: diff --git a/README.TESTING b/README.TESTING deleted file mode 100644 index 45f160f4c2..0000000000 --- a/README.TESTING +++ /dev/null @@ -1,181 +0,0 @@ -[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 'SKIPIF' 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/* -./sapi/cli/php run-tests.php ext/mbstring/020.phpt - - -[Test results] --------------- - Test results are printed to standard output. If there is a failed test, -the "run-tests.php" script saves the result, the expected result and the -code executed to the test script directory. For example, if -ext/myext/tests/myext.phpt fails to pass, the following files are created: - -ext/myext/tests/myext.php - actual test file executed -ext/myext/tests/myext.log - log of test execution (L) -ext/myext/tests/myext.exp - expected output (E) -ext/myext/tests/myext.out - output from test script (O) -ext/myext/tests/myext.diff - diff of .out and .exp (D) - - Failed tests are always bugs. Either the test is bugged or not considering -factors applying to the tester's environment, or there is a bug in PHP. -If this is a known bug, we strive to provide bug numbers, in either the -test name or the file name. You can check the status of such a bug, by -going to: http://bugs.php.net/12345 where 12345 is the bug number. -For clarity and automated processing, bug numbers are prefixed by a hash -sign '#' in test names and/or test cases are named bug12345.phpt. - -NOTE: The files generated by tests can be selected by setting the -environment variable TEST_PHP_LOG_FORMAT. For each file you want to be -generated use the character in brackets as shown above (default is LEOD). -The php file will be generated always. - -NOTE: You can set environment variable TEST_PHP_DETAILED to enable -detailed test information. - -[Automated Testing] --------------- - If you like to keep up to speed, with latest developments and quality -assurance, setting the environment variable NO_INTERACTION to 1, will not -prompt the tester for any user input. - -Normally, the exit status of "make test" is zero, regardless of the results -of independent tests. Set the environment variable REPORT_EXIT_STATUS to 1, -and "make test" will set the exit status ("$?") to non-zero, when an -individual test has failed. - -Example script to be run by cron(1): -========== qa-test.sh ============= -#!/bin/sh - -CO_DIR=$HOME/cvs/php7 -MYMAIL=qa-test@domain.com -TMPDIR=/var/tmp -TODAY=`date +"%Y%m%d"` - -# Make sure compilation environment is correct -CONFIGURE_OPTS='--disable-all --enable-cli --with-pcre' -export MAKE=gmake -export CC=gcc - -# Set test environment -export NO_INTERACTION=1 -export REPORT_EXIT_STATUS=1 - -cd $CO_DIR -cvs update . >>$TMPDIR/phpqatest.$TODAY -./cvsclean ; ./buildconf ; ./configure $CONFIGURE_OPTS ; $MAKE -$MAKE test >>$TMPDIR/phpqatest.$TODAY 2>&1 -if test $? -gt 0 -then - cat $TMPDIR/phpqatest.$TODAY | mail -s"PHP-QA Test Failed for $TODAY" $MYMAIL -fi -========== end of qa-test.sh ============= - -NOTE: The exit status of run-tests.php will be 1 when -REPORT_EXIT_STATUS is set. The result of "make test" may be higher -than that. At present, gmake 3.79.1 returns 2, so it is -advised to test for non-zero, rather then a specific value. - - -[Creating new test files] -------------------------- - Writing test file is very easy if you are used to PHP. -See the HOWTO at http://qa.php.net/write-test.php - - -[How to help us] ----------------- - If you find bug in PHP, you can submit bug report AND test script -for us. You don't have to write complete script, just give us test -script with following format. Please test the script and make sure -you write the correct ACTUAL OUTPUT and EXPECTED OUTPUT before you -submit. - -<?php -/* -Bug #12345 -substr() bug. Do not return expected string. - -ACTUAL OUTPUT -XYXA - -EXPECTED OUTPUT -ABCD -*/ - -$str = "XYZABCD"; -echo substr($str,3,7); - -?> @@ -37,3 +37,10 @@ Guidelines for contributors - [README.GIT-RULES](/README.GIT-RULES) - [README.MAILINGLIST_RULES](/README.MAILINGLIST_RULES) - [README.RELEASE_PROCESS](/README.RELEASE_PROCESS) + +## Testing + +To run tests the `make test` is used after successful compilation of the sources. + +See [Creating new test files](https://qa.php.net/write-test.php) chapter for more +information about testing. diff --git a/ext/exif/tests/exif005.phpt b/ext/exif/tests/exif005.phpt index b472aa826f..a2282aa1b0 100644 --- a/ext/exif/tests/exif005.phpt +++ b/ext/exif/tests/exif005.phpt @@ -7,9 +7,7 @@ output_handler= zlib.output_compression=0 --FILE-- <?php -/* Do not change this test it is a README.TESTING example. - * test5.jpg is a 1*1 image that contains an Exif section with ifd = 00000009h - */ +// test5.jpg is a 1*1 image that contains an Exif section with ifd = 00000009h $image = exif_read_data(dirname(__FILE__).'/test5.jpg','',true,false); var_dump($image['IFD0']); ?> diff --git a/ext/sodium/tests/installed.phpt b/ext/sodium/tests/installed.phpt index e548b5f8dc..e6101ed509 100644 --- a/ext/sodium/tests/installed.phpt +++ b/ext/sodium/tests/installed.phpt @@ -12,9 +12,6 @@ echo "sodium extension is available"; text in the --EXPECT-- section below for the tests to pass, differences between the output and the expected text are interpreted as failure - - see php7/README.TESTING for further information on - writing regression tests */ ?> --EXPECT-- diff --git a/ext/standard/tests/strings/str_shuffle.phpt b/ext/standard/tests/strings/str_shuffle.phpt index 878cb283dd..f5122bc202 100644 --- a/ext/standard/tests/strings/str_shuffle.phpt +++ b/ext/standard/tests/strings/str_shuffle.phpt @@ -2,7 +2,6 @@ Testing str_shuffle. --FILE-- <?php -/* Do not change this test it is a README.TESTING example. */ $s = '123'; var_dump(str_shuffle($s)); var_dump($s); diff --git a/ext/standard/tests/strings/strings001.phpt b/ext/standard/tests/strings/strings001.phpt index 70b709295d..4784248212 100644 --- a/ext/standard/tests/strings/strings001.phpt +++ b/ext/standard/tests/strings/strings001.phpt @@ -2,7 +2,6 @@ Test whether strstr() and strrchr() are binary safe. --FILE-- <?php -/* Do not change this test it is a README.TESTING example. */ $s = "alabala nica".chr(0)."turska panica"; var_dump(strstr($s, "nic")); var_dump(strrchr($s," nic")); diff --git a/ext/standard/tests/strings/strtr.phpt b/ext/standard/tests/strings/strtr.phpt index 77666ced8c..1dc1e9c4ef 100644 --- a/ext/standard/tests/strings/strtr.phpt +++ b/ext/standard/tests/strings/strtr.phpt @@ -2,7 +2,6 @@ strtr() function --FILE-- <?php -/* Do not change this test it is a README.TESTING example. */ $trans = array("hello"=>"hi", "hi"=>"hello", "a"=>"A", "world"=>"planet"); var_dump(strtr("# hi all, I said hello world! #", $trans)); ?> |