check_dns.t 584 B

1234567891011121314151617181920212223242526272829
  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. $cmd = "./check_dns 127.0.0.1 -to 5";
  13. $str = `$cmd`;
  14. $t += ok $?>>8,0;
  15. print "Test was: $cmd\n" if ($?);
  16. $t += ok $str, '/DNS ok - +[\.0-9]+ seconds response time, Address\(es\) is\/are /';
  17. $cmd = "./check_dns $Cache::nullhost -to 1";
  18. $str = `$cmd`;
  19. $t += ok $?>>8,2;
  20. print "Test was: $cmd\n" unless ($?);
  21. exit(0) if defined($Test::Harness::VERSION);
  22. exit($tests - $t);