1#!/usr/bin/perl -w
2
3# Tests INSTALL_BASE
4
5BEGIN {
6    unshift @INC, 't/lib';
7}
8
9use strict;
10use File::Path;
11use Config;
12
13use Test::More tests => 20;
14use MakeMaker::Test::Utils;
15use MakeMaker::Test::Setup::BFD;
16
17my $Is_VMS = $^O eq 'VMS';
18
19my $perl = which_perl();
20
21chdir 't';
22perl_lib;
23
24ok( setup_recurs(), 'setup' );
25END {
26    ok( chdir File::Spec->updir );
27    ok( teardown_recurs(), 'teardown' );
28}
29
30ok( chdir('Big-Dummy'), "chdir'd to Big-Dummy") || diag("chdir failed; $!");
31
32my @mpl_out = run(qq{$perl Makefile.PL "INSTALL_BASE=../dummy-install"});
33END { rmtree '../dummy-install'; }
34
35cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) ||
36  diag(@mpl_out);
37
38my $makefile = makefile_name();
39ok( grep(/^Writing $makefile for Big::Dummy/,
40         @mpl_out) == 1,
41                                           'Makefile.PL output looks right');
42
43my $make = make_run();
44run("$make");   # this is necessary due to a dmake bug.
45my $install_out = run("$make install");
46is( $?, 0, '  make install exited normally' ) || diag $install_out;
47like( $install_out, qr/^Installing /m );
48
49ok( -r '../dummy-install',      '  install dir created' );
50
51my @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
59foreach 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.
67open(SAVERR, ">&STDERR") or die $!;
68open(STDERR, ">".File::Spec->devnull) or die $!;
69
70my $realclean_out = run("$make realclean");
71is( $?, 0, 'realclean' ) || diag($realclean_out);
72
73open(STDERR, ">&SAVERR") or die $!;
74close SAVERR;
75