From: Peter Rabbitson Date: Wed, 11 Apr 2012 07:13:01 +0000 (+0200) Subject: No longer depend on MI::AuthorTests. Switch xt tests to run on make dist X-Git-Tag: v0.08197~41 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=commitdiff_plain;h=20884f55ed03738633c1cf2a1f8d43af743b650e No longer depend on MI::AuthorTests. Switch xt tests to run on make dist --- diff --git a/maint/Makefile.PL.inc/11_authortests.pl b/maint/Makefile.PL.inc/11_authortests.pl index b8f00b4..3b9c174 100644 --- a/maint/Makefile.PL.inc/11_authortests.pl +++ b/maint/Makefile.PL.inc/11_authortests.pl @@ -1,22 +1,31 @@ -# temporary(?) until I get around to fix M::I wrt xt/ -# needs Module::Install::AuthorTests -eval { - # this should not be necessary since the autoloader is supposed - # to work, but there were reports of it failing - require Module::Install::AuthorTests; - recursive_author_tests (qw/xt/); - 1; -} || do { - if (! $args->{skip_author_deps}) { - my $err = $@; - - # better error message in case of missing dep - eval { require Module::Install::AuthorTests } - || die "\nYou need Module::Install::AuthorTests installed to run this Makefile.PL in author mode (or add --skip-author-deps):\n\n$@\n"; - - die $err; - } -}; +require File::Spec; +require File::Find; + +my $xt_dirs; +File::Find::find(sub { + return if $xt_dirs->{$File::Find::dir}; + $xt_dirs->{$File::Find::dir} = 1 if ( + $_ =~ /\.t$/ and -f $_ + ); +}, 'xt'); + +my $xt_tests = join (' ', map { File::Spec->catfile($_, '*.t') } sort keys %$xt_dirs ); + +# this will add the xt tests to the `make test` target among other things +Meta->tests(join (' ', map { $_ || () } Meta->tests, $xt_tests ) ); + +# inject an explicit xt test run for making a tarball (distdir is exempt) +postamble <<"EOP"; + +.PHONY: test_xt + +dist : test_xt + +test_xt : +\tPERL_DL_NONLAZY=1 RELEASE_TESTING=1 \$(FULLPERLRUN) "-MExtUtils::Command::MM" "-e" "test_harness(\$(TEST_VERBOSE), 'inc', '\$(INST_LIB)', '\$(INST_ARCHLIB)')" $xt_tests + +EOP + # keep the Makefile.PL eval happy 1; diff --git a/xt/eol.t b/xt/eol.t index a3d7d86..ab2d9a1 100644 --- a/xt/eol.t +++ b/xt/eol.t @@ -8,7 +8,7 @@ use DBICTest; require DBIx::Class; unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_eol') ) { my $missing = DBIx::Class::Optional::Dependencies->req_missing_for ('test_eol'); - (! DBICTest::RunMode->is_plain && ! DBICTest::RunMode->is_smoker ) + $ENV{RELEASE_TESTING} ? die ("Failed to load release-testing module requirements: $missing") : plan skip_all => "Test needs: $missing" } diff --git a/xt/notabs.t b/xt/notabs.t index beb623e..7734b75 100644 --- a/xt/notabs.t +++ b/xt/notabs.t @@ -8,7 +8,7 @@ use DBICTest; require DBIx::Class; unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_notabs') ) { my $missing = DBIx::Class::Optional::Dependencies->req_missing_for ('test_notabs'); - (! DBICTest::RunMode->is_plain && ! DBICTest::RunMode->is_smoker ) + $ENV{RELEASE_TESTING} ? die ("Failed to load release-testing module requirements: $missing") : plan skip_all => "Test needs: $missing" } diff --git a/xt/pod.t b/xt/pod.t index d1a6210..92d650e 100644 --- a/xt/pod.t +++ b/xt/pod.t @@ -8,7 +8,7 @@ use DBICTest; require DBIx::Class; unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_pod') ) { my $missing = DBIx::Class::Optional::Dependencies->req_missing_for ('test_pod'); - (! DBICTest::RunMode->is_plain && ! DBICTest::RunMode->is_smoker ) + $ENV{RELEASE_TESTING} ? die ("Failed to load release-testing module requirements: $missing") : plan skip_all => "Test needs: $missing" } diff --git a/xt/podcoverage.t b/xt/podcoverage.t index 2cd6c52..a5c923f 100644 --- a/xt/podcoverage.t +++ b/xt/podcoverage.t @@ -10,7 +10,7 @@ use namespace::clean; require DBIx::Class; unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_podcoverage') ) { my $missing = DBIx::Class::Optional::Dependencies->req_missing_for ('test_podcoverage'); - $ENV{RELEASE_TESTING} || DBICTest::RunMode->is_author + $ENV{RELEASE_TESTING} ? die ("Failed to load release-testing module requirements: $missing") : plan skip_all => "Test needs: $missing" }