cleanup the EUI/EUMM test mess, and bump Install.pm to 1.54
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / InstallWithMM.t
1 #!/usr/bin/perl -w
2
3 # Make sure EUI works with MakeMaker
4
5 BEGIN {
6     if( $ENV{PERL_CORE} ) {
7         chdir 't' if -d 't';
8         @INC = ('../lib', 'lib');
9     }
10     else {
11         unshift @INC, 't/lib';
12     }
13 }
14
15 use strict;
16 use Config;
17 use ExtUtils::MakeMaker;
18
19 use Test::More tests => 15;
20 use MakeMaker::Test::Utils;
21 use MakeMaker::Test::Setup::BFD;
22 use File::Find;
23 use File::Spec;
24 use File::Path;
25
26 my $make = make_run();
27
28 # Environment variables which interfere with our testing.
29 delete @ENV{qw(PREFIX LIB MAKEFLAGS)};
30
31 # Run Makefile.PL
32 {
33     my $perl = which_perl();
34     my $Is_VMS = $^O eq 'VMS';
35
36     chdir 't';
37
38     perl_lib;
39
40     my $Touch_Time = calibrate_mtime();
41
42     $| = 1;
43
44     ok( setup_recurs(), 'setup' );
45     END {
46         ok( chdir File::Spec->updir );
47         ok( teardown_recurs(), 'teardown' );
48     }
49
50     ok( chdir('Big-Dummy'), "chdir'd to Big-Dummy" ) ||
51       diag("chdir failed: $!");
52
53     my @mpl_out = run(qq{$perl Makefile.PL "PREFIX=../dummy-install"});
54     END { rmtree '../dummy-install'; }
55
56     cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) ||
57       diag(@mpl_out);
58
59     END { unlink makefile_name(), makefile_backup() }
60 }
61
62
63 # make
64 {
65     my $make_out = run($make);
66     is( $?, 0, 'make ran ok' ) ||
67       diag($make_out);
68 }
69
70
71 # Test 'make install VERBINST=1'
72 {
73     my $make_install_verbinst = make_macro($make, 'install', VERBINST => 1);
74     my $install_out = run($make_install_verbinst);
75     is( $?, 0, 'install' ) || diag $install_out;
76     like( $install_out, qr/^Installing /m );
77     like( $install_out, qr/^Writing /m );
78
79     ok( -r '../dummy-install',     '  install dir created' );
80     my %files = ();
81     find( sub {
82               # do it case-insensitive for non-case preserving OSs
83               my $file = lc $_;
84
85               # VMS likes to put dots on the end of things that don't have them.
86               $file =~ s/\.$// if $Is_VMS;
87
88               $files{$file} = $File::Find::name;
89           }, '../dummy-install' );
90     ok( $files{'dummy.pm'},     '  Dummy.pm installed' );
91     ok( $files{'liar.pm'},      '  Liar.pm installed'  );
92     ok( $files{'program'},      '  program installed'  );
93     ok( $files{'.packlist'},    '  packlist created'   );
94     ok( $files{'perllocal.pod'},'  perllocal.pod created' );
95 }