check_tcp.t 537 B

123456789101112131415161718192021222324252627
  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. my $null = '';
  8. my $cmd;
  9. my $str;
  10. my $t;
  11. $cmd = "./check_tcp $Cache::hostname -p 80 -wt 300 -ct 600";
  12. $str = `$cmd`;
  13. $t += ok $?>>8,0;
  14. print "$cmd\n" if ($?);
  15. $t += ok $str, '/^TCP OK - [0-9]+ second response time on port 80/';
  16. $cmd = "./check_tcp $Cache::nullhost -p 81 -wt 0 -ct 0 -to 1";
  17. $str = `$cmd`;
  18. $t += ok $?>>8,2;
  19. print "$cmd\n" unless ($?);
  20. exit(0) if defined($Test::Harness::VERSION);
  21. exit($tests - $t);