meta-agl-basesystem: add libxml-xpath-perl
[AGL/meta-agl-devel.git] / meta-oem-production-readiness / meta-agl-basesystem / recipes-devtools / perl / libxml-xpath-perl / adjust-load-test-for-ptest.patch
1 t/00load.t: Adjust for ptest
2
3 Change load test to look for installed location in @INC as base for
4 modules instead of locally in 'lib' directory as when run inside the
5 source tree.
6
7 Upstream-Status: Inappropriate [OE ptest specific]
8
9 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
10 ---
11  t/00load.t | 16 ++++++++++++----
12  1 file changed, 12 insertions(+), 4 deletions(-)
13
14 diff --git a/t/00load.t b/t/00load.t
15 index abc8c58..88a5545 100644
16 --- a/t/00load.t
17 +++ b/t/00load.t
18 @@ -5,21 +5,29 @@ use strict;
19  use warnings FATAL => 'all';
20  
21  use Test::More tests => 22;
22 -use lib 'lib';
23  use Path::Tiny;
24  
25 -my $dir  = path('lib/');
26 +my $installdir = "";
27 +foreach (@INC) {
28 +    if (-d "$_/XML/XPath") {
29 +       $installdir = "$_/XML/XPath";
30 +       last;
31 +    }
32 +}
33 +my $dir  = path($installdir);
34  my $iter = $dir->iterator({
35      recurse         => 1,
36      follow_symlinks => 0,
37  });
38  
39 +BAIL_OUT( "XML::XPath does not compile" ) unless require_ok("XML::XPath");
40 +
41  while (my $path = $iter->()) {
42      next if $path->is_dir || $path !~ /\.pm$/;
43      my $module = $path->relative;
44 -    $module =~ s/(?:^lib\/|\.pm$)//g;
45 +    $module =~ s/(?:^.*XML\/|\.pm$)//g;
46      $module =~ s/\//::/g;
47 -    BAIL_OUT( "$module does not compile" ) unless require_ok($module);
48 +    BAIL_OUT( "$module does not compile" ) unless require_ok("XML::$module");
49  }
50  
51  diag( "Testing XML::XPath $XML::XPath::VERSION, Perl $], $^X" );