Control: tag -1 patch

On Sun, Jun 14, 2015 at 10:18:39PM +0300, Niko Tyni wrote:
> Package: libnet-route-perl
> Version: 0.02-1
> Severity: important
> 
> As noticed by the reproducible builds CI system [1], this package fails
> to build on systems / namespaces with an empty routing table.
> 
>   t/50-integration.t ... 
>   1..2
>   # '/sbin/route -n' output:
>   # Kernel IP routing table
>   # Destination     Gateway         Genmask         Flags Metric Ref    Use 
> Iface
>   '/sbin/route -n' returned non-zero value 1 at 
> /home/niko/tmp/libnet-route-perl/blib/lib/Net/Route/Parser.pm line 70, <$fh> 
> line 2.
>   # Looks like your test exited with 25 before it could output anything.
>   Dubious, test returned 25 (wstat 6400, 0x1900)
>   Failed 2/2 subtests 
>  
> [1] 
> https://reproducible.debian.net/rb-pkg/unstable/amd64/libnet-route-perl.html

Somewhat crude patch attached. Eyeballs welcome.
-- 
Niko Tyni   nt...@debian.org
>From d1037d39db8deac95e1192b0af4f1b2dd20c717d Mon Sep 17 00:00:00 2001
From: Niko Tyni <nt...@debian.org>
Date: Mon, 24 Aug 2015 22:40:36 +0300
Subject: [PATCH] Survive systems with an empty routing table

On at least Linux, 'route -n' returns 1 if there are no routes.
This shouldn't make the test suite fail, so skip the tests on errors.

This is not an optimal solution as other errors might now
go unnoticed.

Bug-Debian: https://bugs.debian.org/788758
---
 t/50-integration.t | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/t/50-integration.t b/t/50-integration.t
index d408d43..e4677c2 100644
--- a/t/50-integration.t
+++ b/t/50-integration.t
@@ -20,11 +20,12 @@ sub diag_system_command
     return;
 }
 
+SKIP: {
 my $table_ref;
 if ( !eval { $table_ref = Net::Route::Table->from_system(); 1 } )
 {
     diag_system_command();
-    die $EVAL_ERROR;
+    skip "error getting routes: $EVAL_ERROR", 2;
 }
 
 my $default_network = NetAddr::IP->new( '0.0.0.0', '0.0.0.0' );
@@ -33,3 +34,4 @@ is( $table_ref->default_route()->destination(), $default_network, 'The default g
 
 my $size = @{ $table_ref->all_routes() };
 cmp_ok( $size, '>' , 1, 'There are at least two routes' );
+}
-- 
2.1.4

Reply via email to