1 #! /usr/bin/perl -w -I ..
3 # HP JetDirect Test via check_hpjd
12 plan skip_all
=> "check_hpjd not compiled" unless (-x
"check_hpjd");
16 my $successOutput = '/^Printer ok - /';
17 my $failureOutput = '/Timeout: No [Rr]esponse from /';
19 my $host_tcp_hpjd = getTestParameter
(
21 "A host (usually a printer) providing the HP-JetDirect Services"
24 my $host_nonresponsive = getTestParameter
(
25 "NP_HOST_NONRESPONSIVE",
26 "The hostname of system not responsive to network requests",
30 my $hostname_invalid = getTestParameter
(
31 "NP_HOSTNAME_INVALID",
32 "An invalid (not known to DNS) hostname",
39 skip
"No HP JetDirect defined", 2 unless $host_tcp_hpjd;
40 $res = NPTest
->testCmd("./check_hpjd $host_tcp_hpjd");
41 cmp_ok
( $res->return_code, '==', 0, "Jetdirect responding" );
42 like
( $res->output, $successOutput, "Output correct" );
45 $res = NPTest
->testCmd("./check_hpjd $host_nonresponsive");
46 cmp_ok
( $res->return_code, 'eq', 2, "Host not responding");
47 like
( $res->output, $failureOutput, "Output OK" );
49 $res = NPTest
->testCmd("./check_hpjd $hostname_invalid");
50 cmp_ok
( $res->return_code, 'eq', 3, "Hostname invalid");