More robust behavior of ANFANG.pm, also guard against sitecustomize.pl
[dbsrgits/DBIx-Class.git] / maint / Makefile.PL.inc / 11_authortests.pl
1 require File::Find;
2
3 my $xt_dist_dirs;
4 File::Find::find(sub {
5   return if $xt_dist_dirs->{$File::Find::dir};
6   $xt_dist_dirs->{$File::Find::dir} = 1 if (
7     $_ =~ /\.t$/ and -f $_
8   );
9 }, 'xt/dist');
10
11 my @xt_dist_tests = map { "$_/*.t" } sort keys %$xt_dist_dirs;
12
13 # inject an explicit xt test run, mainly to check the contents of
14 # lib and the generated POD's *before* anything is copied around
15 #
16 # at the end rerun the whitespace and footer tests in the distdir
17 # to make sure everything is pristine
18 postamble <<"EOP";
19
20 dbic_clonedir_copy_generated_pod : test_xt
21
22 test_xt : pm_to_blib
23 @{[
24   # When xt tests are explicitly requested, we want to run with RELEASE_TESTING=1
25   # so that all optdeps are turned into a hard failure
26   # However portably modifying ENV for a single command is surprisingly hard
27   # So instead we (ab)use perl's ability to stack -e options, and simply modify
28   # the ENV from within perl itself
29   $mm_proto->test_via_harness(
30     # perl cmd
31     join( ' ',
32       '$(ABSPERLRUN)',
33       map { $mm_proto->quote_literal($_) } qw(-e $ENV{RELEASE_TESTING}=1;$ENV{HARNESS_OPTIONS}=j4;)
34     ),
35     # test list
36     join( ' ',
37       map { $mm_proto->quote_literal($_) } @xt_dist_tests
38     ),
39   )
40 ]}
41
42 create_distdir : dbic_distdir_retest_ws_and_footers
43
44 dbic_distdir_retest_ws_and_footers :
45 \t@{[
46   $mm_proto->cd (
47     '$(DISTVNAME)',
48     $mm_proto->test_via_harness(
49       # perl cmd
50       join( ' ',
51         '$(ABSPERLRUN)',
52         map { $mm_proto->quote_literal($_) } qw(-Ilib -e $ENV{RELEASE_TESTING}=1;$ENV{HARNESS_OPTIONS}=j4;)
53       ),
54       'xt/dist/postdistdir/*.t',
55     )
56   )
57 ]}
58
59 EOP
60
61 # keep the Makefile.PL eval happy
62 1;