File: 0001-Survive-systems-with-an-empty-routing-table.patch

package info (click to toggle)
libnet-route-perl 0.02-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 176 kB
  • ctags: 19
  • sloc: perl: 335; makefile: 2
file content (38 lines) | stat: -rw-r--r-- 1,127 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From: Niko Tyni <ntyni@debian.org>
Date: Mon, 24 Aug 2015 22:40:36 +0300
Subject: 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' );
+}