Test fails when coverage enabled #54

Closed
kemicl opened this Issue Apr 5, 2013 · 6 comments

Comments

Projects
None yet
3 participants
@kemicl

kemicl commented Apr 5, 2013

This test passes normally but fails when HARNESS_PERL_SWITCHES is set
to -MDevel::Cover.

The failure message is the following,

90actionRegistrationTest.t .. 1/? new(): failed: load(): couldn't thaw() data using CGI::Session::Serialize::default:thaw(): couldn't thaw. (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /System/Library/Perl/5.10.0/darwin-thread-multi-2level/Safe.pm line 281.

The versions used are the following,

Perl v5.10.0 built for darwin-thread-multi-2level

Module Version


Devel::Cover 1.00
CGI::Session::Serialize::default 4.43
Safe 2.12
Opcode 1.11

The error is raised in CGI::Session::Serialize::default at the line marked here.

sub thaw {
my ($class, $string) = @_;

# To make -T happy
 my ($safe_string) = $string =~ m/^(.*)$/s;
 my $rv = Safe->new->reval( $safe_string );
if ( $@ ) {
    return $class->set_error("thaw(): couldn't thaw. $@");  <==== here
}
__walk($rv);
return $rv;

}

The reval routine in Safe is copied here with line 281 marked.

sub reval {
my ($obj, $expr, $strict) = @_;
my $root = $obj->{Root};

my $evalsub = lexless_anon_sub($root,$strict, $expr);
return Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub);  <=== 281

}

@jkeenan

This comment has been minimized.

Show comment Hide comment
@jkeenan

jkeenan Apr 12, 2013

Contributor

It's not clear where 90actionRegistrationTest.t is to be found. However, in an attempt to move this issue forward, I used the cpan shell to call test CGI::Session. There were a few warnings, but make test PASSed.

I then chdir-ed to the build directory and called: cover -test 2>&1 | tee Devel-Cover/gh54_cgi_session_cover_test.txt, the contents of which are below. As you can see, running make test for CGI::Session with Devel::Cover does indeed result in many test failures.

$ cat gh54_cgi_session_cover_test.txt 
cover: running make test "OPTIMIZE=-O0 -fprofile-arcs -ftest-coverage" "OTHERLDFLAGS=-fprofile-arcs -ftest-coverage"
Deleting database /Users/jimk/.cpan/build/CGI-Session-4.48-L_fw9U/cover_db
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
        (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /usr/local/lib/perl5/5.16.0/Safe.pm line 360.

#   Failed test at t/api3_db_file.t line 46.
Can't call method "id" on an undefined value at t/api3_db_file.t line 48.
# Looks like you planned 14 tests but ran 10.
# Looks like you failed 1 test of 10 run.
# Looks like your test exited with 255 just after 10.
t/api3_db_file.t ................ 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 5/14 subtests 
t/api3_db_file_freezethaw.t ..... skipped: FreezeThaw not available
t/api3_db_file_storable.t ....... ok
t/api3_db_file_storable_incr.t .. ok
        (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /usr/local/lib/perl5/5.16.0/Safe.pm line 360.

#   Failed test at t/api3_file.t line 42.
Can't call method "id" on an undefined value at t/api3_file.t line 44.
# Looks like you planned 17 tests but ran 10.
# Looks like you failed 1 test of 10 run.
# Looks like your test exited with 255 just after 10.
t/api3_file.t ................... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 8/17 subtests 
t/api3_file_freezethaw.t ........ skipped: FreezeThaw not available
t/api3_file_freezethaw_incr.t ... skipped: FreezeThaw not available
t/api3_file_storable.t .......... ok
t/api3_file_storable_incr.t ..... ok
        (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /usr/local/lib/perl5/5.16.0/Safe.pm line 360.

#   Failed test at t/api3_incr.t line 52.
Can't call method "id" on an undefined value at t/api3_incr.t line 53.
# Looks like you planned 14 tests but ran 10.
# Looks like you failed 1 test of 10 run.
# Looks like your test exited with 255 just after 10.
t/api3_incr.t ................... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 5/14 subtests 
#Using Storable as object serializer
t/api3_obj_store.t .............. ok
t/api3_obj_store_db_file.t ...... ok
t/bug21952.t .................... ok
t/bug24285.t .................... ok
t/cgi_simple.t .................. ok
        (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /usr/local/lib/perl5/5.16.0/Safe.pm line 360.
new(): failed: load(): couldn't thaw() data using CGI::Session::Serialize::default: at t/complex_ds.t line 42.
# Looks like you planned 10 tests but ran 6.
t/complex_ds.t .................. 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 4/10 subtests 
t/driver_dbi.t .................. ok
t/expire.t ...................... ok
        (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /usr/local/lib/perl5/5.16.0/Safe.pm line 360.

#   Failed test 'find() returned no errors'
#   at t/find.t line 68.
#          got: 'find(): couldn't load session '62fb444d07b58392565e35a48477f0de'. load(): couldn't thaw() data using CGI::Session::Serialize::default:'
#     expected: ''
# Looks like you planned 7 tests but ran 4.
# Looks like you failed 1 test of 4 run.
t/find.t ........................ 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 4/7 subtests 
t/flush.t ....................... ok
        (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /usr/local/lib/perl5/5.16.0/Safe.pm line 360.
load(): couldn't thaw() data using CGI::Session::Serialize::default: at /Users/jimk/.cpan/build/CGI-Session-4.48-L_fw9U/blib/lib/CGI/Session/Test/Default.pm line 198.
# Looks like you planned 101 tests but ran 79.
# Looks like your test exited with 255 just after 79.
t/g4.t .......................... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 22/101 subtests 
        (less 56 skipped subtests: 23 okay)
        (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /usr/local/lib/perl5/5.16.0/Safe.pm line 360.
load(): couldn't thaw() data using CGI::Session::Serialize::default: at /Users/jimk/.cpan/build/CGI-Session-4.48-L_fw9U/blib/lib/CGI/Session/Test/Default.pm line 198.
# Looks like you planned 101 tests but ran 79.
# Looks like your test exited with 255 just after 79.
t/g4_dbfile.t ................... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 22/101 subtests 
        (less 56 skipped subtests: 23 okay)
t/g4_dbfile_freezethaw.t ........ skipped: FreezeThaw is NOT available
t/g4_dbfile_storable.t .......... ok
t/g4_freezethaw.t ............... skipped: FreezeThaw is NOT available
t/g4_mysql.t .................... skipped: DBD::mysql is NOT available
t/g4_mysql_freezethaw.t ......... skipped: DBD::mysql is NOT available
t/g4_mysql_storable.t ........... skipped: DBD::mysql is NOT available
t/g4_postgresql.t ............... skipped: DataSource is not known
t/g4_postgresql_freezethaw.t .... skipped: DataSource is not known
t/g4_postgresql_storable.t ...... skipped: DataSource is not known
DBD::SQLite::db do failed: table sessions already exists at t/g4_sqlite.t line 33.
DBD::SQLite::db do failed: table sessions already exists at t/g4_sqlite.t line 33.
t/g4_sqlite.t ................... 
Dubious, test returned 2 (wstat 512, 0x200)
No subtests run 
t/g4_sqlite_freezethaw.t ........ skipped: FreezeThaw is NOT available
t/g4_sqlite_storable.t .......... ok
t/g4_storable.t ................. ok
t/header.t ...................... ok
        (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /usr/local/lib/perl5/5.16.0/Safe.pm line 360.

#   Failed test 'load session with different IP'
#   at t/ip_matches.t line 33.
Can't call method "id" on an undefined value at t/ip_matches.t line 34.
# Looks like you failed 1 test of 5.
# Looks like your test exited with 255 just after 5.
t/ip_matches.t .................. 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 1/5 subtests 
t/is_new.t ...................... ok
Argument "wrong" isn't numeric in numeric ne (!=) at /Users/jimk/.cpan/build/CGI-Session-4.48-L_fw9U/blib/lib/CGI/Session.pm line 684.
t/load.t ........................ ok
t/load_with_undef.t ............. ok
        (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /usr/local/lib/perl5/5.16.0/Safe.pm line 360.

#   Failed test at t/name.t line 15.
Can't call method "name" on an undefined value at t/name.t line 24.
# Looks like you planned 14 tests but ran 4.
# Looks like you failed 1 test of 4 run.
# Looks like your test exited with 255 just after 4.
t/name.t ........................ 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 11/14 subtests 
t/new_with_undef.t .............. ok
t/parse_dsn.t ................... ok
t/remote_addr.t ................. ok
        (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /usr/local/lib/perl5/5.16.0/Safe.pm line 360.

#   Failed test at t/session_param_undef.t line 52.
Can't call method "param" on an undefined value at t/session_param_undef.t line 61.
# Looks like you planned 21 tests but ran 3.
# Looks like you failed 1 test of 3 run.
# Looks like your test exited with 255 just after 3.
t/session_param_undef.t ......... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 19/21 subtests 
t/str2seconds.t ................. ok
t/symlink_db_file.t ............. ok
t/symlink_file.t ................ ok

Test Summary Report
-------------------
t/api3_db_file.t              (Wstat: 65280 Tests: 10 Failed: 1)
  Failed test:  10
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 14 tests but ran 10.
t/api3_file.t                 (Wstat: 65280 Tests: 10 Failed: 1)
  Failed test:  10
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 17 tests but ran 10.
t/api3_incr.t                 (Wstat: 65280 Tests: 10 Failed: 1)
  Failed test:  10
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 14 tests but ran 10.
t/complex_ds.t                (Wstat: 65280 Tests: 6 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 10 tests but ran 6.
t/find.t                      (Wstat: 256 Tests: 4 Failed: 1)
  Failed test:  4
  Non-zero exit status: 1
  Parse errors: Bad plan.  You planned 7 tests but ran 4.
t/g4.t                        (Wstat: 65280 Tests: 79 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 101 tests but ran 79.
t/g4_dbfile.t                 (Wstat: 65280 Tests: 79 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 101 tests but ran 79.
t/g4_sqlite.t                 (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
t/ip_matches.t                (Wstat: 65280 Tests: 5 Failed: 1)
  Failed test:  5
  Non-zero exit status: 255
t/name.t                      (Wstat: 65280 Tests: 4 Failed: 1)
  Failed test:  1
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 14 tests but ran 4.
t/session_param_undef.t       (Wstat: 65280 Tests: 3 Failed: 1)
  Failed test:  2
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 21 tests but ran 3.
Files=48, Tests=675, 240 wallclock secs ( 0.95 usr  0.58 sys + 143.83 cusr 17.03 csys = 162.39 CPU)
Result: FAIL
Failed 11/48 test programs. 7/675 subtests failed.
make: *** [test_dynamic] Error 255
Reading database from /Users/jimk/.cpan/build/CGI-Session-4.48-L_fw9U/cover_db


---------------------------- ------ ------ ------ ------ ------ ------ ------
File                           stmt   bran   cond    sub    pod   time  total
---------------------------- ------ ------ ------ ------ ------ ------ ------
blib/lib/CGI/Session.pm        77.4   68.2   51.6   84.4   79.3   53.5   72.8
...lib/CGI/Session/Driver.pm   66.7   80.0   50.0   40.0   71.4    0.2   64.4
...CGI/Session/Driver/DBI.pm   48.9   25.0   23.8   83.3   83.3    1.3   42.9
...Session/Driver/db_file.pm   82.4   50.0   50.0   88.9  100.0    4.7   72.3
...GI/Session/Driver/file.pm   91.2   58.0   40.0  100.0  100.0    1.2   78.4
.../Session/Driver/sqlite.pm   87.8   50.0   33.3  100.0  100.0    0.1   73.5
...I/Session/ErrorHandler.pm  100.0    n/a   80.0  100.0  100.0    0.1   94.3
...ib/CGI/Session/ID/incr.pm  100.0   50.0   57.1  100.0    0.0    0.0   81.5
...lib/CGI/Session/ID/md5.pm  100.0    n/a    n/a  100.0    0.0    0.1   94.1
.../CGI/Session/ID/static.pm   93.8   50.0    n/a  100.0    0.0    0.0   87.5
...sion/Serialize/default.pm   68.8   11.5    0.0  100.0  100.0    6.5   54.1
...ion/Serialize/storable.pm  100.0    n/a    n/a  100.0  100.0    0.0  100.0
...I/Session/Test/Default.pm   97.2   57.1   50.0  100.0   44.4   32.2   91.6
Total                          82.5   54.2   45.3   90.2   76.4  100.0   73.6
---------------------------- ------ ------ ------ ------ ------ ------ ------

Thank you very much.

Jim Keenan

Contributor

jkeenan commented Apr 12, 2013

It's not clear where 90actionRegistrationTest.t is to be found. However, in an attempt to move this issue forward, I used the cpan shell to call test CGI::Session. There were a few warnings, but make test PASSed.

I then chdir-ed to the build directory and called: cover -test 2>&1 | tee Devel-Cover/gh54_cgi_session_cover_test.txt, the contents of which are below. As you can see, running make test for CGI::Session with Devel::Cover does indeed result in many test failures.

$ cat gh54_cgi_session_cover_test.txt 
cover: running make test "OPTIMIZE=-O0 -fprofile-arcs -ftest-coverage" "OTHERLDFLAGS=-fprofile-arcs -ftest-coverage"
Deleting database /Users/jimk/.cpan/build/CGI-Session-4.48-L_fw9U/cover_db
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
        (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /usr/local/lib/perl5/5.16.0/Safe.pm line 360.

#   Failed test at t/api3_db_file.t line 46.
Can't call method "id" on an undefined value at t/api3_db_file.t line 48.
# Looks like you planned 14 tests but ran 10.
# Looks like you failed 1 test of 10 run.
# Looks like your test exited with 255 just after 10.
t/api3_db_file.t ................ 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 5/14 subtests 
t/api3_db_file_freezethaw.t ..... skipped: FreezeThaw not available
t/api3_db_file_storable.t ....... ok
t/api3_db_file_storable_incr.t .. ok
        (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /usr/local/lib/perl5/5.16.0/Safe.pm line 360.

#   Failed test at t/api3_file.t line 42.
Can't call method "id" on an undefined value at t/api3_file.t line 44.
# Looks like you planned 17 tests but ran 10.
# Looks like you failed 1 test of 10 run.
# Looks like your test exited with 255 just after 10.
t/api3_file.t ................... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 8/17 subtests 
t/api3_file_freezethaw.t ........ skipped: FreezeThaw not available
t/api3_file_freezethaw_incr.t ... skipped: FreezeThaw not available
t/api3_file_storable.t .......... ok
t/api3_file_storable_incr.t ..... ok
        (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /usr/local/lib/perl5/5.16.0/Safe.pm line 360.

#   Failed test at t/api3_incr.t line 52.
Can't call method "id" on an undefined value at t/api3_incr.t line 53.
# Looks like you planned 14 tests but ran 10.
# Looks like you failed 1 test of 10 run.
# Looks like your test exited with 255 just after 10.
t/api3_incr.t ................... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 5/14 subtests 
#Using Storable as object serializer
t/api3_obj_store.t .............. ok
t/api3_obj_store_db_file.t ...... ok
t/bug21952.t .................... ok
t/bug24285.t .................... ok
t/cgi_simple.t .................. ok
        (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /usr/local/lib/perl5/5.16.0/Safe.pm line 360.
new(): failed: load(): couldn't thaw() data using CGI::Session::Serialize::default: at t/complex_ds.t line 42.
# Looks like you planned 10 tests but ran 6.
t/complex_ds.t .................. 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 4/10 subtests 
t/driver_dbi.t .................. ok
t/expire.t ...................... ok
        (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /usr/local/lib/perl5/5.16.0/Safe.pm line 360.

#   Failed test 'find() returned no errors'
#   at t/find.t line 68.
#          got: 'find(): couldn't load session '62fb444d07b58392565e35a48477f0de'. load(): couldn't thaw() data using CGI::Session::Serialize::default:'
#     expected: ''
# Looks like you planned 7 tests but ran 4.
# Looks like you failed 1 test of 4 run.
t/find.t ........................ 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 4/7 subtests 
t/flush.t ....................... ok
        (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /usr/local/lib/perl5/5.16.0/Safe.pm line 360.
load(): couldn't thaw() data using CGI::Session::Serialize::default: at /Users/jimk/.cpan/build/CGI-Session-4.48-L_fw9U/blib/lib/CGI/Session/Test/Default.pm line 198.
# Looks like you planned 101 tests but ran 79.
# Looks like your test exited with 255 just after 79.
t/g4.t .......................... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 22/101 subtests 
        (less 56 skipped subtests: 23 okay)
        (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /usr/local/lib/perl5/5.16.0/Safe.pm line 360.
load(): couldn't thaw() data using CGI::Session::Serialize::default: at /Users/jimk/.cpan/build/CGI-Session-4.48-L_fw9U/blib/lib/CGI/Session/Test/Default.pm line 198.
# Looks like you planned 101 tests but ran 79.
# Looks like your test exited with 255 just after 79.
t/g4_dbfile.t ................... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 22/101 subtests 
        (less 56 skipped subtests: 23 okay)
t/g4_dbfile_freezethaw.t ........ skipped: FreezeThaw is NOT available
t/g4_dbfile_storable.t .......... ok
t/g4_freezethaw.t ............... skipped: FreezeThaw is NOT available
t/g4_mysql.t .................... skipped: DBD::mysql is NOT available
t/g4_mysql_freezethaw.t ......... skipped: DBD::mysql is NOT available
t/g4_mysql_storable.t ........... skipped: DBD::mysql is NOT available
t/g4_postgresql.t ............... skipped: DataSource is not known
t/g4_postgresql_freezethaw.t .... skipped: DataSource is not known
t/g4_postgresql_storable.t ...... skipped: DataSource is not known
DBD::SQLite::db do failed: table sessions already exists at t/g4_sqlite.t line 33.
DBD::SQLite::db do failed: table sessions already exists at t/g4_sqlite.t line 33.
t/g4_sqlite.t ................... 
Dubious, test returned 2 (wstat 512, 0x200)
No subtests run 
t/g4_sqlite_freezethaw.t ........ skipped: FreezeThaw is NOT available
t/g4_sqlite_storable.t .......... ok
t/g4_storable.t ................. ok
t/header.t ...................... ok
        (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /usr/local/lib/perl5/5.16.0/Safe.pm line 360.

#   Failed test 'load session with different IP'
#   at t/ip_matches.t line 33.
Can't call method "id" on an undefined value at t/ip_matches.t line 34.
# Looks like you failed 1 test of 5.
# Looks like your test exited with 255 just after 5.
t/ip_matches.t .................. 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 1/5 subtests 
t/is_new.t ...................... ok
Argument "wrong" isn't numeric in numeric ne (!=) at /Users/jimk/.cpan/build/CGI-Session-4.48-L_fw9U/blib/lib/CGI/Session.pm line 684.
t/load.t ........................ ok
t/load_with_undef.t ............. ok
        (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /usr/local/lib/perl5/5.16.0/Safe.pm line 360.

#   Failed test at t/name.t line 15.
Can't call method "name" on an undefined value at t/name.t line 24.
# Looks like you planned 14 tests but ran 4.
# Looks like you failed 1 test of 4 run.
# Looks like your test exited with 255 just after 4.
t/name.t ........................ 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 11/14 subtests 
t/new_with_undef.t .............. ok
t/parse_dsn.t ................... ok
t/remote_addr.t ................. ok
        (in cleanup) Undefined subroutine &Devel::Cover::use_file called at /usr/local/lib/perl5/5.16.0/Safe.pm line 360.

#   Failed test at t/session_param_undef.t line 52.
Can't call method "param" on an undefined value at t/session_param_undef.t line 61.
# Looks like you planned 21 tests but ran 3.
# Looks like you failed 1 test of 3 run.
# Looks like your test exited with 255 just after 3.
t/session_param_undef.t ......... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 19/21 subtests 
t/str2seconds.t ................. ok
t/symlink_db_file.t ............. ok
t/symlink_file.t ................ ok

Test Summary Report
-------------------
t/api3_db_file.t              (Wstat: 65280 Tests: 10 Failed: 1)
  Failed test:  10
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 14 tests but ran 10.
t/api3_file.t                 (Wstat: 65280 Tests: 10 Failed: 1)
  Failed test:  10
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 17 tests but ran 10.
t/api3_incr.t                 (Wstat: 65280 Tests: 10 Failed: 1)
  Failed test:  10
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 14 tests but ran 10.
t/complex_ds.t                (Wstat: 65280 Tests: 6 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 10 tests but ran 6.
t/find.t                      (Wstat: 256 Tests: 4 Failed: 1)
  Failed test:  4
  Non-zero exit status: 1
  Parse errors: Bad plan.  You planned 7 tests but ran 4.
t/g4.t                        (Wstat: 65280 Tests: 79 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 101 tests but ran 79.
t/g4_dbfile.t                 (Wstat: 65280 Tests: 79 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 101 tests but ran 79.
t/g4_sqlite.t                 (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
t/ip_matches.t                (Wstat: 65280 Tests: 5 Failed: 1)
  Failed test:  5
  Non-zero exit status: 255
t/name.t                      (Wstat: 65280 Tests: 4 Failed: 1)
  Failed test:  1
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 14 tests but ran 4.
t/session_param_undef.t       (Wstat: 65280 Tests: 3 Failed: 1)
  Failed test:  2
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 21 tests but ran 3.
Files=48, Tests=675, 240 wallclock secs ( 0.95 usr  0.58 sys + 143.83 cusr 17.03 csys = 162.39 CPU)
Result: FAIL
Failed 11/48 test programs. 7/675 subtests failed.
make: *** [test_dynamic] Error 255
Reading database from /Users/jimk/.cpan/build/CGI-Session-4.48-L_fw9U/cover_db


---------------------------- ------ ------ ------ ------ ------ ------ ------
File                           stmt   bran   cond    sub    pod   time  total
---------------------------- ------ ------ ------ ------ ------ ------ ------
blib/lib/CGI/Session.pm        77.4   68.2   51.6   84.4   79.3   53.5   72.8
...lib/CGI/Session/Driver.pm   66.7   80.0   50.0   40.0   71.4    0.2   64.4
...CGI/Session/Driver/DBI.pm   48.9   25.0   23.8   83.3   83.3    1.3   42.9
...Session/Driver/db_file.pm   82.4   50.0   50.0   88.9  100.0    4.7   72.3
...GI/Session/Driver/file.pm   91.2   58.0   40.0  100.0  100.0    1.2   78.4
.../Session/Driver/sqlite.pm   87.8   50.0   33.3  100.0  100.0    0.1   73.5
...I/Session/ErrorHandler.pm  100.0    n/a   80.0  100.0  100.0    0.1   94.3
...ib/CGI/Session/ID/incr.pm  100.0   50.0   57.1  100.0    0.0    0.0   81.5
...lib/CGI/Session/ID/md5.pm  100.0    n/a    n/a  100.0    0.0    0.1   94.1
.../CGI/Session/ID/static.pm   93.8   50.0    n/a  100.0    0.0    0.0   87.5
...sion/Serialize/default.pm   68.8   11.5    0.0  100.0  100.0    6.5   54.1
...ion/Serialize/storable.pm  100.0    n/a    n/a  100.0  100.0    0.0  100.0
...I/Session/Test/Default.pm   97.2   57.1   50.0  100.0   44.4   32.2   91.6
Total                          82.5   54.2   45.3   90.2   76.4  100.0   73.6
---------------------------- ------ ------ ------ ------ ------ ------ ------

Thank you very much.

Jim Keenan

@kemicl

This comment has been minimized.

Show comment Hide comment
@kemicl

kemicl Apr 15, 2013

Jim,
The 90actionRegistrationTest.t is just my own unit test.
Initially I thought this failure would have a bigger impact on my automated tests. I then realised that all I needed was the following,

DEVEL_COVER_OPTION=+ignore"CGI/Session\b"

The problem then goes away, as far as my automated tests are concerned!

Cheers,
Ken.

kemicl commented Apr 15, 2013

Jim,
The 90actionRegistrationTest.t is just my own unit test.
Initially I thought this failure would have a bigger impact on my automated tests. I then realised that all I needed was the following,

DEVEL_COVER_OPTION=+ignore"CGI/Session\b"

The problem then goes away, as far as my automated tests are concerned!

Cheers,
Ken.

@jkeenan

This comment has been minimized.

Show comment Hide comment
@jkeenan

jkeenan Apr 16, 2013

Contributor

kemicl, Thanks for getting back to us on this issue.

pjcj: Looks like this can be closed.

Contributor

jkeenan commented Apr 16, 2013

kemicl, Thanks for getting back to us on this issue.

pjcj: Looks like this can be closed.

@kemicl

This comment has been minimized.

Show comment Hide comment
@kemicl

kemicl Apr 16, 2013

Theres a good chance I am very wrong in the following but I'll say it anyway.

  1. Although I have a workaround for my issue don't you think another issue has been raised in that the CGI::Session package, or perhaps more specifically the Safe package, has a problem when coverage is enabled?
  2. Perhaps it could be spelled out in the package documentation that by default coverage is captured (?) for everything your code calls, apart from the default ignoring of devel::cover, and issues like my own can simply be corrected using the ignore options. I realise that if I was able to work it out then it shouldn't take others long but I would hate to think that folks in stressed situations might be put of using a very useful strategy for producing better code. I think this point is not obvious as the coverage report shows you coverage of your own packages and test scripts.
    Anyway, thanks again for having a look.

kemicl commented Apr 16, 2013

Theres a good chance I am very wrong in the following but I'll say it anyway.

  1. Although I have a workaround for my issue don't you think another issue has been raised in that the CGI::Session package, or perhaps more specifically the Safe package, has a problem when coverage is enabled?
  2. Perhaps it could be spelled out in the package documentation that by default coverage is captured (?) for everything your code calls, apart from the default ignoring of devel::cover, and issues like my own can simply be corrected using the ignore options. I realise that if I was able to work it out then it shouldn't take others long but I would hate to think that folks in stressed situations might be put of using a very useful strategy for producing better code. I think this point is not obvious as the coverage report shows you coverage of your own packages and test scripts.
    Anyway, thanks again for having a look.
@kemicl

This comment has been minimized.

Show comment Hide comment
@kemicl

kemicl Apr 29, 2013

Here's an update on my "workaround". After some changes to my testing framework my test began failing again when coverage was enabled. It turns out that the ignore settings weren't actually fixing the issue for me. I think I will need to delve into the devel::cover code to understand what the ignore actually does. Anyway, I looked at the Safe package to try and understand a bit more about why it has an issue calling the &Devel::Cover::use_file function and I found that by adding &Devel::Cover::use_file to the $default_share array then the issue is solved. I also see that they have a method to programatically add functions to this array, but this would need to be called by the package that directly uses Safe, in this case CGI::Session. So for any others out there who encounter this problem then the following quick patch to your testing environment will do the trick.
After line 88 in Safe.pm then insert the following line,
&Devel::Cover::use_file
This seems to then add the function to those available to use within the Safe compartment.
Hope that makes sense.

kemicl commented Apr 29, 2013

Here's an update on my "workaround". After some changes to my testing framework my test began failing again when coverage was enabled. It turns out that the ignore settings weren't actually fixing the issue for me. I think I will need to delve into the devel::cover code to understand what the ignore actually does. Anyway, I looked at the Safe package to try and understand a bit more about why it has an issue calling the &Devel::Cover::use_file function and I found that by adding &Devel::Cover::use_file to the $default_share array then the issue is solved. I also see that they have a method to programatically add functions to this array, but this would need to be called by the package that directly uses Safe, in this case CGI::Session. So for any others out there who encounter this problem then the following quick patch to your testing environment will do the trick.
After line 88 in Safe.pm then insert the following line,
&Devel::Cover::use_file
This seems to then add the function to those available to use within the Safe compartment.
Hope that makes sense.

@pjcj

This comment has been minimized.

Show comment Hide comment
@pjcj

pjcj Jul 17, 2013

Owner

Hello kemicl,

Thanks very much for your report and workaround.

I am sure that your solution is correct, because it is basically the same as commit 312434d200ea2a8487b21594aeb6c13838c42b0b in the perl core. More details are at https://rt.cpan.org/Public/Bug/Display.html?id=72187

So I think that upgrading from 5.10.0 could be a good solution here. 5.18.0 was the first stable release to contain this fix. (It just missed 5.16.0.) You could also just upgrade Safe.pm, I think.

This also explains why Jim's tests failed. It appears that he was using 5.16.0.

So I am going to close this as fixed, and thank you again for your report.

Owner

pjcj commented Jul 17, 2013

Hello kemicl,

Thanks very much for your report and workaround.

I am sure that your solution is correct, because it is basically the same as commit 312434d200ea2a8487b21594aeb6c13838c42b0b in the perl core. More details are at https://rt.cpan.org/Public/Bug/Display.html?id=72187

So I think that upgrading from 5.10.0 could be a good solution here. 5.18.0 was the first stable release to contain this fix. (It just missed 5.16.0.) You could also just upgrade Safe.pm, I think.

This also explains why Jim's tests failed. It appears that he was using 5.16.0.

So I am going to close this as fixed, and thank you again for your report.

@pjcj pjcj closed this Jul 17, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment