check_fping.t 637 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #! /usr/bin/perl -w
  2. # $Id$
  3. use strict;
  4. use Cache;
  5. use Test;
  6. use vars qw($tests);
  7. BEGIN {$tests = 3; plan tests => $tests}
  8. exit(0) unless (-x "./check_fping");
  9. #`fping 127.0.0.1 > /dev/null 2>&1` || exit(77);
  10. my $null = '';
  11. my $cmd;
  12. my $str;
  13. my $t;
  14. my $stat;
  15. $cmd = "./check_fping 127.0.0.1";
  16. $str = `$cmd`;
  17. $t += ok $?>>8,0;
  18. print "Test was: $cmd\n" if ($?);
  19. $t += ok $str, '/^FPING OK - 127.0.0.1/';
  20. $cmd = "./check_fping $Cache::nullhost";
  21. $str = `$cmd`;
  22. if ($?>>8 == 1 or $?>>8 == 2) {
  23. $stat = 2;
  24. }
  25. $t += ok $stat,2;
  26. print "Test was: $cmd\n" if (($?>>8) < 1);
  27. exit(0) if defined($Test::Harness::VERSION);
  28. exit($tests - $t);