Subject: | _WORK_AROUND_BROKEN_MODULE_STATE fix in 0.012 breaks the Class::Load test suite with Perl < 5.10 |
After upgrading Module::Runtime to 0.12, I found that the Class::Load
test suite failed on perl < 5.10 (well, it passed on 5.10.0 and failed
on 5.8.8 and anything earlier I tried), like this:
$ make test RELEASE_TESTING=1
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/000-load......................# Using PP implementation
ok
t/001-is-class-loaded...........ok
t/002-try-load-class............ok
t/003-load-class................ok
t/004-load-double...............ok
t/005-load-optional.............
# Failed test 'Loading a broken class breaks'
# at t/005-load-optional.t line 31.
# undef
# ne
# undef
# Looks like you failed 1 test of 8.
dubious
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 3
Failed 1/8 tests, 87.50% okay
t/006-returned-error............ok
t/007-first-existing............ok
t/008-gvstash-bug...............ok
t/009-invalid-module-name.......ok
t/010-isa-false-positive........
# Failed test 'Class which calls die is reported as an error'
# at t/010-isa-false-positive.t line 17.
# undef
# ne
# undef
# Failed test 'Class populates @ISA in BEGIN then dies - error on load'
# at t/010-isa-false-positive.t line 38.
# undef
# ne
# undef
# Failed test 'Class with a syntax error causes an error'
# at t/010-isa-false-positive.t line 59.
# undef
# ne
# undef
# Failed test 'Class with a syntax error causes an error (second attempt)'
# at t/010-isa-false-positive.t line 67.
# undef
# ne
# undef
# Looks like you failed 4 tests of 6.
dubious
Test returned status 4 (wstat 1024, 0x400)
DIED. FAILED tests 1, 3, 5-6
Failed 4/6 tests, 33.33% okay
t/011-without-xs................ok
t/012-without-implementation....ok
t/release-cpan-changes..........skipped
all skipped: Test::CPAN::Changes required for this test
t/release-eol...................ok
t/release-no-tabs...............ok
t/release-pod-coverage..........ok
t/release-pod-linkcheck.........skipped
all skipped: Test::Pod::LinkCheck required for testing POD
t/release-pod-no404s............skipped
all skipped: Test::Pod::No404s required for testing POD
t/release-pod-spell.............ok
t/release-pod-syntax............ok
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
t/005-load-optional.t 1 256 8 1 12.50% 3
t/010-isa-false-positive.t 4 1024 6 4 66.67% 1 3 5-6
3 tests skipped.
Failed 2/21 test scripts, 90.48% okay. 5/187 subtests failed, 97.33% okay.
Now all of these failing tests are doing isnt(exception{...},undef),
which Test::Fatal has just been updated to warn against doing, bit they
do still work with 0.012 on more recent perls.
I tried reverting bits of the Module::Runtime changes to figure out what
had triggered this breakage, and making this change got the Class::Load
test suite working again:
--- Module-Runtime/lib/Module/Runtime.pm
+++ Module-Runtime/lib/Module/Runtime.pm
@@ -306,16 +306,7 @@
# %^H state leaking into each required module, polluting the
# module's lexical state.
local %^H if _WORK_AROUND_HINT_LEAKAGE;
- if(_WORK_AROUND_BROKEN_MODULE_STATE) {
- my $notional_filename = &module_notional_filename;
- my $guard = bless([ $notional_filename ],
- "Module::Runtime::__GUARD__");
- my $result = require($notional_filename);
- pop @$guard;
- return $result;
- } else {
- return scalar(require(&module_notional_filename));
- }
+ return scalar(require(&module_notional_filename));
}
=back
However, this of course broke the Module::Runtime test suite, which is
checking that these changes are in place. I'm now out of my depth and
dn't know how best to proceed. Is this an actual Module::Runtime bug or
would it be better to get the Class::Load test suite fixed?