File: 11_authortests.pl

package info (click to toggle)
libdbix-class-perl 0.082844-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,320 kB
  • sloc: perl: 27,215; sql: 322; sh: 29; makefile: 16
file content (66 lines) | stat: -rw-r--r-- 1,838 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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 = 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 { $_ || () } @xt_tests, Meta->tests ) );

# inject an explicit xt test run, mainly to check the contents of
# lib and the generated POD's *before* anything is copied around
#
# at the end rerun the whitespace and footer tests in the distdir
# to make sure everything is pristine
postamble <<"EOP";

dbic_clonedir_copy_generated_pod : test_xt

test_xt : pm_to_blib
@{[
  # When xt tests are explicitly requested, we want to run with RELEASE_TESTING=1
  # so that all optdeps are turned into a hard failure
  # However portably modifying ENV for a single command is surprisingly hard
  # So instead we (ab)use perl's ability to stack -e options, and simply modify
  # the ENV from within perl itself
  $mm_proto->test_via_harness(
    # perl cmd
    join( ' ',
      '$(ABSPERLRUN)',
      map { $mm_proto->quote_literal($_) } qw(-e $ENV{RELEASE_TESTING}=1;$ENV{DBICTEST_NO_MAKEFILE_VERIFICATION}=1;)
    ),
    # test list
    join( ' ',
      map { $mm_proto->quote_literal($_) } @xt_tests
    ),
  )
]}

create_distdir : dbic_distdir_retest_ws_and_footers

dbic_distdir_retest_ws_and_footers :
\t@{[
  $mm_proto->cd (
    '$(DISTVNAME)',
    $mm_proto->test_via_harness(
      # perl cmd
      join( ' ',
        '$(ABSPERLRUN)',
        map { $mm_proto->quote_literal($_) } qw(-Ilib -e $ENV{RELEASE_TESTING}=1;$ENV{DBICTEST_NO_MAKEFILE_VERIFICATION}=1;)
      ),
      'xt/whitespace.t xt/footers.t',
    )
  )
]}

EOP

# keep the Makefile.PL eval happy
1;