Project:Perl/maint-notes/dev-perl/Apache-DBI

From Gentoo Wiki
Jump to:navigation Jump to:search

Testing

To test this package adequately you need:

  1. dev-perl/DBD-mysql
  2. A running connectable mysql/mariadb instance.

It's not sufficient to see:

CODE
 * Test::Harness Jobs=3
make -j3 --load-average=4 test TEST_VERBOSE=0 
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/10mysql.t .. ok     
All tests successful.
Files=1, Tests=10,  0 wallclock secs ( 0.03 usr  0.00 sys +  0.08 cusr  0.02 csys =  0.13 CPU)
Result: PASS

To confirm tests are adequate, you need to test with:

CODE
DIST_TEST_OVERRIDE="do verbose" emerge -va1 dev-perl/Apache-DBI

If you see output like the following, that means adequate tests have not been run:

CODE
make -j3 --load-average=4 test TEST_VERBOSE=1 
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(1, 'blib/lib', 'blib/arch')" t/*.t
t/10mysql.t .. 
1..10
ok 1 - use Apache::DBI;
ok 2 - use DBI;
ok 3 - DBD::mysql loaded
ok 4 - DBI is using Apache::DBI
ok 5 # skip Could not connect to test database: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
ok 6 # skip Could not connect to test database: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
ok 7 # skip Could not connect to test database: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
ok 8 # skip Could not connect to test database: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
ok 9 # skip Could not connect to test database: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
ok 10 # skip Could not connect to test database: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
ok
All tests successful.
Files=1, Tests=10,  1 wallclock secs ( 0.02 usr  0.01 sys +  0.08 cusr  0.02 csys =  0.13 CPU)
Result: PASS

You want output to look like:

CODE
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(1, 'blib/lib', 'blib/arch')" t/*.t
t/10mysql.t .. 
1..10
ok 1 - use Apache::DBI;
ok 2 - use DBI;
ok 3 - DBD::mysql loaded
ok 4 - DBI is using Apache::DBI
ok 5 - An object of class 'Apache::DBI::db' isa 'Apache::DBI::db'
ok 6 - Connected 1
ok 7 - Connected 2
ok 8 - got the same connection both times
ok 9 - Connected 3
ok 10 - got different connection from different attributes
ok
All tests successful.