From 93901d5ff10cd7fd915cc09d7c496cec49f82ce5 Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Fri, 13 Jun 2014 14:20:14 +0200 Subject: tests: fping checks require being root or setuid root on the fping binary. Check this before running the test. Signed-off-by: Sven Nierlein --- plugins/t/check_fping.t | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'plugins/t/check_fping.t') diff --git a/plugins/t/check_fping.t b/plugins/t/check_fping.t index 45a9be8a..08692e46 100644 --- a/plugins/t/check_fping.t +++ b/plugins/t/check_fping.t @@ -27,16 +27,18 @@ my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_IN my $t; -if ( -x "./check_fping" ) -{ +my $fping = qx(which fping 2> /dev/null); +chomp($fping); +if( ! -x "./check_fping") { + $t += skipMissingCmd( "./check_fping", $tests ); +} +elsif ( $> != 0 && (!$fping || ! -u $fping)) { + $t += skipMsg( "./check_fping", $tests ); +} else { $t += checkCmd( "./check_fping $host_responsive", 0, $successOutput ); $t += checkCmd( "./check_fping $host_nonresponsive", [ 1, 2 ] ); $t += checkCmd( "./check_fping $hostname_invalid", [ 1, 2 ] ); } -else -{ - $t += skipMissingCmd( "./check_fping", $tests ); -} exit(0) if defined($Test::Harness::VERSION); exit($tests - $t); -- cgit v1.2.3