unit test a single case

php.internals

Sam Ding

8 years ago
Hi PHP developers, I am new and try to porting php v7.2.1 on IBM s390x, after building and run unit test "make test", there are some failed cases. Is there any way I can run a single case and get the result? Further how to debug a php unit case code? Thanks, Sam Ding, Linux on z Systems Open Source Ecosystem IBM Toronto Lab, email: samding@ca.ibm.com phone: (905)413-2947

Nikita Popov

8 years ago
On Wed, Jan 17, 2018 at 5:40 PM, Sam Ding <samding@ca.ibm.com> wrote:
> > Hi PHP developers, > > I am new and try to porting php v7.2.1 on IBM s390x, after building and > run unit test "make test", there are > some failed cases. Is there any way I can run a single case and get the > result? > Further how to debug a php unit case code? >
You can use one of make test TESTS=dir sapi/cli/php run-tests.php -P dir to run tests in a certain directory, or a specific test file. The first step for debugging would be to look at the .out or .diff file for the failing .phpt. There will also be a .php file, which can be used to run the test file directly. Nikita

Pedro Magalhães

8 years ago
On Wed, Jan 17, 2018 at 4:50 PM, Nikita Popov <nikita.ppv@gmail.com> wrote:
> On Wed, Jan 17, 2018 at 5:40 PM, Sam Ding <samding@ca.ibm.com> wrote: > > > > > Hi PHP developers, > > > > I am new and try to porting php v7.2.1 on IBM s390x, after building and > > run unit test "make test", there are > > some failed cases. Is there any way I can run a single case and get the > > result? > > Further how to debug a php unit case code? > > > > You can use one of > > make test TESTS=dir > sapi/cli/php run-tests.php -P dir > > to run tests in a certain directory, or a specific test file. > > The first step for debugging would be to look at the .out or .diff file for > the failing .phpt. There will also be a .php file, which can be used to run > the test file directly. > > Nikita >
To add to what Nikita said, there will also be a .sh file next to the failing test that you can use to repeat that test only. Regards, Pedro

Christoph Becker

8 years ago
On 17.01.2018 at 17:50, Nikita Popov wrote:
> On Wed, Jan 17, 2018 at 5:40 PM, Sam Ding <samding@ca.ibm.com> wrote: > >> Further how to debug a php unit case code? > > The first step for debugging would be to look at the .out or .diff file for > the failing .phpt. There will also be a .php file, which can be used to run > the test file directly.
See also <http://qa.php.net/write-test.php#analyzing-failing-tests>.
-- Christoph M. Becker