summaryrefslogtreecommitdiff
path: root/cpan/ExtUtils-Install/t/InstallWithMM.t
blob: 58ffd3eceb04873d5efc0a51f7a214c86b234e59 (plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/perl -w

# Make sure EUI works with MakeMaker

BEGIN {
    unshift @INC, 't/lib';
}

use strict;
use Config;
use ExtUtils::MakeMaker;

use Test::More;
use MakeMaker::Test::Utils;

my $make;
BEGIN {
    $make = make_run();
    if (!$make) {
	plan skip_all => "make isn't available";
    }
    else {
	plan tests => 15;
    }
}

use MakeMaker::Test::Setup::BFD;
use File::Find;
use File::Spec;
use File::Path;
use File::Temp qw[tempdir];

# Environment variables which interfere with our testing.
delete @ENV{qw(PREFIX LIB MAKEFLAGS)};

# Run Makefile.PL
{
    my $perl = which_perl();
    my $Is_VMS = $^O eq 'VMS';

    perl_lib;

    my $tmpdir = tempdir( DIR => 't', CLEANUP => 1 );
    chdir $tmpdir;

    my $Touch_Time = calibrate_mtime();

    $| = 1;

    ok( setup_recurs(), 'setup' );
    END {
        ok( chdir File::Spec->updir );
        ok( teardown_recurs(), 'teardown' );
    }

    ok( chdir('Big-Dummy'), "chdir'd to Big-Dummy" ) ||
      diag("chdir failed: $!");

    my @mpl_out = run(qq{$perl Makefile.PL "PREFIX=../dummy-install"});
    END { rmtree '../dummy-install'; }

    cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) ||
      diag(@mpl_out);

    END { unlink makefile_name(), makefile_backup() }
}


# make
{
    my $make_out = run($make);
    is( $?, 0, 'make ran ok' ) ||
      diag($make_out);
}


# Test 'make install VERBINST=1'
{
    my $make_install_verbinst = make_macro($make, 'install', VERBINST => 1);
    my $install_out = run($make_install_verbinst);
    is( $?, 0, 'install' ) || diag $install_out;
    like( $install_out, qr/^Installing /m );
    like( $install_out, qr/^Writing /m );

    ok( -r '../dummy-install',     '  install dir created' );
    my %files = ();
    find( sub {
              # do it case-insensitive for non-case preserving OSs
              my $file = lc $_;

              # VMS likes to put dots on the end of things that don't have them.
              $file =~ s/\.$// if $Is_VMS;

              $files{$file} = $File::Find::name;
          }, '../dummy-install' );
    ok( $files{'dummy.pm'},     '  Dummy.pm installed' );
    ok( $files{'liar.pm'},      '  Liar.pm installed'  );
    ok( $files{'program'},      '  program installed'  );
    ok( $files{'.packlist'},    '  packlist created'   );
    ok( $files{'perllocal.pod'},'  perllocal.pod created' );
}