82dee7de92a0bd35 failed to add ext/lib/Makefile.PL. Oops.
[p5sagit/p5-mst-13.2.git] / ext / ExtUtils-MakeMaker / t / INSTALL_BASE.t
1 #!/usr/bin/perl -w
2
3 # Tests INSTALL_BASE
4
5 BEGIN {
6     unshift @INC, 't/lib';
7 }
8
9 use strict;
10 use File::Path;
11 use Config;
12
13 use Test::More tests => 20;
14 use MakeMaker::Test::Utils;
15 use MakeMaker::Test::Setup::BFD;
16
17 my $Is_VMS = $^O eq 'VMS';
18
19 my $perl = which_perl();
20
21 chdir 't';
22 perl_lib;
23
24 ok( setup_recurs(), 'setup' );
25 END {
26     ok( chdir File::Spec->updir );
27     ok( teardown_recurs(), 'teardown' );
28 }
29
30 ok( chdir('Big-Dummy'), "chdir'd to Big-Dummy") || diag("chdir failed; $!");
31
32 my @mpl_out = run(qq{$perl Makefile.PL "INSTALL_BASE=../dummy-install"});
33 END { rmtree '../dummy-install'; }
34
35 cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) ||
36   diag(@mpl_out);
37
38 my $makefile = makefile_name();
39 ok( grep(/^Writing $makefile for Big::Dummy/, 
40          @mpl_out) == 1,
41                                            'Makefile.PL output looks right');
42
43 my $make = make_run();
44 run("$make");   # this is necessary due to a dmake bug.
45 my $install_out = run("$make install");
46 is( $?, 0, '  make install exited normally' ) || diag $install_out;
47 like( $install_out, qr/^Installing /m );
48
49 ok( -r '../dummy-install',      '  install dir created' );
50
51 my @installed_files = 
52   ('../dummy-install/lib/perl5/Big/Dummy.pm',
53    '../dummy-install/lib/perl5/Big/Liar.pm',
54    '../dummy-install/bin/program',
55    "../dummy-install/lib/perl5/$Config{archname}/perllocal.pod",
56    "../dummy-install/lib/perl5/$Config{archname}/auto/Big/Dummy/.packlist"
57   );
58
59 foreach my $file (@installed_files) {
60     ok( -e $file, "  $file installed" );
61     ok( -r $file, "  $file readable" );
62 }
63
64
65 # nmake outputs its damned logo
66 # Send STDERR off to oblivion.
67 open(SAVERR, ">&STDERR") or die $!;
68 open(STDERR, ">".File::Spec->devnull) or die $!;
69
70 my $realclean_out = run("$make realclean");
71 is( $?, 0, 'realclean' ) || diag($realclean_out);
72
73 open(STDERR, ">&SAVERR") or die $!;
74 close SAVERR;