summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorgregor herrmann <gregoa@debian.org>2022-05-07 20:46:02 +0200
committergregor herrmann <gregoa@debian.org>2022-05-07 20:46:02 +0200
commita1d39bf853e20805af41cf9de4205611dd372626 (patch)
tree922944217f8fcae2c353f0b19d09e58b8c893a36 /t
parentcbcab4aaf385d75640e976f304e3a9974547e3a9 (diff)
New upstream version 1.16
Diffstat (limited to 't')
-rw-r--r--t/exit_with_message.t2
-rw-r--r--t/lib/Helper.pm24
-rw-r--r--t/multi-word-compiler.t9
3 files changed, 21 insertions, 14 deletions
diff --git a/t/exit_with_message.t b/t/exit_with_message.t
index 67daae1..b79d207 100644
--- a/t/exit_with_message.t
+++ b/t/exit_with_message.t
@@ -12,7 +12,7 @@ check_lib_or_exit( qw/lib hlagh/ );
ENDPRINT
$fh->close;
-my $err = `$^X $fh 2>&1`;
+my $err = `"$^X" $fh 2>&1`;
if($err =~ /Couldn't find your C compiler/) {
plan skip_all => "Couldn't find your C compiler";
diff --git a/t/lib/Helper.pm b/t/lib/Helper.pm
index f298c71..ca08b35 100644
--- a/t/lib/Helper.pm
+++ b/t/lib/Helper.pm
@@ -43,7 +43,7 @@ sub create_testlib {
print {$code_fh} "int libversion() { return 42; }\nint foo() { return 0; }\n";
$code_fh->close;
- my $cc = $Config{cc};
+ my $cc = (split(/\s+/, $Config{cc}))[0];
my $gccv = $Config{gccversion};
my $rv =
$cc eq 'gcc' ? _gcc_lib( $libname ) :
@@ -62,20 +62,19 @@ sub _gcc_lib {
my $ar = find_binary('ar') or return;
my $ranlib = find_binary('ranlib') or return;
my $ccflags = $Config{ccflags};
-
- _quiet_system("$cc $ccflags -c ${libname}.c") and return;
- _quiet_system("$ar rc lib${libname}.a ${libname}.o") and return;
- _quiet_system("$ranlib lib${libname}.a") and return;
- return -f "lib${libname}.a"
+ my $libfile = "lib${libname}.a";
+ _quiet_system(qq{"$cc" $ccflags -c ${libname}.c}) and return;
+ _quiet_system($ar, 'rc', $libfile, "${libname}$Config{_o}") and return;
+ _quiet_system($ranlib, $libfile) and return;
+ return -f $libfile
}
sub _cl_lib {
my ($libname) = @_;
my $cc = find_compiler() or return;
my $ar = find_binary('lib') or return;
-
_quiet_system($cc, '/c', "${libname}.c") and return;
- _quiet_system($ar, "${libname}.obj") and return;
+ _quiet_system($ar, "${libname}$Config{_o}") and return;
return -f "${libname}.lib";
}
@@ -115,7 +114,14 @@ sub lib_to_bin {
}
sub find_compiler {
- return find_binary($Config{cc});
+ my $result = find_binary($Config{cc});
+ return $result if($result);
+
+ # sometimes $Config{cc} isn't very clean eg it can be 'cc -q32' on AIX
+ return find_binary((split(/\s+/, $Config{cc}))[0])
+ if($Config{cc} =~ /\s/);
+
+ undef;
}
1; # must be true
diff --git a/t/multi-word-compiler.t b/t/multi-word-compiler.t
index 1fe415a..c9c0f86 100644
--- a/t/multi-word-compiler.t
+++ b/t/multi-word-compiler.t
@@ -20,19 +20,20 @@ BEGIN {
}
}
+my $fake_cc = qq{"$^X" $Config{cc}};
if ($Mock::Config::VERSION) {
- Mock::Config->import(cc => "$^X $Config{cc}");
+ Mock::Config->import(cc => $fake_cc);
}
elsif (defined($ActivePerl::VERSION) && $Config{cc} =~ /\bgcc\b/) {
my $obj = tied %Config::Config;
- $obj->{cc} = "$^X $Config{cc}";
+ $obj->{cc} = $fake_cc;
}
else {
- eval { $Config{cc} = "$^X $Config{cc}"; }
+ eval { $Config{cc} = $fake_cc; }
}
SKIP: {
skip "Couldn't update %Config", 1 if $@ =~ /%Config::Config is read-only/;
eval "use Devel::CheckLib";
- ok(!$@, "Good multi-word compiler is OK");
+ is $@, "", "Good multi-word compiler is OK";
}