#! perl -w
use strict;
-use Test::More tests => 58;
-BEGIN {
- if ($^O eq 'VMS') {
- # So we can get the return value of system()
- require vmsish;
- import vmsish;
- }
-}
+use Test::More tests => 50;
use Config;
use Cwd;
use File::Path qw( mkpath );
use File::Temp qw( tempdir );
use ExtUtils::CBuilder::Base;
+## N.B. There are pretty severe limits on what can portably be tested
+## in the base class. Specifically, don't do anything that will send
+## actual compile and link commands to the shell as that won't work
+## without the platform-specific overrides.
+
# XXX protect from user CC as we mock everything here
local $ENV{CC};
"object_file(): got expected automatically assigned name for object file"
);
-SKIP:
-{
- skip "Base can't do real compile and link on VMS", 2
- if $^O eq 'VMS';
-
- # object filename explicitly assigned
- $object_file = File::Spec->catfile('t', 'my_special_compilet.o' );
- is( $object_file,
- $base->compile(
- source => $source_file,
- object_file => $object_file,
- ),
- "compile(): returned object file with specified name"
- );
-
- $lib_file = $base->lib_file($object_file);
- ok( $lib_file, "lib_file() returned true value" );
-}
-
my ($lib, @temps);
-SKIP:
-{
- skip "Base can't link on Win32 or VMS", 4
- if $^O eq "MSWin32" || $^O eq "VMS";
- ($lib, @temps) = $base->link(
- objects => $object_file,
- module_name => 'compilet',
- );
- $lib =~ tr/"'//d; #"
- is($lib_file, $lib, "lib_file(): got expected value for $lib");
-
- ($lib, @temps) = $base->link(
- objects => [ $object_file ],
- module_name => 'compilet',
- );
- $lib =~ tr/"'//d; #"
- is($lib_file, $lib, "lib_file(): got expected value for $lib");
-
- ($lib, @temps) = $base->link(
- lib_file => $lib_file,
- objects => [ $object_file ],
- module_name => 'compilet',
- );
- $lib =~ tr/"'//d; #"
- is($lib_file, $lib, "lib_file(): got expected value for $lib");
-
- $lib = $base->link(
- objects => $object_file,
- module_name => 'compilet',
- );
- $lib =~ tr/"'//d; #"
- is($lib_file, $lib, "lib_file(): got expected value for $lib");
-}
{
$source_file = File::Spec->catfile('t', 'compilet.c');
create_c_source_file($source_file);
ok(-e $source_file, "source file '$source_file' created");
-SKIP:
-{
- skip "Base can't do real compile and link on VMS", 2
- if $^O eq 'VMS';
-
- $object_file = File::Spec->catfile('t', 'my_special_compilet.o' );
- is( $object_file,
- $base->compile(
- source => $source_file,
- object_file => $object_file,
- defines => { alpha => 'beta', gamma => 'delta' },
- ),
- "compile() completed when 'defines' provided; returned object file with specified name"
- );
-
- my $exe_file = $base->exe_file($object_file);
- my $ext = $base->{config}{_exe};
- my $expected = File::Spec->catfile('t', qq|my_special_compilet$ext| );
- is(
- $exe_file,
- $expected,
- "exe_file(): returned expected name of executable"
- );
-}
my %args = ();
my @defines = $base->arg_defines( %args );