check_dns.t 552 B

12345678910111213141516171819202122232425262728
  1. #! /usr/bin/perl -w
  2. use strict;
  3. use Cache;
  4. use Test;
  5. use vars qw($tests);
  6. BEGIN {$tests = 3; plan tests => $tests}
  7. #`nslookup localhost > /dev/null 2>&1` || exit(77);
  8. my $null = '';
  9. my $cmd;
  10. my $str;
  11. my $t;
  12. $str = `./check_dns $Cache::dnshost -to 5`;
  13. $t += ok $?>>8,0;
  14. print "Test was: $cmd\n" if ($?);
  15. $t += ok $str, '/DNS OK: +[\.0-9]+ seconds response time, /';
  16. $cmd = "./check_dns $Cache::nullhost -to 1";
  17. $str = `$cmd`;
  18. $t += ok $?>>8,2;
  19. print "Test was: $cmd\n" unless ($?);
  20. exit(0) if defined($Test::Harness::VERSION);
  21. exit($tests - $t);