From dbef30a62b2ca0b18690e69cb7b13fa506da21d6 Mon Sep 17 00:00:00 2001 From: Mike Sheldrake Date: Wed, 10 Aug 2011 08:15:15 +0200 Subject: [PATCH] ExtUtils::ParseXS: Test All @INC Derived typemap Locations The ExtUtils::ParseXS tests would sometime fail to locate some core Perl typemaps in @INC. This fixes CPAN RT #70047. Patch slightly modified by Steffen Mueller. Includes the mandatory version bump to a development version. --- dist/ExtUtils-ParseXS/Changes | 5 +++++ dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm | 2 +- dist/ExtUtils-ParseXS/t/101-standard_typemap_locations.t | 15 ++++++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/dist/ExtUtils-ParseXS/Changes b/dist/ExtUtils-ParseXS/Changes index 2c32803..b721f85 100644 --- a/dist/ExtUtils-ParseXS/Changes +++ b/dist/ExtUtils-ParseXS/Changes @@ -1,5 +1,10 @@ Revision history for Perl extension ExtUtils::ParseXS. +3.02_01 - ... + + - Test fix: Try all @INC-derived typemap locations. (CPAN RT #70047) + [Mike Sheldrake] + 3.02 - Thu Aug 4 18:19:00 CET 2011 - Test fix: Use File::Spec->catfile instead of catdir where appropriate. diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm index bb39bf3..503ab8d 100644 --- a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm +++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm @@ -35,7 +35,7 @@ our @EXPORT_OK = qw( process_file report_error_count ); -our $VERSION = '3.02'; +our $VERSION = '3.02_01'; $VERSION = eval $VERSION if $VERSION =~ /_/; # The scalars in the line below remain as 'our' variables because pulling diff --git a/dist/ExtUtils-ParseXS/t/101-standard_typemap_locations.t b/dist/ExtUtils-ParseXS/t/101-standard_typemap_locations.t index e9e7e59..3b89706 100644 --- a/dist/ExtUtils-ParseXS/t/101-standard_typemap_locations.t +++ b/dist/ExtUtils-ParseXS/t/101-standard_typemap_locations.t @@ -17,7 +17,20 @@ use ExtUtils::ParseXS::Utilities qw( skip "No lib/ExtUtils/ directories under directories in \@INC", 1 unless @stl > 9; - ok( -f $stl[-10], + + # We check only as many location entries from the start of the array + # (where the @INC-related entries are) as there are entries from @INC. + # We manage to do that by stopping when we find the "updir" related + # entries, which we assume is never contained in a default @INC entry. + my $max = $#INC; + $max = $#stl if $#stl < $max; + foreach my $i (0.. $max) { + $max = $i, last if $stl[$i] =~ /\Q$updir\E/; + } + + my $updir = File::Spec->updir; + ok( + ( 0 < (grep -f $_, @stl[0..$max]) ), "At least one typemap file exists underneath \@INC directories" ); } -- 2.7.4