Reign in (a little bit) the sprawling CRLF insanity on Win32
[dbsrgits/DBIx-Class.git] / maint / Makefile.PL.inc / 11_authortests.pl
CommitLineData
20884f55 1require File::Spec;
2require File::Find;
3
4my $xt_dirs;
5File::Find::find(sub {
6 return if $xt_dirs->{$File::Find::dir};
7 $xt_dirs->{$File::Find::dir} = 1 if (
8 $_ =~ /\.t$/ and -f $_
9 );
10}, 'xt');
11
3ba58fe4 12my @xt_tests = map { File::Spec->catfile($_, '*.t') } sort keys %$xt_dirs;
20884f55 13
14# this will add the xt tests to the `make test` target among other things
3ba58fe4 15Meta->tests(join (' ', map { $_ || () } Meta->tests, @xt_tests ) );
20884f55 16
e2633789 17# inject an explicit xt test run, mainly to check the contents of
18# lib and the generated POD's *before* anything is copied around
ffce4b65 19#
20# at the end rerun the whitespace test in the distdir, to make sure everything
21# is pristine
20884f55 22postamble <<"EOP";
23
e2633789 24dbic_clonedir_copy_generated_pod : test_xt
20884f55 25
3ba58fe4 26test_xt : pm_to_blib
27@{[
28 # When xt tests are explicitly requested, we want to run with RELEASE_TESTING=1
29 # so that all optdeps are turned into a hard failure
30 # However portably modifying ENV for a single command is surprisingly hard
31 # So instead we (ab)use perl's ability to stack -e options, and simply modify
32 # the ENV from within perl itself
33 $mm_proto->test_via_harness(
34 # perl cmd
35 join( ' ',
36 '$(ABSPERLRUN)',
ffce4b65 37 map { $mm_proto->quote_literal($_) } qw(-e $ENV{RELEASE_TESTING}=1;)
3ba58fe4 38 ),
39 # test list
40 join( ' ',
41 map { $mm_proto->quote_literal($_) } @xt_tests
42 ),
43 )
44]}
20884f55 45
ffce4b65 46create_distdir : dbic_distdir_retest_whitespace
47
48dbic_distdir_retest_whitespace :
49\t@{[
50 $mm_proto->cd (
51 '$(DISTVNAME)',
52 $mm_proto->test_via_harness(
53 # perl cmd
54 join( ' ',
55 '$(ABSPERLRUN)',
56 map { $mm_proto->quote_literal($_) } qw(-Ilib -e $ENV{RELEASE_TESTING}=1;$ENV{DBICTEST_NO_MAKEFILE_VERIFICATION}=1;)
57 ),
58 'xt/whitespace.t'
59 )
60 )
61]}
62
20884f55 63EOP
64
fc4b0448 65# keep the Makefile.PL eval happy
661;