check_hpjd.t 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #! /usr/bin/perl -w -I ..
  2. #
  3. # HP JetDirect Test via check_hpjd
  4. #
  5. # $Id$
  6. #
  7. use strict;
  8. use Test;
  9. use NPTest;
  10. use vars qw($tests);
  11. BEGIN {$tests = 5; plan tests => $tests}
  12. my $successOutput = '/^Printer ok - /';
  13. my $failureOutput = '/Timeout: No [Rr]esponse from /';
  14. my $host_tcp_hpjd = getTestParameter( "host_tcp_hpjd", "NP_HOST_TCP_HPJD", undef,
  15. "A host (usually a printer) providing the HP-JetDirect Services" );
  16. my $host_nonresponsive = getTestParameter( "host_nonresponsive", "NP_HOST_NONRESPONSIVE", "10.0.0.1",
  17. "The hostname of system not responsive to network requests" );
  18. my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost",
  19. "An invalid (not known to DNS) hostname" );
  20. my $t;
  21. if ( -x "./check_hpjd" )
  22. {
  23. $t += checkCmd( "./check_hpjd $host_tcp_hpjd", 0, $successOutput );
  24. $t += checkCmd( "./check_hpjd $host_nonresponsive", 2, $failureOutput );
  25. $t += checkCmd( "./check_hpjd $hostname_invalid", 3 );
  26. }
  27. else
  28. {
  29. $t += skipMissingCmd( "./check_hpjd", $tests );
  30. }
  31. exit(0) if defined($Test::Harness::VERSION);
  32. exit($tests - $t);