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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
Author: Niko Tyni <ntyni@debian.org>,
Franck Joncourt <franck.mail@dthconnex.com>
Description: update tests for Debian
The build dependency against Net:Pcap is dropped since it is only used to
find out an active network interface. The ifconfig(8) command is used instead
when DEBIAN_BUILD is set.
.
Sending ARP packets through the Net::ARP::send_packet function requires real
root privileges. Thus, we skip the send_packet test.
--- libnet-arp-perl.orig/t/send_packet.t
+++ libnet-arp-perl/t/send_packet.t
@@ -5,7 +5,7 @@
# Last update: 31.01.2007
use Net::ARP;
-use Test::More qw( no_plan );
+use Test::More skip_all => 'Requires real root privileges to build';
BEGIN
{
--- libnet-arp-perl.orig/test.pl
+++ libnet-arp-perl/test.pl
@@ -21,6 +21,31 @@
BEGIN
{
+ if ($ENV{DEBIAN_BUILD}) {
+ print "Executing Debian-specific branch in test.pl\n";
+ my $if_cmd = "/sbin/ifconfig";
+
+ open IFC, "$if_cmd |" or die "Could not execute $if_cmd: $!";
+ my @ifconfig_out = <IFC>;
+ close IFC;
+
+ for my $line (@ifconfig_out) {
+ if ($line =~ /^\s*(\w+)\s+Link/) {
+
+ next unless ($1 ne "lo");
+ $mac = Net::ARP::get_mac($1);
+
+ if ($mac eq "unknown") {
+ print "Unable to find Mac Address for device $1\n";
+ exit 1;
+
+ } else {
+ print "MAC of $1: $mac\n";
+ }
+ }
+ }
+ exit 0;
+ }
eval{ require Net::Pcap; };
if($@ =~ /^Can\'t\slocate/)
|