cvs commit: modperl-docs/src/docs/2.0/devel/writing_tests writing_tests.pod
stas01/12/26 23:04:35 Modified:src/docs/2.0/devel/writing_tests writing_tests.pod Log: - port README to extensively document Request Generation and Response Options, + runtime confguration options Revision ChangesPath 1.28 +213 -14 modperl-docs/src/docs/2.0/devel/writing_tests/writing_tests.pod Index: writing_tests.pod === RCS file: /home/cvs/modperl-docs/src/docs/2.0/devel/writing_tests/writing_tests.pod,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- writing_tests.pod 2001/12/27 05:08:42 1.27 +++ writing_tests.pod 2001/12/27 07:04:35 1.28 @@ -57,8 +57,8 @@ it. It's important to know that there is a special verbose mode, enabled -with the I-v option, in which everything printed by the test goes to -CSTDOUT. So for example if your test does this: +with the I-verbose option, in which everything printed by the test +goes to CSTDOUT. So for example if your test does this: print # testing : feature foo\n; print # expected: $expected\n; @@ -66,7 +66,7 @@ ok $expected eq $received; in the normal mode, you won't see any of these prints. But if you run -the test with It/TEST -v, you will see something like this: +the test with It/TEST -verbose, you will see something like this: # testing : feature foo # expected: 2 @@ -133,11 +133,11 @@ In case something goes wrong you should run the tests in the verbose mode: - % t/TEST -v + % t/TEST -verbose In this case the test may print useful information, like what values it expects and what values it receives, given that the test is written -to report these. In the silent mode (without C-v) these printouts +to report these. In the silent mode (without C-verbose) these printouts are suppressed by the test suite. When debugging problems it helps to keep the Ierror_log file open in @@ -196,10 +196,10 @@ When you run specific tests you may want to run them in the verbose mode, and depending on how the test was written, you may get more -debug information under this mode. This mode is turned on with I-v +debug information under this mode. This mode is turned on with I-verbose option: - % t/TEST -run -v protocol/echo + % t/TEST -run -verbose protocol/echo You can run all the tests in a single directory by just passing this directory as an argument. You can pass more than one test or directory @@ -465,10 +465,185 @@ Finally, any other options passed will be forwarded to Ct/TEST as is. -=head2 Advanced Testing +=head2 RunTime Configuration Overriding +After the server is configured during Cmake test or with Ct/TEST +-config, it's possible to explicitly override certain configuration +parameters. The override-able parameters are listed when executing: + % t/TEST -help +Probably the most useful parameters are: + +=over + +=item * -preamble + +configuration directives to add at the beginning of Ihttpd.conf. +For example to turn the tracing on: + + % t/TEST -preamble PerlTrace all + +=item * -postamble + +configuration directives to add at the end of Ihttpd.conf. For +example to load a certain Perl module: + + % t/TEST -postamble PerlModule MyDebugMode + +=item * -user + +run as user Inobody: + + % t/TEST -user nobody + +=item * -port + +run on a different port: + + % t/TEST -port 8799 + +=item * -servername + +run on a different server: + + % t/TEST -servername test.example.com + +=item * -httpd + +configure an httpd other than the default (that apxs figures out): + + % t/TEST -httpd ~/httpd-2.0/httpd + +=item * -apxs + +switch to another apxs: + + % t/TEST -apxs ~/httpd-2.0-prefork/bin/apxs + +=back + +For a complete list of override-able configuration parameters see the +output of Ct/TEST -help. + +=head2 Request Generation and Response Options + +We have mentioned already the most useful run-time options. Here are +some other options that you may find useful during testing. + +=over + +=item * -ping + +Ping the server to see whether it runs + + % t/TEST -ping + +Ping the server and wait until the server starts, report waiting time. + + % t/TEST -ping=block + +This can be useful in conjunction with I-run option during debugging: + + % t/TEST -ping=block -run + +normally, I-run will immediately quit if it detects that the server +is not running, but with I-ping=block in effect, it'll wait +indefinitely for the server to start up. + +=item * -head + +Issue a CHEAD request. For example to request I/server-info: + + % t/TEST -head /server-info + +=item * -get + +Request the body of a certain URL via CGET. + + % t/TEST -get /server-info + +If no URL is
cvs commit: modperl-docs/src/docs/2.0/devel/help - New directory
stas01/12/27 01:21:47 modperl-docs/src/docs/2.0/devel/help - New directory - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: modperl-docs/src/docs/2.0/devel/writing_tests writing_tests.pod
stas01/12/27 03:11:13 Modified:src/docs/2.0/devel/writing_tests writing_tests.pod Log: - completing the porting of 'make test' docs from modperl_dev.pod Revision ChangesPath 1.30 +170 -89 modperl-docs/src/docs/2.0/devel/writing_tests/writing_tests.pod Index: writing_tests.pod === RCS file: /home/cvs/modperl-docs/src/docs/2.0/devel/writing_tests/writing_tests.pod,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- writing_tests.pod 2001/12/27 07:33:03 1.29 +++ writing_tests.pod 2001/12/27 11:11:13 1.30 @@ -56,10 +56,13 @@ proceed with the tests and it's not a must pass test, you just skip it. -It's important to know that there is a special verbose mode, enabled -with the I-verbose option, in which everything printed by the test -goes to CSTDOUT. So for example if your test does this: +=head2 Verbose Testing +By default print() statements in the test script are filtered out by +CTest::Harness. if you want the test to print what it does (if you +decide to debug some test) use C-verbose option. So for example if +your test does this: + print # testing : feature foo\n; print # expected: $expected\n; print # received: $received\n; @@ -80,8 +83,8 @@ mode and send you back the report. It'll be much easier to understand what the problem is if you get these debug printings from the user. -In the section LHow to Write Tests we discuss a few helper -functions which make the tests writing easier. +In the section LWriting Tests several helper functions which make +the tests writing easier are discussed. For more details about the CTest::Harness module please refer to its manpage. Also see the CTest manpage about Perl's test suite. @@ -111,10 +114,19 @@ testing environments which both use CApache::Test for their test suites. +=head2 Testing Options + +Run: + + % t/TEST -help + +to get the list of options you can use during testing. They are +covered in the rest of this document. + =head2 Basic Testing -Running tests is just like for any CPAN Perl module; first we create -the IMakefile and build everything with Imake: +Running tests is just like for any CPAN Perl module; first we generate +the IMakefile file and build everything with Imake: % perl Makefile.PL [options] % make @@ -125,44 +137,64 @@ % make test but it adds quite an overhead, since it has to check that everything -is up to date (the usual Cmake source change control). Therefore -faster to run the tests directly via: +is up to date (the usual Cmake source change control). Therefore you +have to run it only once after Cmake and for re-running the tests +it's faster to run the tests directly via: % t/TEST -In case something goes wrong you should run the tests in the verbose -mode: +When Cmake test or Ct/TEST are run, all tests found in the It +directory (files ending with I.t are recognized as tests) will be +run. - % t/TEST -verbose +=head2 Individual Testing -In this case the test may print useful information, like what values -it expects and what values it receives, given that the test is written -to report these. In the silent mode (without C-verbose) these printouts -are suppressed by the test suite. +To run a single test, simple specify it at the command line. For +example to run the test file It/protocol/echo.t, execute: -When debugging problems it helps to keep the Ierror_log file open in -another console, and see the debug output in the real time via -tail(1): + % t/TEST protocol/echo - % tail -f t/logs/error_log +Notice that you don't have to add the It/ prefix and I.t extension +for the test filenames if you specify them explicitly, but you can +have these as well. Therefore the following are all valid commands: -Of course this file gets created only when the server starts, so you -cannot run tail(1) on it before the server starts. + % t/TEST protocol/echo.t + % t/TEST t/protocol/echo + % t/TEST t/protocol/echo.t + +The server will be stopped if it was already running and a new one +will be started before running the It/protocol/echo.t test. At the +end of the test the server will be shut down. + +When you run specific tests you may want to run them in the verbose +mode, and depending on how the test was written, you may get more +debug information under this mode. This mode is turned on with +I-verbose option: + + % t/TEST -verbose protocol/echo + +You can run groups of tests at once. This command: + + % ./t/TEST modules protocol/echo + +will run all the tests in It/modules/ directory, followed by +It/protocol/echo.t test. -[F] Later on we will talk about I-clean option, for now just -remember
cvs commit: modperl-docs/src/docs/2.0/devel/testing - New directory
stas01/12/27 03:13:50 modperl-docs/src/docs/2.0/devel/testing - New directory - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: modperl-docs/src/docs/2.0/devel/debug_c - New directory
stas01/12/27 03:40:37 modperl-docs/src/docs/2.0/devel/debug_c - New directory - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: modperl-docs/src/docs/2.0/devel/debug_perl debug_perl.pod
stas01/12/27 04:07:53 Modified:src/docs/2.0/devel/porting_from_1.x porting_from_1.x.pod src/docs/2.0/devel/debug_perl debug_perl.pod Log: - tidy up Revision ChangesPath 1.3 +6 -3 modperl-docs/src/docs/2.0/devel/porting_from_1.x/porting_from_1.x.pod Index: porting_from_1.x.pod === RCS file: /home/cvs/modperl-docs/src/docs/2.0/devel/porting_from_1.x/porting_from_1.x.pod,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- porting_from_1.x.pod 2001/11/12 02:44:40 1.2 +++ porting_from_1.x.pod 2001/12/27 12:07:53 1.3 @@ -95,9 +95,12 @@ =head1 Authors -Stas Bekman Eltstas (at) stason.orgEgt +=over -Doug MacEachern Eltdougm (at) covalent.netEgt +=item * Stas Bekman Eltstas (at) stason.orgEgt -=cut +=item * Doug MacEachern Eltdougm (at) covalent.netEgt + +=back +=cut 1.2 +0 -12 modperl-docs/src/docs/2.0/devel/debug_perl/debug_perl.pod Index: debug_perl.pod === RCS file: /home/cvs/modperl-docs/src/docs/2.0/devel/debug_perl/debug_perl.pod,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- debug_perl.pod2001/12/27 11:41:58 1.1 +++ debug_perl.pod2001/12/27 12:07:53 1.2 @@ -11,18 +11,6 @@ =head1 Authors -Stas Bekman Eltstas (at) stason.orgEgt - -=cut -=head1 Maintainers - -Maintainer is the person(s) you should contact with updates, -corrections and patches. - -Stas Bekman Eltstas (at) stason.orgEgt - -=head1 Authors - =over =item * Stas Bekman Eltstas (at) stason.orgEgt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]