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