/var/lib/pcp/testsuite/589 is in pcp-testsuite 3.8.12ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | #!/bin/sh
# PCP QA Test No. 589
# make sure that telnet-probe does what its supposed to
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
host=`./getpmcdhosts -L -n 1 2>$seq.notrun`
if [ -z "$host" ]
then
cat $seq.notrun
exit
fi
rm -f $seq.notrun
status=1 # failure is the default!
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
_filter()
{
sed -e 's;/[^ ]*/telnet-probe\([: ]\);.../telnet-probe\1;'
}
_filter2()
{
sed \
-e 's/__pmGetAddrInfo/gethostbyname/g' \
-e 's/__pmGetHostByName/gethostbyname/g' \
-e '/gethostbyname:/s/ Resolver Error 0 (no error)/ Unknown host/' \
-e 's/No route to host/Connection refused/'
}
# real QA test starts here
# simple error test
echo; echo === 1st test
echo quit | $PCP_BINADM_DIR/telnet-probe $host abc >$tmp.out 2>&1
sts=$?
cat $tmp.out | _filter
echo "exit status is $sts (should be 1 with error msg)"
echo quit | $PCP_BINADM_DIR/telnet-probe 1 2 3 >$tmp.out 2>&1
sts=$?
cat $tmp.out | _filter
echo "exit status is $sts (should be 1 with error msg)"
# should exit with good status
echo; echo === 2nd test
echo quit | $PCP_BINADM_DIR/telnet-probe localhost 22
echo "exit status is $? (should be 0)"
echo quit | $PCP_BINADM_DIR/telnet-probe $host 22
echo "exit status is $? (should be 0)"
# should fail to connect
#
# Note: [port] 26 below is unassigned by IANA although
# http://www.speedguide.net reports it may be used for RSFTP (simple
# FTP-like service) and perhaps an SMTP alternate ... for our
# purposes we're looking for a port that has no one listening
# on the remote end
# Another note: some firewalls will respond with "No route to host"
# rather than "Connection refused", so treat these as equivalent
#
echo; echo === 3rd test
echo quit | $PCP_BINADM_DIR/telnet-probe -v localhost 26 >$tmp.out 2>$tmp.err
sts=$?
cat $tmp.err $tmp.out | _filter2
echo "exit status is $sts (should be 1 with verbosity)"
echo quit | $PCP_BINADM_DIR/telnet-probe -v $host 26 >$tmp.out 2>$tmp.err
sts=$?
cat $tmp.err $tmp.out | _filter2
echo "exit status is $sts (should be 1 with verbosity)"
echo quit | $PCP_BINADM_DIR/telnet-probe -v no.such.host 26 >$tmp.out 2>$tmp.err
sts=$?
cat $tmp.err $tmp.out | _filter2
echo "exit status is $sts (should be 1 with verbosity)"
# success, all done
status=0
exit
|