| 1 | #!/usr/bin/perl -w
|
|---|
| 2 |
|
|---|
| 3 | # Tests INSTALLBASE
|
|---|
| 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 File::Path;
|
|---|
| 17 | use Config;
|
|---|
| 18 |
|
|---|
| 19 | use Test::More tests => 21;
|
|---|
| 20 | use MakeMaker::Test::Utils;
|
|---|
| 21 | use MakeMaker::Test::Setup::BFD;
|
|---|
| 22 |
|
|---|
| 23 | my $Is_VMS = $^O eq 'VMS';
|
|---|
| 24 |
|
|---|
| 25 | my $perl = which_perl();
|
|---|
| 26 |
|
|---|
| 27 | chdir 't';
|
|---|
| 28 | perl_lib;
|
|---|
| 29 |
|
|---|
| 30 | ok( setup_recurs(), 'setup' );
|
|---|
| 31 | END {
|
|---|
| 32 | ok( chdir File::Spec->updir );
|
|---|
| 33 | ok( teardown_recurs(), 'teardown' );
|
|---|
| 34 | }
|
|---|
| 35 |
|
|---|
| 36 | ok( chdir('Big-Dummy'), "chdir'd to Big-Dummy") || diag("chdir failed; $!");
|
|---|
| 37 |
|
|---|
| 38 | my @mpl_out = run(qq{$perl Makefile.PL "INSTALLBASE=../dummy-install"});
|
|---|
| 39 | END { rmtree '../dummy-install'; }
|
|---|
| 40 |
|
|---|
| 41 | cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) ||
|
|---|
| 42 | diag(@mpl_out);
|
|---|
| 43 |
|
|---|
| 44 | my $makefile = makefile_name();
|
|---|
| 45 | ok( grep(/^Writing $makefile for Big::Dummy/,
|
|---|
| 46 | @mpl_out) == 1,
|
|---|
| 47 | 'Makefile.PL output looks right');
|
|---|
| 48 |
|
|---|
| 49 | my $make = make_run();
|
|---|
| 50 | run("$make"); # this is necessary due to a dmake bug.
|
|---|
| 51 | my $install_out = run("$make install");
|
|---|
| 52 | is( $?, 0, ' make install exited normally' ) || diag $install_out;
|
|---|
| 53 | like( $install_out, qr/^Installing /m );
|
|---|
| 54 | like( $install_out, qr/^Writing /m );
|
|---|
| 55 |
|
|---|
| 56 | ok( -r '../dummy-install', ' install dir created' );
|
|---|
| 57 |
|
|---|
| 58 | my @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 |
|
|---|
| 66 | foreach 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.
|
|---|
| 74 | open(SAVERR, ">&STDERR") or die $!;
|
|---|
| 75 | open(STDERR, ">".File::Spec->devnull) or die $!;
|
|---|
| 76 |
|
|---|
| 77 | my $realclean_out = run("$make realclean");
|
|---|
| 78 | is( $?, 0, 'realclean' ) || diag($realclean_out);
|
|---|
| 79 |
|
|---|
| 80 | open(STDERR, ">&SAVERR") or die $!;
|
|---|
| 81 | close SAVERR;
|
|---|