Permalink
Browse files

added a "timeout" on yy-system_installed for finding a library suitab…

…le for testing. This should reduce the number of false-positive failures due to picking an unsuitable library for testing.
  • Loading branch information...
1 parent 14f8c28 commit a09012ad3f4a17131cfa35b337dfc7f9486e6175 @jberger jberger committed Apr 3, 2012
Showing with 25 additions and 5 deletions.
  1. +25 −5 t/yy-system_installed.t
View
@@ -21,13 +21,33 @@ if ( $? ) {
my @installed = shuffle map { /^(\S+)/ ? $1 : () } `pkg-config --list-all`;
-my $lib = shift @installed;
+my ($lib, $cflags, $libs);
-chomp( my $cflags = `pkg-config --cflags $lib` );
-chomp( my $libs = `pkg-config --libs $lib` );
+my $i = 1;
-$cflags =~ s/\s*$//;
-$libs =~ s/\s*$//;
+while (1) {
+
+ $lib = shift @installed;
+
+ chomp( $cflags = `pkg-config --cflags $lib` );
+ chomp( $libs = `pkg-config --libs $lib` );
+
+ $cflags =~ s/\s*$//;
+ $libs =~ s/\s*$//;
+
+ if ($lib and $cflags and $libs) {
+ last;
+ }
+
+ if ($i++ == 3) {
+ plan skip_all => "Could not find a suitable library for testing";
+ last;
+ }
+
+ $lib = undef;
+ $cflags = undef;
+ $libs = undef;
+}
my $builder = Alien::Base::ModuleBuild->new(
module_name => 'MyTest',

0 comments on commit a09012a

Please sign in to comment.