check_hpjd.t 637 B

1234567891011121314151617181920212223242526272829303132
  1. #! /usr/bin/perl -w
  2. use strict;
  3. use Helper;
  4. use Cache;
  5. use Test;
  6. use vars qw($tests);
  7. BEGIN {$tests = 4; plan tests => $tests}
  8. exit(0) unless (-x "./check_hpjd");
  9. my $null = '';
  10. my $cmd;
  11. my $str;
  12. my $t;
  13. my $printer = get_option("hpjd_printer","HP Jet-Direct card address");
  14. $cmd = "./check_hpjd $printer";
  15. $str = `$cmd`;
  16. $t += ok $?>>8,0;
  17. print "Test was: $cmd\n" if ($?);
  18. $t += ok $str, '/^Printer ok - /';
  19. $cmd = "./check_hpjd $Cache::noserver";
  20. $str = `$cmd`;
  21. $t += ok $?>>8,2;
  22. print "Test was: $cmd\n" unless ($?);
  23. $t += ok $str, '/Timeout: No response from /';
  24. exit(0) if defined($Test::Harness::VERSION);
  25. exit($tests - $t);