summaryrefslogtreecommitdiff
path: root/lib/ExtUtils/t/INSTALL_BASE.t
blob: 444276263e2f125f30b02ed2511eeab3684e1c60 (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
#!/usr/bin/perl -w

# Tests INSTALL_BASE

BEGIN {
    if( $ENV{PERL_CORE} ) {
        chdir 't' if -d 't';
        @INC = ('../lib', 'lib');
    }
    else {
        unshift @INC, 't/lib';
    }
}

use strict;
use File::Path;
use Config;

use Test::More tests => 21;
use MakeMaker::Test::Utils;
use MakeMaker::Test::Setup::BFD;

my $Is_VMS = $^O eq 'VMS';

my $perl = which_perl();

chdir 't';
perl_lib;

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 "INSTALL_BASE=../dummy-install"});
END { rmtree '../dummy-install'; }

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

my $makefile = makefile_name();
ok( grep(/^Writing $makefile for Big::Dummy/, 
         @mpl_out) == 1,
                                           'Makefile.PL output looks right');

my $make = make_run();
run("$make");   # this is necessary due to a dmake bug.
# 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 @installed_files = 
  ('../dummy-install/lib/perl5/Big/Dummy.pm',
   '../dummy-install/lib/perl5/Big/Liar.pm',
   '../dummy-install/bin/program',
   "../dummy-install/lib/perl5/$Config{archname}/perllocal.pod",
   "../dummy-install/lib/perl5/$Config{archname}/auto/Big/Dummy/.packlist"
  );

foreach my $file (@installed_files) {
    ok( -e $file, "  $file installed" );
    ok( -r $file, "  $file readable" );
}


# nmake outputs its damned logo
# Send STDERR off to oblivion.
open(SAVERR, ">&STDERR") or die $!;
open(STDERR, ">".File::Spec->devnull) or die $!;

my $realclean_out = run("$make realclean");
is( $?, 0, 'realclean' ) || diag($realclean_out);

open(STDERR, ">&SAVERR") or die $!;
close SAVERR;