Skip Menu |

This queue is for tickets about the Module-Build CPAN distribution.

Report information
The Basics
Id: 39171
Status: resolved
Priority: 0/
Queue: Module-Build

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.2808
Fixed in: (no value)



Subject: Module::Build::Compat and recursive_test_files
If there are recursive_test_files is specified in Build.PL, then the generated Makefile.PL should have a corresponding entry like TESTS => 't/*.t t/*/*.t ...' I just discovered that only two tests were run for the CPAN distribution DBD-PO-0.07 when using Makefile.PL, but a lot more if using Build.PL. Regards, Slaven
This bug still exists with the latest M::B. I've attached a patch that seems to fix it, along with a test.
Index: t/compat.t =================================================================== --- t/compat.t (revision 12867) +++ t/compat.t (working copy) @@ -270,6 +270,21 @@ ok ! -e 'Makefile.PL', "Makefile.PL cleaned up"; } +{ + $dist->add_file('t/deep/foo.t', q{}); + $dist->regen; + + my $mb; + stdout_of( sub { + $mb = Module::Build->new_from_context( recursive_test_files => 1 ); + }); + + create_makefile_pl('traditional', $mb); + my $args = extract_writemakefile_args() || {}; + is $args->{TESTS}, 't/*.t t/deep/*.t', + 'Makefile.PL has correct TESTS line for recursive test files'; +} + # cleanup $dist->remove; Index: lib/Module/Build/Compat.pm =================================================================== --- lib/Module/Build/Compat.pm (revision 12867) +++ lib/Module/Build/Compat.pm (working copy) @@ -4,6 +4,7 @@ use vars qw($VERSION); $VERSION = '0.33_03'; +use File::Basename (); use File::Spec; use IO::File; use Config; @@ -178,7 +179,7 @@ %prereq = ( %{$build->requires}, %{$build->build_requires} ); %prereq = map {$_, $prereq{$_}} sort keys %prereq; - delete $prereq{perl}; + delete $prereq{perl}; $MM_Args{PREREQ_PM} = \%prereq; $MM_Args{INSTALLDIRS} = $build->installdirs eq 'core' ? 'perl' : $build->installdirs; @@ -186,7 +187,11 @@ $MM_Args{EXE_FILES} = [ sort keys %{$build->script_files} ] if $build->script_files; $MM_Args{PL_FILES} = $build->PL_files || {}; - + + if ($build->recursive_test_files) { + $MM_Args{TESTS} = join q{ }, $package->_test_globs($build); + } + local $Data::Dumper::Terse = 1; my $args = Data::Dumper::Dumper(\%MM_Args); $args =~ s/\{(.*)\}/($1)/s; @@ -199,7 +204,13 @@ } } +sub _test_globs { + my ($self, $build) = @_; + return map { File::Spec->catfile($_, '*.t') } + @{$build->rscan_dir('t', sub { -d $File::Find::name })}; +} + sub subclass_dir { my ($self, $build) = @_;
Awesome. Thank you. Applied in trunk.