summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorSven Nierlein <Sven.Nierlein@consol.de>2014-06-13 14:20:14 +0200
committerSven Nierlein <Sven.Nierlein@consol.de>2014-06-13 15:23:18 +0200
commit93901d5ff10cd7fd915cc09d7c496cec49f82ce5 (patch)
tree7532c4990cf605c5e1ea62bd1914525f8ea2e243 /plugins
parentfb89accaaa831def2f948192a04eae84c4777531 (diff)
downloadmonitoring-plugins-93901d5ff10cd7fd915cc09d7c496cec49f82ce5.tar.gz
tests: fping checks require being root or setuid root
on the fping binary. Check this before running the test. Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/t/check_fping.t14
1 files changed, 8 insertions, 6 deletions
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
27 27
28my $t; 28my $t;
29 29
30if ( -x "./check_fping" ) 30my $fping = qx(which fping 2> /dev/null);
31{ 31chomp($fping);
32if( ! -x "./check_fping") {
33 $t += skipMissingCmd( "./check_fping", $tests );
34}
35elsif ( $> != 0 && (!$fping || ! -u $fping)) {
36 $t += skipMsg( "./check_fping", $tests );
37} else {
32 $t += checkCmd( "./check_fping $host_responsive", 0, $successOutput ); 38 $t += checkCmd( "./check_fping $host_responsive", 0, $successOutput );
33 $t += checkCmd( "./check_fping $host_nonresponsive", [ 1, 2 ] ); 39 $t += checkCmd( "./check_fping $host_nonresponsive", [ 1, 2 ] );
34 $t += checkCmd( "./check_fping $hostname_invalid", [ 1, 2 ] ); 40 $t += checkCmd( "./check_fping $hostname_invalid", [ 1, 2 ] );
35} 41}
36else
37{
38 $t += skipMissingCmd( "./check_fping", $tests );
39}
40 42
41exit(0) if defined($Test::Harness::VERSION); 43exit(0) if defined($Test::Harness::VERSION);
42exit($tests - $t); 44exit($tests - $t);